Hi, On Tue, May 13, 2014 at 12:30 PM, Marek Szyprowski <m.szyprowski@xxxxxxxxxxx> wrote: > Hello, > > > On 2014-05-13 08:21, Vivek Gautam wrote: >> >> On Mon, May 12, 2014 at 10:19 PM, Kamil Debski <k.debski@xxxxxxxxxxx> >> wrote: >> > When the driver is removed s3c_hsotg_phy_disable is called three times >> > instead of once. This results in decreasing of the phy reference counter >> > below zero and thus consecutive inserts of the module fails. >> > >> > This patch removes calls to s3c_hsotg_phy_disable from s3c_hsotg_remove >> > and s3c_hsotg_udc_stop. >> > >> > s3c_hsotg_udc_stop is called from udc-core.c only after >> > usb_gadget_disconnect, which in turn calls s3c_hsotg_pullup, which >> > already calls s3c_hsotg_phy_disable. >> > >> > s3c_hsotg_remove must be called only after udc_stop, so there is no >> > point in disabling phy once again there. >> > >> > Signed-off-by: Kamil Debski <k.debski@xxxxxxxxxxx> >> > --- >> > drivers/usb/gadget/s3c-hsotg.c | 3 --- Please rebase on 'usb-next'. This file is moved to dwc2. "drivers/usb/dwc2/gadget.c" >> > 1 file changed, 3 deletions(-) >> > >> > diff --git a/drivers/usb/gadget/s3c-hsotg.c >> > b/drivers/usb/gadget/s3c-hsotg.c >> > index 2a9cb67..29d70a7 100644 >> > --- a/drivers/usb/gadget/s3c-hsotg.c >> > +++ b/drivers/usb/gadget/s3c-hsotg.c >> > @@ -3078,8 +3078,6 @@ static int s3c_hsotg_udc_stop(struct usb_gadget >> > *gadget, >> > >> > spin_lock_irqsave(&hsotg->lock, flags); >> > >> > - s3c_hsotg_phy_disable(hsotg); >> > - >> > if (!driver) >> > hsotg->driver = NULL; >> > >> > @@ -3766,7 +3764,6 @@ static int s3c_hsotg_remove(struct platform_device >> > *pdev) >> > usb_gadget_unregister_driver(hsotg->driver); >> > } >> > >> > - s3c_hsotg_phy_disable(hsotg); >> > if (hsotg->phy) >> > phy_exit(hsotg->phy); >> >> We may want to remove above two lines too, isn't it ? > > > Hmm, I think that more appropriate will be to remove calls to > phy_init()/phy_exit() > from s3c_hsotg_phy_enable()/s3c_hsotg_phy_disable() functions and leave > phy_init() > and phy_exit() only in s3c_hsotg_probe()/s3c_hsotg_remove() pair. Yea, that's one way. But i was just wondering, do the phy_init() and phy_exit() callbacks have any PHY's suspend/resume related settings. In that case we would still want to suspend phy when the driver is suspending. Although for phy-samsung-usb2 driver on exynos systems phy_inti() and phy_exit() are just no-ops. [snip] -- Best Regards Vivek Gautam Samsung R&D Institute, Bangalore India -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html