* [v2,2/6] usb: ohci-da8xx: let the regulator framework keep track of use count
@ 2019-03-29 9:33 Bartosz Golaszewski
0 siblings, 0 replies; only message in thread
From: Bartosz Golaszewski @ 2019-03-29 9:33 UTC (permalink / raw)
To: Sekhar Nori, Kevin Hilman, Alan Stern, Greg Kroah-Hartman
Cc: linux-arm-kernel, linux-kernel, linux-usb, Bartosz Golaszewski
From: Bartosz Golaszewski <bgolaszewski@baylibre.com>
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 <bgolaszewski@baylibre.com>
---
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;
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2019-03-29 9:33 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-03-29 9:33 [v2,2/6] usb: ohci-da8xx: let the regulator framework keep track of use count Bartosz Golaszewski
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).