mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Wysocki, Rafael J" <rafael.j.wysocki@intel.com>
To: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>,
	"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>
Cc: <linux-kernel@vger.kernel.org>, <kernel@pengutronix.de>,
	<linux-pm@vger.kernel.org>
Subject: Re: [PATCH RFC] PM: runtime: Drop device usage only after remove is done
Date: Mon, 3 Apr 2023 21:17:54 +0200	[thread overview]
Message-ID: <261135b7-6d81-d330-2beb-2473d9d4a36e@intel.com> (raw)
In-Reply-To: <20230402103951.2510773-1-u.kleine-koenig@pengutronix.de>

CC-ing linux-pm would have been nice (done now).

On 4/2/2023 12:39 PM, Uwe Kleine-König wrote:
> Many device drivers call one of the variants of pm_runtime_resume() in
> their remove callback. So calling pm_runtime_put_sync() just before that
> is ineffective as the suspend callback might just be called just to
> resume the device directly afterwards again.
>
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> ---
> Hello,
>
> this is a theoretical issue that I noticed while doing some research how
> pm-runtime works. Not sure it makes sense, so I marked it as RFC.
>
> Best regards
> Uwe
>
>   drivers/base/dd.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/base/dd.c b/drivers/base/dd.c
> index 8def2ba08a82..6beac141d3d2 100644
> --- a/drivers/base/dd.c
> +++ b/drivers/base/dd.c
> @@ -1235,10 +1235,10 @@ static void __device_release_driver(struct device *dev, struct device *parent)
>   
>   		bus_notify(dev, BUS_NOTIFY_UNBIND_DRIVER);
>   
> -		pm_runtime_put_sync(dev);
> -
>   		device_remove(dev);
>   
> +		pm_runtime_put_sync(dev);
> +
>   		if (dev->bus && dev->bus->dma_cleanup)
>   			dev->bus->dma_cleanup(dev);
>   
>
> base-commit: fe15c26ee26efa11741a7b632e9f23b01aca4cc6

      reply	other threads:[~2023-04-03 19:18 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-02 10:39 Uwe Kleine-König
2023-04-03 19:17 ` Wysocki, Rafael J [this message]

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=261135b7-6d81-d330-2beb-2473d9d4a36e@intel.com \
    --to=rafael.j.wysocki@intel.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=kernel@pengutronix.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=u.kleine-koenig@pengutronix.de \
    /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

all inboxes | Powered by JetHome®