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 --- > 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.
> clk_disable_unprepare(hsotg->clk);
Best regards -- Marek Szyprowski, PhD Samsung R&D Institute Poland -- 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