* [PATCH v2] base/platform: assert that dev_pm_domain callbacks are called unconditionally
@ 2015-08-06 8:31 Uwe Kleine-König
2015-08-06 8:32 ` Uwe Kleine-König
0 siblings, 1 reply; 3+ messages in thread
From: Uwe Kleine-König @ 2015-08-06 8:31 UTC (permalink / raw)
To: Greg Kroah-Hartman, Mark Brown
Cc: Uwe Kleine-König, linux-kernel, kernel, Rafael J. Wysocki,
Pavel Machek, Len Brown, linux-pm
From: Uwe Kleine-König <uwe@kleine-koenig.org>
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 <u.kleine-koenig@pengutronix.de>
---
Changes since (implicit) v1, sent with
Message-Id: 1437491315-2370-1-git-send-email-uwe@kleine-koenig.org:
- initialize ret in platform_drv_remove
- change my email to the right one
- adding some more people to Cc
Best regards
Uwe
drivers/base/platform.c | 19 +++++++++----------
1 file changed, 9 insertions(+), 10 deletions(-)
diff --git a/drivers/base/platform.c b/drivers/base/platform.c
index 063f0ab15259..58cea3ea00f8 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);
@@ -540,9 +540,10 @@ static int platform_drv_remove(struct device *_dev)
{
struct platform_driver *drv = to_platform_driver(_dev->driver);
struct platform_device *dev = to_platform_device(_dev);
- int ret;
+ int ret = 0;
- ret = drv->remove(dev);
+ if (drv->remove)
+ ret = drv->remove(dev);
dev_pm_domain_detach(_dev, true);
return ret;
@@ -553,7 +554,8 @@ static void platform_drv_shutdown(struct device *_dev)
struct platform_driver *drv = to_platform_driver(_dev->driver);
struct platform_device *dev = to_platform_device(_dev);
- drv->shutdown(dev);
+ if (drv->shutdown)
+ drv->shutdown(dev);
dev_pm_domain_detach(_dev, true);
}
@@ -567,12 +569,9 @@ int __platform_driver_register(struct platform_driver *drv,
{
drv->driver.owner = owner;
drv->driver.bus = &platform_bus_type;
- if (drv->probe)
- drv->driver.probe = platform_drv_probe;
- if (drv->remove)
- drv->driver.remove = platform_drv_remove;
- if (drv->shutdown)
- drv->driver.shutdown = platform_drv_shutdown;
+ drv->driver.probe = platform_drv_probe;
+ drv->driver.remove = platform_drv_remove;
+ drv->driver.shutdown = platform_drv_shutdown;
return driver_register(&drv->driver);
}
--
2.4.6
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH v2] base/platform: assert that dev_pm_domain callbacks are called unconditionally
2015-08-06 8:31 [PATCH v2] base/platform: assert that dev_pm_domain callbacks are called unconditionally Uwe Kleine-König
@ 2015-08-06 8:32 ` Uwe Kleine-König
2015-08-06 17:40 ` Greg Kroah-Hartman
0 siblings, 1 reply; 3+ messages in thread
From: Uwe Kleine-König @ 2015-08-06 8:32 UTC (permalink / raw)
To: Greg Kroah-Hartman, Mark Brown
Cc: Uwe Kleine-König, linux-kernel, kernel, Rafael J. Wysocki,
Pavel Machek, Len Brown, linux-pm
Hello,
On Thu, Aug 06, 2015 at 10:31:00AM +0200, Uwe Kleine-König wrote:
> From: Uwe Kleine-König <uwe@kleine-koenig.org>
grumpf, I forgot to fix the author, only adapted the s-o-b-line. Greg,
can you fix this on application?
Best regards
Uwe
--
Pengutronix e.K. | Uwe Kleine-König |
Industrial Linux Solutions | http://www.pengutronix.de/ |
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v2] base/platform: assert that dev_pm_domain callbacks are called unconditionally
2015-08-06 8:32 ` Uwe Kleine-König
@ 2015-08-06 17:40 ` Greg Kroah-Hartman
0 siblings, 0 replies; 3+ messages in thread
From: Greg Kroah-Hartman @ 2015-08-06 17:40 UTC (permalink / raw)
To: Uwe Kleine-König
Cc: Mark Brown, Uwe Kleine-König, linux-kernel, kernel,
Rafael J. Wysocki, Pavel Machek, Len Brown, linux-pm
On Thu, Aug 06, 2015 at 10:32:55AM +0200, Uwe Kleine-König wrote:
> Hello,
>
> On Thu, Aug 06, 2015 at 10:31:00AM +0200, Uwe Kleine-König wrote:
> > From: Uwe Kleine-König <uwe@kleine-koenig.org>
> grumpf, I forgot to fix the author, only adapted the s-o-b-line. Greg,
> can you fix this on application?
No, please resend.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2015-08-06 17:40 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-08-06 8:31 [PATCH v2] base/platform: assert that dev_pm_domain callbacks are called unconditionally Uwe Kleine-König
2015-08-06 8:32 ` Uwe Kleine-König
2015-08-06 17:40 ` Greg Kroah-Hartman
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox