All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alan Stern <stern@rowland.harvard.edu>
To: Tony Lindgren <tony@atomide.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	linux-usb@vger.kernel.org, linux-omap@vger.kernel.org
Subject: usb: host: ohci-platform: Implement ohci_platform_shutdown
Date: Fri, 22 Mar 2019 14:37:30 -0400 (EDT)	[thread overview]
Message-ID: <Pine.LNX.4.44L0.1903221434270.1512-100000@iolanthe.rowland.org> (raw)

On Fri, 22 Mar 2019, Tony Lindgren wrote:

> If OHCI is runtime suspended, we can currently get an "imprecise
> external abort" on reboot with ohci-platform loaded when PM runtime
> is implemented for the SoC.
> 
> Let's fix this by implementing ohci_platform_shutdown with PM runtime
> calls clocking the hardware before calling hcd->driver->shutdown.
> 
> Fixes: 0aa0b93e7af6 ("usb: host: ohci-platform: Add basic runtime PM support")
> Signed-off-by: Tony Lindgren <tony@atomide.com>
> ---
>  drivers/usb/host/ohci-platform.c | 18 +++++++++++++++++-
>  1 file changed, 17 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/usb/host/ohci-platform.c b/drivers/usb/host/ohci-platform.c
> --- a/drivers/usb/host/ohci-platform.c
> +++ b/drivers/usb/host/ohci-platform.c
> @@ -240,6 +240,22 @@ static int ohci_platform_probe(struct platform_device *dev)
>  	return err;
>  }
>  
> +static void ohci_platform_shutdown(struct platform_device *pdev)
> +{
> +	struct usb_hcd *hcd = platform_get_drvdata(pdev);
> +	int err;
> +
> +	err = pm_runtime_get_sync(&pdev->dev);
> +	if (err < 0)
> +		pm_runtime_put_noidle(&pdev->dev);
> +
> +	if (hcd->driver->shutdown)
> +		hcd->driver->shutdown(hcd);
> +
> +	if (!err)
> +		pm_runtime_put_sync(&pdev->dev);
> +}

How about putting these runtime PM additions into
usb_hcd_platform_shutdown instead, so they will apply to all platform
controller drivers?

Also, are you certain you want the pm_runtime_put_sync at the end?  If 
the system is shutting down anyway, why waste time doing an extra 
runtime suspend?

Alan Stern

> +
>  static int ohci_platform_remove(struct platform_device *dev)
>  {
>  	struct usb_hcd *hcd = platform_get_drvdata(dev);
> @@ -326,7 +342,7 @@ static struct platform_driver ohci_platform_driver = {
>  	.id_table	= ohci_platform_table,
>  	.probe		= ohci_platform_probe,
>  	.remove		= ohci_platform_remove,
> -	.shutdown	= usb_hcd_platform_shutdown,
> +	.shutdown	= ohci_platform_shutdown,
>  	.driver		= {
>  		.name	= "ohci-platform",
>  		.pm	= &ohci_platform_pm_ops,
>

             reply	other threads:[~2019-03-22 18:37 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-22 18:37 Alan Stern [this message]
  -- strict thread matches above, loose matches on Subject: below --
2019-03-22 21:01 usb: host: ohci-platform: Implement ohci_platform_shutdown Alan Stern
2019-03-22 20:41 Tony Lindgren
2019-03-22 20:03 Alan Stern
2019-03-22 19:30 Tony Lindgren
2019-03-22 18:11 Tony Lindgren

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Pine.LNX.4.44L0.1903221434270.1512-100000@iolanthe.rowland.org \
    --to=stern@rowland.harvard.edu \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=tony@atomide.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.