linux-usb.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tony Lindgren <tony@atomide.com>
To: Alan Stern <stern@rowland.harvard.edu>
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 13:41:40 -0700	[thread overview]
Message-ID: <20190322204140.GF19425@atomide.com> (raw)

* Alan Stern <stern@rowland.harvard.edu> [190322 20:03]:
> On Fri, 22 Mar 2019, Tony Lindgren wrote:
> 
> > * Alan Stern <stern@rowland.harvard.edu> [190322 18:37]:
> > > How about putting these runtime PM additions into
> > > usb_hcd_platform_shutdown instead, so they will apply to all platform
> > > controller drivers?
> > 
> > OK let's do that then.
> > 
> > > 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?
> > 
> > Well mostly to keep the calls paired. But maybe there are
> > also kexec reboot cases where we'd want to have things
> > properly disabled for PM before kexec.
> 
> I'm not sure that makes sense.  You can't actually disable anything for 
> runtime PM from within a driver; all you can do is tell the runtime PM 
> core that _you're_ not using the device any more.  But if some other 
> part of the system is still using it, it will remain at full power.

Right, it's just a usecount and whatever happens after that is
ouf of the driver control. And in the shutdown case PM runtime
does not have much of a chance to do anything here :)

Not much point checking the pm_runtime_get_sync() for errors
either then.. We can just add a comment there.

If the patch below looks OK to you I'll post with an updated
description.

Regards,

Tony

8< -------------------

diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c
--- a/drivers/usb/core/hcd.c
+++ b/drivers/usb/core/hcd.c
@@ -3017,6 +3017,9 @@ usb_hcd_platform_shutdown(struct platform_device *dev)
 {
 	struct usb_hcd *hcd = platform_get_drvdata(dev);
 
+	/* No need for pm_runtime_put(), we're shutting down */
+	pm_runtime_get_sync(&dev->dev);
+
 	if (hcd->driver->shutdown)
 		hcd->driver->shutdown(hcd);
 }

             reply	other threads:[~2019-03-22 20:41 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-22 20:41 Tony Lindgren [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:03 Alan Stern
2019-03-22 19:30 Tony Lindgren
2019-03-22 18:37 Alan Stern
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=20190322204140.GF19425@atomide.com \
    --to=tony@atomide.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=stern@rowland.harvard.edu \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).