RE: [PATCH 1/1] usb: host: xhci-plat: keep runtime active when remove host

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



 
 
> > diff --git a/drivers/usb/host/xhci-plat.c
> > b/drivers/usb/host/xhci-plat.c index 1d4f6f85f0fe..f38d53528c96 100644
> > --- a/drivers/usb/host/xhci-plat.c
> > +++ b/drivers/usb/host/xhci-plat.c
> > @@ -362,6 +362,7 @@ static int xhci_plat_remove(struct platform_device *dev)
> >  	struct clk *reg_clk = xhci->reg_clk;
> >  	struct usb_hcd *shared_hcd = xhci->shared_hcd;
> >
> > +	pm_runtime_get_sync(&dev->dev);
> >  	xhci->xhc_state |= XHCI_STATE_REMOVING;
> >
> >  	usb_remove_hcd(shared_hcd);
> 
> You mustn't add a pm_runtime_get call without a corresponding pm_runtime_put
> call.
> 
> With just this one call, if the role switched from host to device and then back to host,
> then the host would never be able to go into runtime suspend.
> 

I may not consider carefully for other cases, for my case, the xhci-plat device
will be removed, and re-created. But if we remove the driver using modprobe,
it may have issues.

> In this case the correspondence between the get's and the put's will probably be
> obscure; some comments would help.
> 

I explained at the reply for Mathias's, but I am not 100% it is the root cause.

Peter





[Index of Archives]     [Linux Kernel]     [Kernel Development Newbies]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux