linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: "Uwe Kleine-König" <uwe@kleine-koenig.org>
Cc: Mark Brown <broonie@kernel.org>,
	linux-kernel@vger.kernel.org, kernel@pengutronix.de
Subject: Re: [PATCH] base/platform: assert that dev_pm_domain callbacks are called unconditionally
Date: Wed, 5 Aug 2015 17:06:45 -0700	[thread overview]
Message-ID: <20150806000645.GA2316@kroah.com> (raw)
In-Reply-To: <1437491315-2370-1-git-send-email-uwe@kleine-koenig.org>

On Tue, Jul 21, 2015 at 05:08:35PM +0200, Uwe Kleine-König wrote:
> When a platform driver doesn't provide a .remove callback the function
> platform_drv_remove isn't called and so the call to dev_pm_domain_attach
> called at probe time isn't paired by dev_pm_domain_detach at remove
> time.
> 
> To fix this (and similar issues if different callbacks are missing) hook
> up the driver callbacks unconditionally and make them aware that the
> platform callbacks might be missing.
> 
> Signed-off-by: Uwe Kleine-König <uwe@kleine-koenig.org>
> ---
> Hello,
> 
> I didn't see any breakage without this patch, but it looks wrong the way
> it is.
> 
> Best regards
> Uwe
> 
>  drivers/base/platform.c | 17 ++++++++---------
>  1 file changed, 8 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/base/platform.c b/drivers/base/platform.c
> index 063f0ab15259..62debf4a1348 100644
> --- a/drivers/base/platform.c
> +++ b/drivers/base/platform.c
> @@ -517,7 +517,7 @@ static int platform_drv_probe(struct device *_dev)
>  		return ret;
>  
>  	ret = dev_pm_domain_attach(_dev, true);
> -	if (ret != -EPROBE_DEFER) {
> +	if (ret != -EPROBE_DEFER && drv->probe) {
>  		ret = drv->probe(dev);
>  		if (ret)
>  			dev_pm_domain_detach(_dev, true);
> @@ -542,7 +542,8 @@ static int platform_drv_remove(struct device *_dev)
>  	struct platform_device *dev = to_platform_device(_dev);
>  	int ret;
>  
> -	ret = drv->remove(dev);
> +	if (drv->remove)
> +		ret = drv->remove(dev);
>  	dev_pm_domain_detach(_dev, true);

This causes a build warning :(

Please fix.

thanks,

greg k-h

  reply	other threads:[~2015-08-06  0:06 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-21  3:29 linux-next: build failure after merge of the gpio tree Stephen Rothwell
2015-07-21  6:59 ` [PATCH] regulator: rk808: make better use of the gpiod API Uwe Kleine-König
2015-07-21  9:56   ` Linus Walleij
2015-07-21 11:04     ` Mark Brown
2015-07-21 14:21       ` Uwe Kleine-König
2015-07-21 14:46         ` [PATCH 1/2] regulator: rk808: add #include for gpiod functions Uwe Kleine-König
2015-07-21 14:46           ` [PATCH v2 2/2] regulator: rk808: make better use of the gpiod API Uwe Kleine-König
2015-07-22  2:21             ` Krzysztof Kozlowski
2015-07-21 13:09   ` [PATCH] " Krzysztof Kozlowski
2015-07-21 14:35     ` Uwe Kleine-König
2015-07-21 14:41       ` Mark Brown
2015-07-21 15:08         ` [PATCH] base/platform: assert that dev_pm_domain callbacks are called unconditionally Uwe Kleine-König
2015-08-06  0:06           ` Greg Kroah-Hartman [this message]
2015-07-22  0:13         ` [PATCH] regulator: rk808: make better use of the gpiod API Krzysztof Kozlowski
2015-07-22  7:13           ` Uwe Kleine-König

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=20150806000645.GA2316@kroah.com \
    --to=gregkh@linuxfoundation.org \
    --cc=broonie@kernel.org \
    --cc=kernel@pengutronix.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=uwe@kleine-koenig.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).