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]

 



On Tue, 12 May 2020, Peter Chen wrote:

> From: Li Jun <jun.li@xxxxxxx>
> 
> While remove host(e.g. for USB role switch from host to device), if
> runtime pm is enabled by user, below oops are occurs at dwc3
> and cdns3 platform. Keep the xhci-plat device being active during
> remove host fixes them.

...

> 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.

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

Alan Stern




[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