Commit 8e2f5eae authored by Bartosz Golaszewski's avatar Bartosz Golaszewski Committed by Sekhar Nori

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: default avatarBartosz Golaszewski <bgolaszewski@baylibre.com>
Acked-by: default avatarAlan Stern <stern@rowland.harvard.edu>
Signed-off-by: default avatarSekhar Nori <nsekhar@ti.com>
parent 3ea9ae57
......@@ -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;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment