linux-pm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Leonard Crestez <leonard.crestez@nxp.com>
To: Sasha Levin <sashal@kernel.org>, MyungJoo Ham <myungjoo.ham@samsung.com>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"stable@vger.kernel.org" <stable@vger.kernel.org>,
	Chanwoo Choi <cw00.choi@samsung.com>,
	"linux-pm@vger.kernel.org" <linux-pm@vger.kernel.org>
Subject: Re: [PATCH AUTOSEL 4.19 075/128] PM / devfreq: passive: Use non-devm notifiers
Date: Mon, 23 Sep 2019 20:38:53 +0000	[thread overview]
Message-ID: <VI1PR04MB7023BD0451C047D6A59D986EEE850@VI1PR04MB7023.eurprd04.prod.outlook.com> (raw)
In-Reply-To: 20190922185418.2158-75-sashal@kernel.org

On 22.09.2019 21:56, Sasha Levin wrote:
> From: Leonard Crestez <leonard.crestez@nxp.com>
> 
> [ Upstream commit 0ef7c7cce43f6ecc2b96d447e69b2900a9655f7c ]

This will introduce an "unused variable warning" unless you also 
cherry-pick commit 0465814831a9 ("PM / devfreq: passive: fix compiler 
warning").

> The devfreq passive governor registers and unregisters devfreq
> transition notifiers on DEVFREQ_GOV_START/GOV_STOP using devm wrappers.
> 
> If devfreq itself is registered with devm then a warning is triggered on
> rmmod from devm_devfreq_unregister_notifier. Call stack looks like this:
> 
> 	devm_devfreq_unregister_notifier+0x30/0x40
> 	devfreq_passive_event_handler+0x4c/0x88
> 	devfreq_remove_device.part.8+0x6c/0x9c
> 	devm_devfreq_dev_release+0x18/0x20
> 	release_nodes+0x1b0/0x220
> 	devres_release_all+0x78/0x84
> 	device_release_driver_internal+0x100/0x1c0
> 	driver_detach+0x4c/0x90
> 	bus_remove_driver+0x7c/0xd0
> 	driver_unregister+0x2c/0x58
> 	platform_driver_unregister+0x10/0x18
> 	imx_devfreq_platdrv_exit+0x14/0xd40 [imx_devfreq]
> 
> This happens because devres_release_all will first remove all the nodes
> into a separate todo list so the nested devres_release from
> devm_devfreq_unregister_notifier won't find anything.
> 
> Fix the warning by calling the non-devm APIS for frequency notification.
> Using devm wrappers is not actually useful for a governor anyway: it
> relies on the devfreq core to correctly match the GOV_START/GOV_STOP
> notifications.
> 
> Fixes: 996133119f57 ("PM / devfreq: Add new passive governor")
> Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com>
> Acked-by: Chanwoo Choi <cw00.choi@samsung.com>
> Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
> Signed-off-by: Sasha Levin <sashal@kernel.org>
> ---
>   drivers/devfreq/governor_passive.c | 6 +++---
>   1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/devfreq/governor_passive.c b/drivers/devfreq/governor_passive.c
> index 3bc29acbd54e8..22fd41b4c1098 100644
> --- a/drivers/devfreq/governor_passive.c
> +++ b/drivers/devfreq/governor_passive.c
> @@ -168,12 +168,12 @@ static int devfreq_passive_event_handler(struct devfreq *devfreq,
>   			p_data->this = devfreq;
>   
>   		nb->notifier_call = devfreq_passive_notifier_call;
> -		ret = devm_devfreq_register_notifier(dev, parent, nb,
> +		ret = devfreq_register_notifier(parent, nb,
>   					DEVFREQ_TRANSITION_NOTIFIER);
>   		break;
>   	case DEVFREQ_GOV_STOP:
> -		devm_devfreq_unregister_notifier(dev, parent, nb,
> -					DEVFREQ_TRANSITION_NOTIFIER);
> +		WARN_ON(devfreq_unregister_notifier(parent, nb,
> +					DEVFREQ_TRANSITION_NOTIFIER));
>   		break;
>   	default:
>   		break;
> 


  reply	other threads:[~2019-09-23 20:39 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20190922185418.2158-1-sashal@kernel.org>
2019-09-22 18:53 ` [PATCH AUTOSEL 4.19 075/128] PM / devfreq: passive: Use non-devm notifiers Sasha Levin
2019-09-23 20:38   ` Leonard Crestez [this message]
2019-10-01 16:12     ` Sasha Levin
2019-09-22 18:53 ` [PATCH AUTOSEL 4.19 076/128] PM / devfreq: exynos-bus: Correct clock enable sequence Sasha Levin

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=VI1PR04MB7023BD0451C047D6A59D986EEE850@VI1PR04MB7023.eurprd04.prod.outlook.com \
    --to=leonard.crestez@nxp.com \
    --cc=cw00.choi@samsung.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=myungjoo.ham@samsung.com \
    --cc=sashal@kernel.org \
    --cc=stable@vger.kernel.org \
    /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).