diff options
author | Bartosz Golaszewski <bgolaszewski@baylibre.com> | 2019-04-12 15:36:36 +0300 |
---|---|---|
committer | Sekhar Nori <nsekhar@ti.com> | 2019-04-12 17:13:54 +0300 |
commit | 8e2f5eae24351d6f536c602eccdc4ad12b675c28 (patch) | |
tree | 4192f70df85b3321efaaa4b1e953b7ee122d7583 /drivers/usb/host/ohci-da8xx.c | |
parent | 3ea9ae57b412391b14d059ba424c9c51bfbc5059 (diff) | |
download | linux-8e2f5eae24351d6f536c602eccdc4ad12b675c28.tar.xz |
usb: ohci-da8xx: let the regulator framework keep track of use count
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>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Sekhar Nori <nsekhar@ti.com>
Diffstat (limited to 'drivers/usb/host/ohci-da8xx.c')
-rw-r--r-- | drivers/usb/host/ohci-da8xx.c | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/drivers/usb/host/ohci-da8xx.c b/drivers/usb/host/ohci-da8xx.c index ca8a94f15ac0..209a262b5565 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 { 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; |