Re: [PATCH v4 6/6] usb: ohci-da8xx: drop the vbus GPIO

From: Sekhar Nori
Date: Fri Apr 12 2019 - 06:32:27 EST


Hi Bartosz,

On 11/04/19 3:00 PM, Bartosz Golaszewski wrote:
> @@ -209,9 +197,7 @@ static irqreturn_t ohci_da8xx_oc_thread(int irq, void *data)
> int ret;
>
> if (gpiod_get_value_cansleep(da8xx_ohci->oc_gpio)) {
> - if (da8xx_ohci->vbus_gpio) {
> - gpiod_set_value_cansleep(da8xx_ohci->vbus_gpio, 0);
> - } else if (da8xx_ohci->vbus_reg) {
> + if (da8xx_ohci->vbus_reg) {
> ret = regulator_disable(da8xx_ohci->vbus_reg);
> if (ret)
> dev_err(dev,

You can now reduce a level of indentation here by doing

if (gpiod_get_value_cansleep(da8xx_ohci->oc_gpio) &&
da8xx_ohci->vbus_reg) {
ret = regulator_disable(da8xx_ohci->vbus_reg);
if (ret)
dev_err(dev, "Failed to disable regulator: %d\n",
ret);
}

Thanks
Sekhar