Received: by 2002:a25:5b86:0:0:0:0:0 with SMTP id p128csp1344035ybb; Fri, 29 Mar 2019 02:37:05 -0700 (PDT) X-Google-Smtp-Source: APXvYqwhMqwweih7GoHHrKS5Zz93Dw29zL2erJYMru9xNhkkS3zhRBoR0Qw87qTcrGcP5qd9UoQ8 X-Received: by 2002:a17:902:e48c:: with SMTP id cj12mr1074579plb.93.1553852225000; Fri, 29 Mar 2019 02:37:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553852224; cv=none; d=google.com; s=arc-20160816; b=C/aaZ9Keq1n/nlF66otDY/IyxAqYCfzSlSAHyq2C4BYi98AVmQXPtrlk9tNftO2yiz 8iVwqei59WkMXGBGhSY6tSVT8/AlosF6WcnDFTZ1jsLTwbeZfQTMew/kWlaqHKnMoMBP rkCZVr943KnHhLm8DkO19z7WyRGa/YAkmUU2PxDGS3SYc18D89Iar7OZ9glTzSvwneHC w9aq5+b2YcAwe/BIL7FPz/sScwlVZJL6xWUAamkZ8Di9XiUHjfIZgAKH+d+8njW8E2Xw 9Cf0cwYI7a+AUmhbgnJpqu9Fr/PJiKZcaVXP5HIE5GzPpGDe7dSSTSRgcXOeFH74eYhf yToA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=ze5SSoMthSUJEWILh/6R6Dx6kiGpd0KVEMFuw2rprTY=; b=NzZQFL+/Re2niSs3AqtHnIOmPK7MgyqRsGftg8yu/shHXWbC/FLz73x3euDOWnFuec zLI+J3rE7bFplghTXcqUZAUvHJ2uDxA1fb1hVj5HneUu+T+cTD3I57v0SgTd99gsVHbo gnRfKwijgBTH99ulSV1JPghiiaM4pfl8/xjVzWmIBFYEyqjbFWYQSFFyH6NL8i0Qe2K3 lxghFLu4JiNaTsDWQ5EStJxCb+1g9ZBRKTojq/VpGQZVAKtT+KjuSYXgvUluIMclD2kU VEYJdDH1UZrjxDKRS5tDTyq2C5CxtnL/Im2uRkRjqcgKhu8UuruHC0SfHyRVQ6YVvRgw dQyA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bgdev-pl.20150623.gappssmtp.com header.s=20150623 header.b=0BSzGfvn; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k22si1360066pfa.215.2019.03.29.02.36.49; Fri, 29 Mar 2019 02:37:04 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@bgdev-pl.20150623.gappssmtp.com header.s=20150623 header.b=0BSzGfvn; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728909AbfC2JeN (ORCPT + 99 others); Fri, 29 Mar 2019 05:34:13 -0400 Received: from mail-wm1-f68.google.com ([209.85.128.68]:52023 "EHLO mail-wm1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728743AbfC2Jdq (ORCPT ); Fri, 29 Mar 2019 05:33:46 -0400 Received: by mail-wm1-f68.google.com with SMTP id 4so1780263wmf.1 for ; Fri, 29 Mar 2019 02:33:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=ze5SSoMthSUJEWILh/6R6Dx6kiGpd0KVEMFuw2rprTY=; b=0BSzGfvncOp+if/tJIHLno6MGS9J176p5OuCiUpvRIpwJtY2UTdoe7/x8bZzvQbwUy 6uov2hdT4bF9A/9E6HpwTs9bu4JOG2GXE8UHxOIHMOwRbapJqNKYArovWz/LB09vYkx7 Z7YS4oK6a7aOgz4LmJExBeZroq1pWS1YSdDLekZmHY2uPDsG27TckGUfOhQbylpj4Mg0 8TCWDMTM73KtTcIyofhdWeOx1qqeYqqeRaNzKA7EMrLIZFK9PTTJ4WKbzGfy+R2SVxqk Y4ucaijH8aGjkigRxgt7WV8oW7fLIZigBVqP1FcksX4+3DCDLFya+XZlU+QBCy4lNHZ3 5r6w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=ze5SSoMthSUJEWILh/6R6Dx6kiGpd0KVEMFuw2rprTY=; b=a+0b4rinxRJpCK9GAeeYjbQc1SRJ+lS68lw5WLyVhItIAusLDkyYYlaIGeoCAvXusR OWoelVz14y0M9iKOba2/JO7cMF4zSCYXGtMvsXYWvbNGjhPWj14YD7x4O008r3YazQaZ Q7Y8IfqwGZPBTggTY1bnBFNzjZUzaZCQu1N2jg2xeWBNgBLUsuMZ/KtTnmsbFr1EwxVr i/Kx2IehpbO3UuTd6SkYKZglZzm0GopehiMrCyYYAcZLuOFtBpIF9TasQP0kg3C3LAER rEeipXxNOUVd/4k42LPo3CQ8ZKV3EfeTuFQDSZGICu3kE02Cl8AW/+foB0sRTYY+N8Cw ilrg== X-Gm-Message-State: APjAAAUkNiou4xZJf2OTuPtrIDhdYIn91rSIiyY4U7ueV4SUe/8Bhlcz ejQr9ItN1yU5ufxwbAlnkfdz2A== X-Received: by 2002:a1c:e085:: with SMTP id x127mr2814871wmg.87.1553852024425; Fri, 29 Mar 2019 02:33:44 -0700 (PDT) Received: from localhost.localdomain (aputeaux-684-1-29-77.w90-86.abo.wanadoo.fr. [90.86.254.77]) by smtp.gmail.com with ESMTPSA id s12sm1957125wmj.42.2019.03.29.02.33.43 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 29 Mar 2019 02:33:43 -0700 (PDT) From: Bartosz Golaszewski To: Sekhar Nori , Kevin Hilman , Alan Stern , Greg Kroah-Hartman Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org, Bartosz Golaszewski Subject: [PATCH v2 2/6] usb: ohci-da8xx: let the regulator framework keep track of use count Date: Fri, 29 Mar 2019 10:33:30 +0100 Message-Id: <20190329093334.3885-3-brgl@bgdev.pl> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190329093334.3885-1-brgl@bgdev.pl> References: <20190329093334.3885-1-brgl@bgdev.pl> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Bartosz Golaszewski There's no reason to have a separate variable to keep track of the regulator state. The regulator core already does that. Remove reg_enabled from struct da8xx_ohci_hcd. Signed-off-by: Bartosz Golaszewski --- drivers/usb/host/ohci-da8xx.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/drivers/usb/host/ohci-da8xx.c b/drivers/usb/host/ohci-da8xx.c index ca8a94f15ac0..9c6d1f03b871 100644 --- a/drivers/usb/host/ohci-da8xx.c +++ b/drivers/usb/host/ohci-da8xx.c @@ -40,7 +40,6 @@ struct da8xx_ohci_hcd { struct phy *usb11_phy; struct regulator *vbus_reg; struct notifier_block nb; - unsigned int reg_enabled; struct gpio_desc *vbus_gpio; struct gpio_desc *oc_gpio; }; @@ -100,21 +99,18 @@ static int ohci_da8xx_set_power(struct usb_hcd *hcd, int on) if (!da8xx_ohci->vbus_reg) return 0; - if (on && !da8xx_ohci->reg_enabled) { + if (on) { ret = regulator_enable(da8xx_ohci->vbus_reg); if (ret) { dev_err(dev, "Failed to enable regulator: %d\n", ret); return ret; } - da8xx_ohci->reg_enabled = 1; - - } else if (!on && da8xx_ohci->reg_enabled) { + } else if (!on) { ret = regulator_disable(da8xx_ohci->vbus_reg); if (ret) { dev_err(dev, "Failed to disable regulator: %d\n", ret); return ret; } - da8xx_ohci->reg_enabled = 0; } return 0; -- 2.21.0