All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ibmebus: Remove legacy suspend/resume support
@ 2016-11-19 13:42 Lars-Peter Clausen
  2016-11-21  9:52 ` Michael Ellerman
  2016-11-25  0:04 ` Michael Ellerman
  0 siblings, 2 replies; 5+ messages in thread
From: Lars-Peter Clausen @ 2016-11-19 13:42 UTC (permalink / raw)
  To: Michael Ellerman, Benjamin Herrenschmidt, Paul Mackerras
  Cc: linuxppc-dev, Lars-Peter Clausen

There are no ibmebus driver that make use of legacy suspend/resume. This
patch removes the support for it from ibmebus framework, new ibmebus driver
(as unlikely as they are) wanting to use suspend/resume should use
dev_pm_ops.

Since there aren't any special bus specific things to do during
suspend/resume and since the PM core will automatically fallback directly
to using the device's PM ops if no bus PM ops are specified there is no
need to have any special ibmebus PM ops at all.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
---
 arch/powerpc/kernel/ibmebus.c | 298 ------------------------------------------
 1 file changed, 298 deletions(-)

diff --git a/arch/powerpc/kernel/ibmebus.c b/arch/powerpc/kernel/ibmebus.c
index 35f5244..614c285 100644
--- a/arch/powerpc/kernel/ibmebus.c
+++ b/arch/powerpc/kernel/ibmebus.c
@@ -423,303 +423,6 @@ static struct device_attribute ibmebus_bus_device_attrs[] = {
 	__ATTR_NULL
 };
 
-#ifdef CONFIG_PM_SLEEP
-static int ibmebus_bus_legacy_suspend(struct device *dev, pm_message_t mesg)
-{
-	struct platform_device *of_dev = to_platform_device(dev);
-	struct platform_driver *drv = to_platform_driver(dev->driver);
-	int ret = 0;
-
-	if (dev->driver && drv->suspend)
-		ret = drv->suspend(of_dev, mesg);
-	return ret;
-}
-
-static int ibmebus_bus_legacy_resume(struct device *dev)
-{
-	struct platform_device *of_dev = to_platform_device(dev);
-	struct platform_driver *drv = to_platform_driver(dev->driver);
-	int ret = 0;
-
-	if (dev->driver && drv->resume)
-		ret = drv->resume(of_dev);
-	return ret;
-}
-
-static int ibmebus_bus_pm_prepare(struct device *dev)
-{
-	struct device_driver *drv = dev->driver;
-	int ret = 0;
-
-	if (drv && drv->pm && drv->pm->prepare)
-		ret = drv->pm->prepare(dev);
-
-	return ret;
-}
-
-static void ibmebus_bus_pm_complete(struct device *dev)
-{
-	struct device_driver *drv = dev->driver;
-
-	if (drv && drv->pm && drv->pm->complete)
-		drv->pm->complete(dev);
-}
-
-#ifdef CONFIG_SUSPEND
-
-static int ibmebus_bus_pm_suspend(struct device *dev)
-{
-	struct device_driver *drv = dev->driver;
-	int ret = 0;
-
-	if (!drv)
-		return 0;
-
-	if (drv->pm) {
-		if (drv->pm->suspend)
-			ret = drv->pm->suspend(dev);
-	} else {
-		ret = ibmebus_bus_legacy_suspend(dev, PMSG_SUSPEND);
-	}
-
-	return ret;
-}
-
-static int ibmebus_bus_pm_suspend_noirq(struct device *dev)
-{
-	struct device_driver *drv = dev->driver;
-	int ret = 0;
-
-	if (!drv)
-		return 0;
-
-	if (drv->pm) {
-		if (drv->pm->suspend_noirq)
-			ret = drv->pm->suspend_noirq(dev);
-	}
-
-	return ret;
-}
-
-static int ibmebus_bus_pm_resume(struct device *dev)
-{
-	struct device_driver *drv = dev->driver;
-	int ret = 0;
-
-	if (!drv)
-		return 0;
-
-	if (drv->pm) {
-		if (drv->pm->resume)
-			ret = drv->pm->resume(dev);
-	} else {
-		ret = ibmebus_bus_legacy_resume(dev);
-	}
-
-	return ret;
-}
-
-static int ibmebus_bus_pm_resume_noirq(struct device *dev)
-{
-	struct device_driver *drv = dev->driver;
-	int ret = 0;
-
-	if (!drv)
-		return 0;
-
-	if (drv->pm) {
-		if (drv->pm->resume_noirq)
-			ret = drv->pm->resume_noirq(dev);
-	}
-
-	return ret;
-}
-
-#else /* !CONFIG_SUSPEND */
-
-#define ibmebus_bus_pm_suspend		NULL
-#define ibmebus_bus_pm_resume		NULL
-#define ibmebus_bus_pm_suspend_noirq	NULL
-#define ibmebus_bus_pm_resume_noirq	NULL
-
-#endif /* !CONFIG_SUSPEND */
-
-#ifdef CONFIG_HIBERNATE_CALLBACKS
-
-static int ibmebus_bus_pm_freeze(struct device *dev)
-{
-	struct device_driver *drv = dev->driver;
-	int ret = 0;
-
-	if (!drv)
-		return 0;
-
-	if (drv->pm) {
-		if (drv->pm->freeze)
-			ret = drv->pm->freeze(dev);
-	} else {
-		ret = ibmebus_bus_legacy_suspend(dev, PMSG_FREEZE);
-	}
-
-	return ret;
-}
-
-static int ibmebus_bus_pm_freeze_noirq(struct device *dev)
-{
-	struct device_driver *drv = dev->driver;
-	int ret = 0;
-
-	if (!drv)
-		return 0;
-
-	if (drv->pm) {
-		if (drv->pm->freeze_noirq)
-			ret = drv->pm->freeze_noirq(dev);
-	}
-
-	return ret;
-}
-
-static int ibmebus_bus_pm_thaw(struct device *dev)
-{
-	struct device_driver *drv = dev->driver;
-	int ret = 0;
-
-	if (!drv)
-		return 0;
-
-	if (drv->pm) {
-		if (drv->pm->thaw)
-			ret = drv->pm->thaw(dev);
-	} else {
-		ret = ibmebus_bus_legacy_resume(dev);
-	}
-
-	return ret;
-}
-
-static int ibmebus_bus_pm_thaw_noirq(struct device *dev)
-{
-	struct device_driver *drv = dev->driver;
-	int ret = 0;
-
-	if (!drv)
-		return 0;
-
-	if (drv->pm) {
-		if (drv->pm->thaw_noirq)
-			ret = drv->pm->thaw_noirq(dev);
-	}
-
-	return ret;
-}
-
-static int ibmebus_bus_pm_poweroff(struct device *dev)
-{
-	struct device_driver *drv = dev->driver;
-	int ret = 0;
-
-	if (!drv)
-		return 0;
-
-	if (drv->pm) {
-		if (drv->pm->poweroff)
-			ret = drv->pm->poweroff(dev);
-	} else {
-		ret = ibmebus_bus_legacy_suspend(dev, PMSG_HIBERNATE);
-	}
-
-	return ret;
-}
-
-static int ibmebus_bus_pm_poweroff_noirq(struct device *dev)
-{
-	struct device_driver *drv = dev->driver;
-	int ret = 0;
-
-	if (!drv)
-		return 0;
-
-	if (drv->pm) {
-		if (drv->pm->poweroff_noirq)
-			ret = drv->pm->poweroff_noirq(dev);
-	}
-
-	return ret;
-}
-
-static int ibmebus_bus_pm_restore(struct device *dev)
-{
-	struct device_driver *drv = dev->driver;
-	int ret = 0;
-
-	if (!drv)
-		return 0;
-
-	if (drv->pm) {
-		if (drv->pm->restore)
-			ret = drv->pm->restore(dev);
-	} else {
-		ret = ibmebus_bus_legacy_resume(dev);
-	}
-
-	return ret;
-}
-
-static int ibmebus_bus_pm_restore_noirq(struct device *dev)
-{
-	struct device_driver *drv = dev->driver;
-	int ret = 0;
-
-	if (!drv)
-		return 0;
-
-	if (drv->pm) {
-		if (drv->pm->restore_noirq)
-			ret = drv->pm->restore_noirq(dev);
-	}
-
-	return ret;
-}
-
-#else /* !CONFIG_HIBERNATE_CALLBACKS */
-
-#define ibmebus_bus_pm_freeze		NULL
-#define ibmebus_bus_pm_thaw		NULL
-#define ibmebus_bus_pm_poweroff		NULL
-#define ibmebus_bus_pm_restore		NULL
-#define ibmebus_bus_pm_freeze_noirq	NULL
-#define ibmebus_bus_pm_thaw_noirq		NULL
-#define ibmebus_bus_pm_poweroff_noirq	NULL
-#define ibmebus_bus_pm_restore_noirq	NULL
-
-#endif /* !CONFIG_HIBERNATE_CALLBACKS */
-
-static struct dev_pm_ops ibmebus_bus_dev_pm_ops = {
-	.prepare = ibmebus_bus_pm_prepare,
-	.complete = ibmebus_bus_pm_complete,
-	.suspend = ibmebus_bus_pm_suspend,
-	.resume = ibmebus_bus_pm_resume,
-	.freeze = ibmebus_bus_pm_freeze,
-	.thaw = ibmebus_bus_pm_thaw,
-	.poweroff = ibmebus_bus_pm_poweroff,
-	.restore = ibmebus_bus_pm_restore,
-	.suspend_noirq = ibmebus_bus_pm_suspend_noirq,
-	.resume_noirq = ibmebus_bus_pm_resume_noirq,
-	.freeze_noirq = ibmebus_bus_pm_freeze_noirq,
-	.thaw_noirq = ibmebus_bus_pm_thaw_noirq,
-	.poweroff_noirq = ibmebus_bus_pm_poweroff_noirq,
-	.restore_noirq = ibmebus_bus_pm_restore_noirq,
-};
-
-#define IBMEBUS_BUS_PM_OPS_PTR	(&ibmebus_bus_dev_pm_ops)
-
-#else /* !CONFIG_PM_SLEEP */
-
-#define IBMEBUS_BUS_PM_OPS_PTR	NULL
-
-#endif /* !CONFIG_PM_SLEEP */
-
 struct bus_type ibmebus_bus_type = {
 	.name      = "ibmebus",
 	.uevent    = of_device_uevent_modalias,
@@ -729,7 +432,6 @@ struct bus_type ibmebus_bus_type = {
 	.remove    = ibmebus_bus_device_remove,
 	.shutdown  = ibmebus_bus_device_shutdown,
 	.dev_attrs = ibmebus_bus_device_attrs,
-	.pm        = IBMEBUS_BUS_PM_OPS_PTR,
 };
 EXPORT_SYMBOL(ibmebus_bus_type);
 
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] ibmebus: Remove legacy suspend/resume support
  2016-11-19 13:42 [PATCH] ibmebus: Remove legacy suspend/resume support Lars-Peter Clausen
@ 2016-11-21  9:52 ` Michael Ellerman
  2016-11-21 10:09   ` Lars-Peter Clausen
  2016-11-25  0:04 ` Michael Ellerman
  1 sibling, 1 reply; 5+ messages in thread
From: Michael Ellerman @ 2016-11-21  9:52 UTC (permalink / raw)
  To: Lars-Peter Clausen, Benjamin Herrenschmidt, Paul Mackerras
  Cc: linuxppc-dev, Lars-Peter Clausen

Lars-Peter Clausen <lars@metafoo.de> writes:

> There are no ibmebus driver that make use of legacy suspend/resume. This
> patch removes the support for it from ibmebus framework, new ibmebus driver
> (as unlikely as they are) wanting to use suspend/resume should use
> dev_pm_ops.
>
> Since there aren't any special bus specific things to do during
> suspend/resume and since the PM core will automatically fallback directly
> to using the device's PM ops if no bus PM ops are specified there is no
> need to have any special ibmebus PM ops at all.

Thanks, this looks like a really nice cleanup.

I don't know the PM code at all, is there any down side to removing all
of this?

cheers

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] ibmebus: Remove legacy suspend/resume support
  2016-11-21  9:52 ` Michael Ellerman
@ 2016-11-21 10:09   ` Lars-Peter Clausen
  2016-11-21 10:16     ` Michael Ellerman
  0 siblings, 1 reply; 5+ messages in thread
From: Lars-Peter Clausen @ 2016-11-21 10:09 UTC (permalink / raw)
  To: Michael Ellerman, Benjamin Herrenschmidt, Paul Mackerras; +Cc: linuxppc-dev

On 11/21/2016 10:52 AM, Michael Ellerman wrote:
> Lars-Peter Clausen <lars@metafoo.de> writes:
> 
>> There are no ibmebus driver that make use of legacy suspend/resume. This
>> patch removes the support for it from ibmebus framework, new ibmebus driver
>> (as unlikely as they are) wanting to use suspend/resume should use
>> dev_pm_ops.
>>
>> Since there aren't any special bus specific things to do during
>> suspend/resume and since the PM core will automatically fallback directly
>> to using the device's PM ops if no bus PM ops are specified there is no
>> need to have any special ibmebus PM ops at all.
> 
> Thanks, this looks like a really nice cleanup.
> 
> I don't know the PM code at all, is there any down side to removing all
> of this?

No, dev_pm_op is a full replacement for the legacy suspend/resume callbacks
and dev_pm_ops are supported by the power management core out of the box
without having to have any bus specific code. Which is why we want to get
rid of legacy PM callbacks in general and this is one of the last few buses
that still implements it. But since there are no drivers that use it
removing it is straight forward in this case, for others it takes a bit more
work.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] ibmebus: Remove legacy suspend/resume support
  2016-11-21 10:09   ` Lars-Peter Clausen
@ 2016-11-21 10:16     ` Michael Ellerman
  0 siblings, 0 replies; 5+ messages in thread
From: Michael Ellerman @ 2016-11-21 10:16 UTC (permalink / raw)
  To: Lars-Peter Clausen, Benjamin Herrenschmidt, Paul Mackerras; +Cc: linuxppc-dev

Lars-Peter Clausen <lars@metafoo.de> writes:

> On 11/21/2016 10:52 AM, Michael Ellerman wrote:
>> Lars-Peter Clausen <lars@metafoo.de> writes:
>> 
>>> There are no ibmebus driver that make use of legacy suspend/resume. This
>>> patch removes the support for it from ibmebus framework, new ibmebus driver
>>> (as unlikely as they are) wanting to use suspend/resume should use
>>> dev_pm_ops.
>>>
>>> Since there aren't any special bus specific things to do during
>>> suspend/resume and since the PM core will automatically fallback directly
>>> to using the device's PM ops if no bus PM ops are specified there is no
>>> need to have any special ibmebus PM ops at all.
>> 
>> Thanks, this looks like a really nice cleanup.
>> 
>> I don't know the PM code at all, is there any down side to removing all
>> of this?
>
> No, dev_pm_op is a full replacement for the legacy suspend/resume callbacks
> and dev_pm_ops are supported by the power management core out of the box
> without having to have any bus specific code. Which is why we want to get
> rid of legacy PM callbacks in general and this is one of the last few buses
> that still implements it. But since there are no drivers that use it
> removing it is straight forward in this case, for others it takes a bit more
> work.

Great, thanks. I'll merge this via the powerpc tree for 4.10.

cheers

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: ibmebus: Remove legacy suspend/resume support
  2016-11-19 13:42 [PATCH] ibmebus: Remove legacy suspend/resume support Lars-Peter Clausen
  2016-11-21  9:52 ` Michael Ellerman
@ 2016-11-25  0:04 ` Michael Ellerman
  1 sibling, 0 replies; 5+ messages in thread
From: Michael Ellerman @ 2016-11-25  0:04 UTC (permalink / raw)
  To: Lars-Peter Clausen, Benjamin Herrenschmidt, Paul Mackerras
  Cc: Lars-Peter Clausen, linuxppc-dev

On Sat, 2016-11-19 at 13:42:14 UTC, Lars-Peter Clausen wrote:
> There are no ibmebus driver that make use of legacy suspend/resume. This
> patch removes the support for it from ibmebus framework, new ibmebus driver
> (as unlikely as they are) wanting to use suspend/resume should use
> dev_pm_ops.
> 
> Since there aren't any special bus specific things to do during
> suspend/resume and since the PM core will automatically fallback directly
> to using the device's PM ops if no bus PM ops are specified there is no
> need to have any special ibmebus PM ops at all.
> 
> Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>

Applied to powerpc next, thanks.

https://git.kernel.org/powerpc/c/8004ca995c24a078ae362f6dd9f8e1

cheers

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2016-11-25  0:04 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-11-19 13:42 [PATCH] ibmebus: Remove legacy suspend/resume support Lars-Peter Clausen
2016-11-21  9:52 ` Michael Ellerman
2016-11-21 10:09   ` Lars-Peter Clausen
2016-11-21 10:16     ` Michael Ellerman
2016-11-25  0:04 ` Michael Ellerman

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.