return -EINVAL;
}
- mutex_lock(&hsotg->init_mutex);
WARN_ON(hsotg->driver);
driver->driver.bus = NULL;
dev_info(hsotg->dev, "bound driver %s\n", driver->driver.name);
- mutex_unlock(&hsotg->init_mutex);
-
return 0;
err:
- mutex_unlock(&hsotg->init_mutex);
hsotg->driver = NULL;
return ret;
}
if (!hsotg)
return -ENODEV;
- mutex_lock(&hsotg->init_mutex);
-
/* all endpoints should be shutdown */
for (ep = 1; ep < hsotg->num_of_eps; ep++) {
if (hsotg->eps_in[ep])
regulator_bulk_disable(ARRAY_SIZE(hsotg->supplies), hsotg->supplies);
- mutex_unlock(&hsotg->init_mutex);
-
return 0;
}
return 0;
}
- mutex_lock(&hsotg->init_mutex);
spin_lock_irqsave(&hsotg->lock, flags);
if (is_on) {
hsotg->enabled = 1;
hsotg->gadget.speed = USB_SPEED_UNKNOWN;
spin_unlock_irqrestore(&hsotg->lock, flags);
- mutex_unlock(&hsotg->init_mutex);
return 0;
}
if (hsotg->lx_state != DWC2_L0)
return ret;
- mutex_lock(&hsotg->init_mutex);
-
if (hsotg->driver) {
int ep;
clk_disable(hsotg->clk);
}
- mutex_unlock(&hsotg->init_mutex);
-
return ret;
}
if (hsotg->lx_state == DWC2_L2)
return ret;
- mutex_lock(&hsotg->init_mutex);
-
if (hsotg->driver) {
dev_info(hsotg->dev, "resuming usb gadget %s\n",
hsotg->driver->driver.name);
dwc2_hsotg_core_connect(hsotg);
spin_unlock_irqrestore(&hsotg->lock, flags);
}
- mutex_unlock(&hsotg->init_mutex);
return ret;
}