linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFT][PATCH 00/12] change drivers power management to use dev_pm_ops
@ 2014-02-10 16:12 Shuah Khan
  2014-02-10 16:12 ` [RFT][PATCH 01/12] arm: change locomo platform and bus " Shuah Khan
                   ` (11 more replies)
  0 siblings, 12 replies; 15+ messages in thread
From: Shuah Khan @ 2014-02-10 16:12 UTC (permalink / raw)
  To: rjw
  Cc: Shuah Khan, linux-pm, linux-kernel, linux, linux-arm-kernel,
	benh, linuxppc-dev, manuel.lauss, chris, linux-mmc, sonic.zhang,
	adi-buildroot-devel, mirq-linux, davidb, dwalker, linux-arm-msm,
	ian, gregkh, linux-pcmcia, ingo.tuchscherer, linux390,
	schwidefsky, heiko.carstens, linux-s390, shuahkhan

Change drivers to register pm ops using dev_pm_ops instead of legacy pm_ops.
.pm hooks call existing legacy suspend and resume interfaces by passing in
the right pm state. Bus drivers suspend and resume routines call .pm driver
hooks if found.

Shuah Khan (12):
  arm: change locomo platform and bus power management to use
    dev_pm_ops
  arm: change sa1111 platform and bus power management to use
    dev_pm_ops
  arm: change scoop platform power management to use dev_pm_ops
  drivers/macintosh/adb: change platform power managemnet to use
    dev_pm_ops
  mmc: change au1xmmc platform power management to use dev_pm_ops
  mmc: change bfin_sdh platform power management to use dev_pm_ops
  isa: change isa bus power managemnet to use dev_pm_ops
  mmc: change cb710-mmc platform power management to use dev_pm_ops
  mmc: change msm_sdcc platform power management to use dev_pm_ops
  mmc: change tmio_mmc platform power management to use dev_pm_ops
  drivers/pcmcia: change ds driver power management to use dev_pm_ops
  drivers/s390/crypto: change ap_bus driver power management to use
    dev_pm_ops

 arch/arm/common/locomo.c     |   93 +++++++++++++++++++++++++++++++++++-------
 arch/arm/common/sa1111.c     |   88 +++++++++++++++++++++++++++++++--------
 arch/arm/common/scoop.c      |   44 ++++++++++++++++----
 drivers/base/isa.c           |   30 ++++++++++++--
 drivers/macintosh/adb.c      |   41 ++++++++++++++++---
 drivers/mmc/host/au1xmmc.c   |   43 +++++++++++++++----
 drivers/mmc/host/bfin_sdh.c  |   40 +++++++++++++++---
 drivers/mmc/host/cb710-mmc.c |   37 +++++++++++++++--
 drivers/mmc/host/msm_sdcc.c  |   42 +++++++++++++++----
 drivers/mmc/host/tmio_mmc.c  |   42 +++++++++++++++----
 drivers/pcmcia/ds.c          |   36 +++++++++++++---
 drivers/s390/crypto/ap_bus.c |   30 ++++++++++++--
 12 files changed, 481 insertions(+), 85 deletions(-)

-- 
1.7.10.4


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

* [RFT][PATCH 01/12] arm: change locomo platform and bus power management to use dev_pm_ops
  2014-02-10 16:12 [RFT][PATCH 00/12] change drivers power management to use dev_pm_ops Shuah Khan
@ 2014-02-10 16:12 ` Shuah Khan
  2014-02-10 16:12 ` [RFT][PATCH 02/12] arm: change sa1111 " Shuah Khan
                   ` (10 subsequent siblings)
  11 siblings, 0 replies; 15+ messages in thread
From: Shuah Khan @ 2014-02-10 16:12 UTC (permalink / raw)
  To: rjw, linux
  Cc: Shuah Khan, linux-pm, linux-kernel, linux-arm-kernel, shuahkhan

Change locomo platform and bus drivers to register pm ops using dev_pm_ops
instead of legacy pm_ops. .pm hooks call existing legacy suspend and resume
interfaces by passing in the right pm state.

Signed-off-by: Shuah Khan <shuah.kh@samsung.com>
---
 arch/arm/common/locomo.c |   93 ++++++++++++++++++++++++++++++++++++++--------
 1 file changed, 78 insertions(+), 15 deletions(-)

diff --git a/arch/arm/common/locomo.c b/arch/arm/common/locomo.c
index b55c362..a48effb 100644
--- a/arch/arm/common/locomo.c
+++ b/arch/arm/common/locomo.c
@@ -272,7 +272,7 @@ struct locomo_save_data {
 	u16	LCM_SPIMD;
 };
 
-static int locomo_suspend(struct platform_device *dev, pm_message_t state)
+static int __locomo_suspend(struct platform_device *dev, pm_message_t state)
 {
 	struct locomo *lchip = platform_get_drvdata(dev);
 	struct locomo_save_data *save;
@@ -316,7 +316,22 @@ static int locomo_suspend(struct platform_device *dev, pm_message_t state)
 	return 0;
 }
 
-static int locomo_resume(struct platform_device *dev)
+static int locomo_suspend(struct device *dev)
+{
+	 return __locomo_suspend(to_platform_device(dev), PMSG_SUSPEND);
+}
+
+static int locomo_freeze(struct device *dev)
+{
+	 return __locomo_suspend(to_platform_device(dev), PMSG_FREEZE);
+}
+
+static int locomo_poweroff(struct device *dev)
+{
+	 return __locomo_suspend(to_platform_device(dev), PMSG_HIBERNATE);
+}
+
+static int __locomo_resume(struct platform_device *dev)
 {
 	struct locomo *lchip = platform_get_drvdata(dev);
 	struct locomo_save_data *save;
@@ -351,6 +366,11 @@ static int locomo_resume(struct platform_device *dev)
 
 	return 0;
 }
+
+static int locomo_resume(struct device *dev)
+{
+	 return __locomo_resume(to_platform_device(dev));
+}
 #endif
 
 
@@ -510,6 +530,18 @@ static int locomo_remove(struct platform_device *dev)
 	return 0;
 }
 
+#ifdef CONFIG_PM
+static const struct dev_pm_ops locomo_dev_pm_ops = {
+	.suspend = locomo_suspend,
+	.resume = locomo_resume,
+	/* Hibernate hooks */
+	.freeze = locomo_freeze,
+	.thaw = locomo_resume,
+	.poweroff = locomo_poweroff,
+	.restore = locomo_resume,
+};
+#endif
+
 /*
  *	Not sure if this should be on the system bus or not yet.
  *	We really want some way to register a system device at
@@ -519,12 +551,11 @@ static int locomo_remove(struct platform_device *dev)
 static struct platform_driver locomo_device_driver = {
 	.probe		= locomo_probe,
 	.remove		= locomo_remove,
-#ifdef CONFIG_PM
-	.suspend	= locomo_suspend,
-	.resume		= locomo_resume,
-#endif
 	.driver		= {
 		.name	= "locomo",
+#ifdef CONFIG_PM
+		.pm	= &locomo_dev_pm_ops,
+#endif
 	},
 };
 
@@ -826,26 +857,45 @@ static int locomo_match(struct device *_dev, struct device_driver *_drv)
 	return dev->devid == drv->devid;
 }
 
-static int locomo_bus_suspend(struct device *dev, pm_message_t state)
+static int __locomo_bus_suspend(struct device *dev, pm_message_t state)
 {
 	struct locomo_dev *ldev = LOCOMO_DEV(dev);
 	struct locomo_driver *drv = LOCOMO_DRV(dev->driver);
-	int ret = 0;
+
+	if (drv && drv->drv.pm && drv->drv.pm->suspend)
+		return  drv->drv.pm->suspend(dev);
 
 	if (drv && drv->suspend)
-		ret = drv->suspend(ldev, state);
-	return ret;
+		return	drv->suspend(ldev, state);
+	return 0;
+}
+
+static int locomo_bus_suspend(struct device *dev)
+{
+	return	__locomo_bus_suspend(dev, PMSG_SUSPEND);
+}
+
+static int locomo_bus_freeze(struct device *dev)
+{
+	return	__locomo_bus_suspend(dev, PMSG_FREEZE);
+}
+
+static int locomo_bus_poweroff(struct device *dev)
+{
+	return	__locomo_bus_suspend(dev, PMSG_HIBERNATE);
 }
 
 static int locomo_bus_resume(struct device *dev)
 {
 	struct locomo_dev *ldev = LOCOMO_DEV(dev);
 	struct locomo_driver *drv = LOCOMO_DRV(dev->driver);
-	int ret = 0;
+
+	if (drv && drv->drv.pm && drv->drv.pm->resume)
+		return	drv->drv.pm->resume(dev);
 
 	if (drv && drv->resume)
-		ret = drv->resume(ldev);
-	return ret;
+		return	drv->resume(ldev);
+	return 0;
 }
 
 static int locomo_bus_probe(struct device *dev)
@@ -870,13 +920,26 @@ static int locomo_bus_remove(struct device *dev)
 	return ret;
 }
 
+#ifdef CONFIG_PM
+static const struct dev_pm_ops locomo_bus_dev_pm_ops = {
+	.suspend = locomo_bus_suspend,
+	.resume = locomo_bus_resume,
+	/* Hibernate hooks */
+	.freeze = locomo_bus_freeze,
+	.thaw = locomo_bus_resume,
+	.poweroff = locomo_bus_poweroff,
+	.restore = locomo_bus_resume,
+};
+#endif
+
 struct bus_type locomo_bus_type = {
 	.name		= "locomo-bus",
 	.match		= locomo_match,
 	.probe		= locomo_bus_probe,
 	.remove		= locomo_bus_remove,
-	.suspend	= locomo_bus_suspend,
-	.resume		= locomo_bus_resume,
+#ifdef CONFIG_PM
+	.pm		= &locomo_bus_dev_pm_ops,
+#endif
 };
 
 int locomo_driver_register(struct locomo_driver *driver)
-- 
1.7.10.4


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

* [RFT][PATCH 02/12] arm: change sa1111 platform and bus power management to use dev_pm_ops
  2014-02-10 16:12 [RFT][PATCH 00/12] change drivers power management to use dev_pm_ops Shuah Khan
  2014-02-10 16:12 ` [RFT][PATCH 01/12] arm: change locomo platform and bus " Shuah Khan
@ 2014-02-10 16:12 ` Shuah Khan
  2014-02-10 16:12 ` [RFT][PATCH 03/12] arm: change scoop platform " Shuah Khan
                   ` (9 subsequent siblings)
  11 siblings, 0 replies; 15+ messages in thread
From: Shuah Khan @ 2014-02-10 16:12 UTC (permalink / raw)
  To: rjw, linux
  Cc: Shuah Khan, linux-pm, linux-kernel, linux-arm-kernel, shuahkhan

Change sa1111 platform and bus drivers to register pm ops using dev_pm_ops
instead of legacy pm_ops. .pm hooks call existing legacy suspend and resume
interfaces by passing in the right pm state.

Signed-off-by: Shuah Khan <shuah.kh@samsung.com>
---
 arch/arm/common/sa1111.c |   88 +++++++++++++++++++++++++++++++++++++---------
 1 file changed, 72 insertions(+), 16 deletions(-)

diff --git a/arch/arm/common/sa1111.c b/arch/arm/common/sa1111.c
index e57d7e5..db017b2 100644
--- a/arch/arm/common/sa1111.c
+++ b/arch/arm/common/sa1111.c
@@ -872,7 +872,7 @@ struct sa1111_save_data {
 
 #ifdef CONFIG_PM
 
-static int sa1111_suspend(struct platform_device *dev, pm_message_t state)
+static int __sa1111_suspend(struct platform_device *dev, pm_message_t state)
 {
 	struct sa1111 *sachip = platform_get_drvdata(dev);
 	struct sa1111_save_data *save;
@@ -928,6 +928,21 @@ static int sa1111_suspend(struct platform_device *dev, pm_message_t state)
 	return 0;
 }
 
+static int sa1111_suspend(struct device *dev)
+{
+	return __sa1111_suspend(to_platform_device(dev), PMSG_SUSPEND);
+}
+
+static int sa1111_freeze(struct device *dev)
+{
+	return __sa1111_suspend(to_platform_device(dev), PMSG_FREEZE);
+}
+
+static int sa1111_poweroff(struct device *dev)
+{
+	return __sa1111_suspend(to_platform_device(dev), PMSG_HIBERNATE);
+}
+
 /*
  *	sa1111_resume - Restore the SA1111 device state.
  *	@dev: device to restore
@@ -937,7 +952,7 @@ static int sa1111_suspend(struct platform_device *dev, pm_message_t state)
  *	restored by their respective drivers, and must be called
  *	via LDM after this function.
  */
-static int sa1111_resume(struct platform_device *dev)
+static int __sa1111_resume(struct platform_device *dev)
 {
 	struct sa1111 *sachip = platform_get_drvdata(dev);
 	struct sa1111_save_data *save;
@@ -1005,9 +1020,10 @@ static int sa1111_resume(struct platform_device *dev)
 	return 0;
 }
 
-#else
-#define sa1111_suspend NULL
-#define sa1111_resume  NULL
+static int sa1111_resume(struct device *dev)
+{
+	return __sa1111_resume(to_platform_device(dev));
+}
 #endif
 
 static int sa1111_probe(struct platform_device *pdev)
@@ -1041,6 +1057,18 @@ static int sa1111_remove(struct platform_device *pdev)
 	return 0;
 }
 
+#ifdef CONFIG_PM
+static const struct dev_pm_ops sa1111_dev_pm_ops = {
+	.suspend = sa1111_suspend,
+	.resume = sa1111_resume,
+	/* Hibernate hooks */
+	.freeze = sa1111_freeze,
+	.thaw = sa1111_resume,
+	.poweroff = sa1111_poweroff,
+	.restore = sa1111_resume,
+};
+#endif
+
 /*
  *	Not sure if this should be on the system bus or not yet.
  *	We really want some way to register a system device at
@@ -1053,11 +1081,12 @@ static int sa1111_remove(struct platform_device *pdev)
 static struct platform_driver sa1111_device_driver = {
 	.probe		= sa1111_probe,
 	.remove		= sa1111_remove,
-	.suspend	= sa1111_suspend,
-	.resume		= sa1111_resume,
 	.driver		= {
 		.name	= "sa1111",
 		.owner	= THIS_MODULE,
+#ifdef CONFIG_PM
+		.pm	= &sa1111_dev_pm_ops,
+#endif
 	},
 };
 
@@ -1297,26 +1326,44 @@ static int sa1111_match(struct device *_dev, struct device_driver *_drv)
 	return dev->devid & drv->devid;
 }
 
-static int sa1111_bus_suspend(struct device *dev, pm_message_t state)
+static int __sa1111_bus_suspend(struct device *dev, pm_message_t state)
 {
 	struct sa1111_dev *sadev = SA1111_DEV(dev);
 	struct sa1111_driver *drv = SA1111_DRV(dev->driver);
-	int ret = 0;
+
+	if (drv && drv->drv.pm && drv->drv.pm->suspend)
+		return  drv->drv.pm->suspend(dev);
 
 	if (drv && drv->suspend)
-		ret = drv->suspend(sadev, state);
-	return ret;
+		return drv->suspend(sadev, state);
+	return 0;
+}
+
+static int sa1111_bus_suspend(struct device *dev)
+{
+	return __sa1111_bus_suspend(dev, PMSG_SUSPEND);
+}
+
+static int sa1111_bus_freeze(struct device *dev)
+{
+	return __sa1111_bus_suspend(dev, PMSG_FREEZE);
+}
+
+static int sa1111_bus_poweroff(struct device *dev)
+{
+	return __sa1111_bus_suspend(dev, PMSG_HIBERNATE);
 }
 
 static int sa1111_bus_resume(struct device *dev)
 {
 	struct sa1111_dev *sadev = SA1111_DEV(dev);
 	struct sa1111_driver *drv = SA1111_DRV(dev->driver);
-	int ret = 0;
 
+	if (drv && drv->drv.pm && drv->drv.pm->resume)
+		return  drv->drv.pm->resume(dev);
 	if (drv && drv->resume)
-		ret = drv->resume(sadev);
-	return ret;
+		return drv->resume(sadev);
+	return 0;
 }
 
 static void sa1111_bus_shutdown(struct device *dev)
@@ -1349,14 +1396,23 @@ static int sa1111_bus_remove(struct device *dev)
 	return ret;
 }
 
+static const struct dev_pm_ops sa1111_bus_dev_pm_ops = {
+	.suspend = sa1111_bus_suspend,
+	.resume = sa1111_bus_resume,
+	/* Hibernate hooks */
+	.freeze = sa1111_bus_freeze,
+	.thaw = sa1111_bus_resume,
+	.poweroff = sa1111_bus_poweroff,
+	.restore = sa1111_bus_resume,
+};
+
 struct bus_type sa1111_bus_type = {
 	.name		= "sa1111-rab",
 	.match		= sa1111_match,
 	.probe		= sa1111_bus_probe,
 	.remove		= sa1111_bus_remove,
-	.suspend	= sa1111_bus_suspend,
-	.resume		= sa1111_bus_resume,
 	.shutdown	= sa1111_bus_shutdown,
+	.pm		= &sa1111_bus_dev_pm_ops,
 };
 EXPORT_SYMBOL(sa1111_bus_type);
 
-- 
1.7.10.4


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

* [RFT][PATCH 03/12] arm: change scoop platform power management to use dev_pm_ops
  2014-02-10 16:12 [RFT][PATCH 00/12] change drivers power management to use dev_pm_ops Shuah Khan
  2014-02-10 16:12 ` [RFT][PATCH 01/12] arm: change locomo platform and bus " Shuah Khan
  2014-02-10 16:12 ` [RFT][PATCH 02/12] arm: change sa1111 " Shuah Khan
@ 2014-02-10 16:12 ` Shuah Khan
  2014-02-10 16:12 ` [RFT][PATCH 04/12] drivers/macintosh/adb: change " Shuah Khan
                   ` (8 subsequent siblings)
  11 siblings, 0 replies; 15+ messages in thread
From: Shuah Khan @ 2014-02-10 16:12 UTC (permalink / raw)
  To: rjw, linux
  Cc: Shuah Khan, linux-pm, linux-kernel, linux-arm-kernel, shuahkhan

Change scoop platform driver to register pm ops using dev_pm_ops instead of
legacy pm_ops. .pm hooks call existing legacy suspend and resume interfaces
by passing in the right pm state.

Signed-off-by: Shuah Khan <shuah.kh@samsung.com>
---
 arch/arm/common/scoop.c |   44 +++++++++++++++++++++++++++++++++++++-------
 1 file changed, 37 insertions(+), 7 deletions(-)

diff --git a/arch/arm/common/scoop.c b/arch/arm/common/scoop.c
index a5c3dc3..260a60b 100644
--- a/arch/arm/common/scoop.c
+++ b/arch/arm/common/scoop.c
@@ -151,7 +151,7 @@ static void check_scoop_reg(struct scoop_dev *sdev)
 		iowrite16(0x0101, sdev->base + SCOOP_MCR);
 }
 
-static int scoop_suspend(struct platform_device *dev, pm_message_t state)
+static int __scoop_suspend(struct platform_device *dev, pm_message_t state)
 {
 	struct scoop_dev *sdev = platform_get_drvdata(dev);
 
@@ -162,7 +162,22 @@ static int scoop_suspend(struct platform_device *dev, pm_message_t state)
 	return 0;
 }
 
-static int scoop_resume(struct platform_device *dev)
+static int scoop_suspend(struct device *dev)
+{
+	return __scoop_suspend(to_platform_device(dev), PMSG_SUSPEND);
+}
+
+static int scoop_freeze(struct device *dev)
+{
+	return __scoop_suspend(to_platform_device(dev), PMSG_FREEZE);
+}
+
+static int scoop_poweroff(struct device *dev)
+{
+	return __scoop_suspend(to_platform_device(dev), PMSG_HIBERNATE);
+}
+
+static int __scoop_resume(struct platform_device *dev)
 {
 	struct scoop_dev *sdev = platform_get_drvdata(dev);
 
@@ -171,9 +186,11 @@ static int scoop_resume(struct platform_device *dev)
 
 	return 0;
 }
-#else
-#define scoop_suspend	NULL
-#define scoop_resume	NULL
+
+static int scoop_resume(struct device *dev)
+{
+	return __scoop_resume(to_platform_device(dev));
+}
 #endif
 
 static int scoop_probe(struct platform_device *pdev)
@@ -266,13 +283,26 @@ static int scoop_remove(struct platform_device *pdev)
 	return 0;
 }
 
+#ifdef CONFIG_PM
+static const struct dev_pm_ops scoop_dev_pm_ops = {
+	.suspend = scoop_suspend,
+	.resume = scoop_resume,
+	/* Hibernate hooks */
+	.freeze = scoop_freeze,
+	.thaw = scoop_resume,
+	.poweroff = scoop_poweroff,
+	.restore = scoop_resume,
+};
+#endif
+
 static struct platform_driver scoop_driver = {
 	.probe		= scoop_probe,
 	.remove		= scoop_remove,
-	.suspend	= scoop_suspend,
-	.resume		= scoop_resume,
 	.driver		= {
 		.name	= "sharp-scoop",
+#ifdef CONFIG_PM
+		.pm	= &scoop_dev_pm_ops,
+#endif
 	},
 };
 
-- 
1.7.10.4


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

* [RFT][PATCH 04/12] drivers/macintosh/adb: change platform power management to use dev_pm_ops
  2014-02-10 16:12 [RFT][PATCH 00/12] change drivers power management to use dev_pm_ops Shuah Khan
                   ` (2 preceding siblings ...)
  2014-02-10 16:12 ` [RFT][PATCH 03/12] arm: change scoop platform " Shuah Khan
@ 2014-02-10 16:12 ` Shuah Khan
  2014-02-10 16:12 ` [RFT][PATCH 05/12] mmc: change au1xmmc " Shuah Khan
                   ` (7 subsequent siblings)
  11 siblings, 0 replies; 15+ messages in thread
From: Shuah Khan @ 2014-02-10 16:12 UTC (permalink / raw)
  To: rjw, benh; +Cc: Shuah Khan, linux-pm, linux-kernel, linuxppc-dev, shuahkhan

Change adb platform driver to register pm ops using dev_pm_ops instead of
legacy pm_ops. .pm hooks call existing legacy suspend and resume interfaces
by passing in the right pm state.

Signed-off-by: Shuah Khan <shuah.kh@samsung.com>
---
 drivers/macintosh/adb.c |   41 ++++++++++++++++++++++++++++++++++++-----
 1 file changed, 36 insertions(+), 5 deletions(-)

diff --git a/drivers/macintosh/adb.c b/drivers/macintosh/adb.c
index 04a5049..df6b201 100644
--- a/drivers/macintosh/adb.c
+++ b/drivers/macintosh/adb.c
@@ -263,7 +263,7 @@ adb_reset_bus(void)
 /*
  * notify clients before sleep
  */
-static int adb_suspend(struct platform_device *dev, pm_message_t state)
+static int __adb_suspend(struct platform_device *dev, pm_message_t state)
 {
 	adb_got_sleep = 1;
 	/* We need to get a lock on the probe thread */
@@ -276,10 +276,25 @@ static int adb_suspend(struct platform_device *dev, pm_message_t state)
 	return 0;
 }
 
+static int adb_suspend(struct device *dev)
+{
+	return __adb_suspend(to_platform_device(dev), PMSG_SUSPEND);
+}
+
+static int adb_freeze(struct device *dev)
+{
+	return __adb_suspend(to_platform_device(dev), PMSG_FREEZE);
+}
+
+static int adb_poweroff(struct device *dev)
+{
+	return __adb_suspend(to_platform_device(dev), PMSG_HIBERNATE);
+}
+
 /*
  * reset bus after sleep
  */
-static int adb_resume(struct platform_device *dev)
+static int __adb_resume(struct platform_device *dev)
 {
 	adb_got_sleep = 0;
 	up(&adb_probe_mutex);
@@ -287,6 +302,11 @@ static int adb_resume(struct platform_device *dev)
 
 	return 0;
 }
+
+static int adb_resume(struct device *dev)
+{
+	return __adb_resume(to_platform_device(dev));
+}
 #endif /* CONFIG_PM */
 
 static int __init adb_init(void)
@@ -831,14 +851,25 @@ static const struct file_operations adb_fops = {
 	.release	= adb_release,
 };
 
+#ifdef CONFIG_PM
+static const struct dev_pm_ops adb_dev_pm_ops = {
+	.suspend = adb_suspend,
+	.resume = adb_resume,
+	/* Hibernate hooks */
+	.freeze = adb_freeze,
+	.thaw = adb_resume,
+	.poweroff = adb_poweroff,
+	.restore = adb_resume,
+};
+#endif
+
 static struct platform_driver adb_pfdrv = {
 	.driver = {
 		.name = "adb",
-	},
 #ifdef CONFIG_PM
-	.suspend = adb_suspend,
-	.resume = adb_resume,
+		.pm = &adb_dev_pm_ops,
 #endif
+	},
 };
 
 static struct platform_device adb_pfdev = {
-- 
1.7.10.4


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

* [RFT][PATCH 05/12] mmc: change au1xmmc platform power management to use dev_pm_ops
  2014-02-10 16:12 [RFT][PATCH 00/12] change drivers power management to use dev_pm_ops Shuah Khan
                   ` (3 preceding siblings ...)
  2014-02-10 16:12 ` [RFT][PATCH 04/12] drivers/macintosh/adb: change " Shuah Khan
@ 2014-02-10 16:12 ` Shuah Khan
  2014-02-10 16:12 ` [RFT][PATCH 06/12] mmc: change bfin_sdh " Shuah Khan
                   ` (6 subsequent siblings)
  11 siblings, 0 replies; 15+ messages in thread
From: Shuah Khan @ 2014-02-10 16:12 UTC (permalink / raw)
  To: rjw, manuel.lauss, chris
  Cc: Shuah Khan, linux-pm, linux-kernel, linux-mmc, shuahkhan

Change au1xmmc platform driver to register pm ops using dev_pm_ops instead of
legacy pm_ops. .pm hooks call existing legacy suspend and resume interfaces
by passing in the right pm state.

Signed-off-by: Shuah Khan <shuah.kh@samsung.com>
---
 drivers/mmc/host/au1xmmc.c |   43 +++++++++++++++++++++++++++++++++++--------
 1 file changed, 35 insertions(+), 8 deletions(-)

diff --git a/drivers/mmc/host/au1xmmc.c b/drivers/mmc/host/au1xmmc.c
index f5443a6..1601f39 100644
--- a/drivers/mmc/host/au1xmmc.c
+++ b/drivers/mmc/host/au1xmmc.c
@@ -1154,7 +1154,7 @@ static int au1xmmc_remove(struct platform_device *pdev)
 }
 
 #ifdef CONFIG_PM
-static int au1xmmc_suspend(struct platform_device *pdev, pm_message_t state)
+static int __au1xmmc_suspend(struct platform_device *pdev, pm_message_t state)
 {
 	struct au1xmmc_host *host = platform_get_drvdata(pdev);
 
@@ -1167,7 +1167,22 @@ static int au1xmmc_suspend(struct platform_device *pdev, pm_message_t state)
 	return 0;
 }
 
-static int au1xmmc_resume(struct platform_device *pdev)
+static int au1xmmc_suspend(struct device *dev)
+{
+	return __au1xmmc_suspend(to_platform_device(dev), PMSG_SUSPEND);
+}
+
+static int au1xmmc_freeze(struct device *dev)
+{
+	return __au1xmmc_suspend(to_platform_device(dev), PMSG_FREEZE);
+}
+
+static int au1xmmc_poweroff(struct device *dev)
+{
+	return __au1xmmc_suspend(to_platform_device(dev), PMSG_HIBERNATE);
+}
+
+static int __au1xmmc_resume(struct platform_device *pdev)
 {
 	struct au1xmmc_host *host = platform_get_drvdata(pdev);
 
@@ -1175,19 +1190,31 @@ static int au1xmmc_resume(struct platform_device *pdev)
 
 	return 0;
 }
-#else
-#define au1xmmc_suspend NULL
-#define au1xmmc_resume NULL
-#endif
 
+static int au1xmmc_resume(struct device *dev)
+{
+	return __au1xmmc_resume(to_platform_device(dev));
+}
+
+static const struct dev_pm_ops au1xmmc_dev_pm_ops = {
+	.suspend = au1xmmc_suspend,
+	.resume = au1xmmc_resume,
+	/* Hibernate hooks */
+	.freeze = au1xmmc_freeze,
+	.thaw = au1xmmc_resume,
+	.poweroff = au1xmmc_poweroff,
+	.restore = au1xmmc_resume,
+};
+#endif
 static struct platform_driver au1xmmc_driver = {
 	.probe         = au1xmmc_probe,
 	.remove        = au1xmmc_remove,
-	.suspend       = au1xmmc_suspend,
-	.resume        = au1xmmc_resume,
 	.driver        = {
 		.name  = DRIVER_NAME,
 		.owner = THIS_MODULE,
+#ifdef CONFIG_PM
+		.pm    = &au1xmmc_dev_pm_ops,
+#endif
 	},
 };
 
-- 
1.7.10.4


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

* [RFT][PATCH 06/12] mmc: change bfin_sdh platform power management to use dev_pm_ops
  2014-02-10 16:12 [RFT][PATCH 00/12] change drivers power management to use dev_pm_ops Shuah Khan
                   ` (4 preceding siblings ...)
  2014-02-10 16:12 ` [RFT][PATCH 05/12] mmc: change au1xmmc " Shuah Khan
@ 2014-02-10 16:12 ` Shuah Khan
  2014-02-10 16:12 ` [RFT][PATCH 07/12] isa: change isa bus " Shuah Khan
                   ` (5 subsequent siblings)
  11 siblings, 0 replies; 15+ messages in thread
From: Shuah Khan @ 2014-02-10 16:12 UTC (permalink / raw)
  To: rjw, sonic.zhang, chris
  Cc: Shuah Khan, linux-pm, linux-kernel, adi-buildroot-devel,
	linux-mmc, shuahkhan

Change bfin_sdh platform driver to register pm ops using dev_pm_ops instead
of legacy pm_ops. .pm hooks call existing legacy suspend and resume interfaces
by passing in the right pm state.

Signed-off-by: Shuah Khan <shuah.kh@samsung.com>
---
 drivers/mmc/host/bfin_sdh.c |   40 +++++++++++++++++++++++++++++++++++-----
 1 file changed, 35 insertions(+), 5 deletions(-)

diff --git a/drivers/mmc/host/bfin_sdh.c b/drivers/mmc/host/bfin_sdh.c
index 2b7f37e..d69f223 100644
--- a/drivers/mmc/host/bfin_sdh.c
+++ b/drivers/mmc/host/bfin_sdh.c
@@ -637,7 +637,7 @@ static int sdh_remove(struct platform_device *pdev)
 }
 
 #ifdef CONFIG_PM
-static int sdh_suspend(struct platform_device *dev, pm_message_t state)
+static int __sdh_suspend(struct platform_device *dev, pm_message_t state)
 {
 	struct bfin_sd_host *drv_data = get_sdh_data(dev);
 
@@ -646,7 +646,22 @@ static int sdh_suspend(struct platform_device *dev, pm_message_t state)
 	return 0;
 }
 
-static int sdh_resume(struct platform_device *dev)
+static int sdh_suspend(struct device *dev)
+{
+	return	__sdh_suspend(to_platform_device(dev), PMSG_SUSPEND);
+}
+
+static int sdh_freeze(struct device *dev)
+{
+	return	__sdh_suspend(to_platform_device(dev), PMSG_FREEZE);
+}
+
+static int sdh_poweroff(struct device *dev)
+{
+	return	__sdh_suspend(to_platform_device(dev), PMSG_HIBERNATE);
+}
+
+static int __sdh_resume(struct platform_device *dev)
 {
 	struct bfin_sd_host *drv_data = get_sdh_data(dev);
 	int ret = 0;
@@ -660,9 +675,21 @@ static int sdh_resume(struct platform_device *dev)
 	sdh_reset();
 	return ret;
 }
-#else
-# define sdh_suspend NULL
-# define sdh_resume  NULL
+
+static int sdh_resume(struct device *dev)
+{
+	return __sdh_resume(to_platform_device(dev));
+}
+
+static const struct dev_pm_ops sdh_dev_pm_ops = {
+	.suspend = sdh_suspend,
+	.resume = sdh_resume,
+	/* Hibernate hooks */
+	.freeze = sdh_freeze,
+	.thaw = sdh_resume,
+	.poweroff = sdh_poweroff,
+	.restore = sdh_resume,
+};
 #endif
 
 static struct platform_driver sdh_driver = {
@@ -672,6 +699,9 @@ static struct platform_driver sdh_driver = {
 	.resume  = sdh_resume,
 	.driver  = {
 		.name = DRIVER_NAME,
+#ifdef CONFIG_PM
+		.pm = &sdh_dev_pm_ops,
+#endif
 	},
 };
 
-- 
1.7.10.4


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

* [RFT][PATCH 07/12] isa: change isa bus power management to use dev_pm_ops
  2014-02-10 16:12 [RFT][PATCH 00/12] change drivers power management to use dev_pm_ops Shuah Khan
                   ` (5 preceding siblings ...)
  2014-02-10 16:12 ` [RFT][PATCH 06/12] mmc: change bfin_sdh " Shuah Khan
@ 2014-02-10 16:12 ` Shuah Khan
  2014-02-10 16:12 ` [RFT][PATCH 08/12] mmc: change cb710-mmc platform " Shuah Khan
                   ` (4 subsequent siblings)
  11 siblings, 0 replies; 15+ messages in thread
From: Shuah Khan @ 2014-02-10 16:12 UTC (permalink / raw)
  To: rjw, gregkh; +Cc: Shuah Khan, linux-pm, linux-kernel, shuahkhan

Change isa bus driver to register pm ops using dev_pm_ops instead of
legacy pm_ops. .pm hooks call existing legacy suspend and resume
interfaces by passing in the right pm state.

Signed-off-by: Shuah Khan <shuah.kh@samsung.com>
---
 drivers/base/isa.c |   30 +++++++++++++++++++++++++++---
 1 file changed, 27 insertions(+), 3 deletions(-)

diff --git a/drivers/base/isa.c b/drivers/base/isa.c
index 91dba65..15b8825 100644
--- a/drivers/base/isa.c
+++ b/drivers/base/isa.c
@@ -63,7 +63,7 @@ static void isa_bus_shutdown(struct device *dev)
 		isa_driver->shutdown(dev, to_isa_dev(dev)->id);
 }
 
-static int isa_bus_suspend(struct device *dev, pm_message_t state)
+static int __isa_bus_suspend(struct device *dev, pm_message_t state)
 {
 	struct isa_driver *isa_driver = dev->platform_data;
 
@@ -73,6 +73,21 @@ static int isa_bus_suspend(struct device *dev, pm_message_t state)
 	return 0;
 }
 
+static int isa_bus_suspend(struct device *dev)
+{
+	return __isa_bus_suspend(dev, PMSG_SUSPEND);
+}
+
+static int isa_bus_freeze(struct device *dev)
+{
+	return __isa_bus_suspend(dev, PMSG_FREEZE);
+}
+
+static int isa_bus_poweroff(struct device *dev)
+{
+	return __isa_bus_suspend(dev, PMSG_HIBERNATE);
+}
+
 static int isa_bus_resume(struct device *dev)
 {
 	struct isa_driver *isa_driver = dev->platform_data;
@@ -83,14 +98,23 @@ static int isa_bus_resume(struct device *dev)
 	return 0;
 }
 
+static const struct dev_pm_ops isa_bus_dev_pm_ops = {
+	.suspend = isa_bus_suspend,
+	.resume = isa_bus_resume,
+	/* Hibernate callbacks */
+	.freeze = isa_bus_freeze,
+	.thaw = isa_bus_resume,
+	.poweroff = isa_bus_poweroff,
+	.restore = isa_bus_resume,
+};
+
 static struct bus_type isa_bus_type = {
 	.name		= "isa",
 	.match		= isa_bus_match,
 	.probe		= isa_bus_probe,
 	.remove		= isa_bus_remove,
 	.shutdown	= isa_bus_shutdown,
-	.suspend	= isa_bus_suspend,
-	.resume		= isa_bus_resume
+	.pm		= &isa_bus_dev_pm_ops,
 };
 
 static void isa_dev_release(struct device *dev)
-- 
1.7.10.4


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

* [RFT][PATCH 08/12] mmc: change cb710-mmc platform power management to use dev_pm_ops
  2014-02-10 16:12 [RFT][PATCH 00/12] change drivers power management to use dev_pm_ops Shuah Khan
                   ` (6 preceding siblings ...)
  2014-02-10 16:12 ` [RFT][PATCH 07/12] isa: change isa bus " Shuah Khan
@ 2014-02-10 16:12 ` Shuah Khan
  2014-02-10 23:49   ` Michał Mirosław
  2014-02-10 16:12 ` [RFT][PATCH 09/12] mmc: change msm_sdcc " Shuah Khan
                   ` (3 subsequent siblings)
  11 siblings, 1 reply; 15+ messages in thread
From: Shuah Khan @ 2014-02-10 16:12 UTC (permalink / raw)
  To: rjw, mirq-linux, chris
  Cc: Shuah Khan, linux-pm, linux-kernel, linux-mmc, shuahkhan

Change cb710-mmc platform driver to register pm ops using dev_pm_ops instead
of legacy pm_ops. .pm hooks call existing legacy suspend and resume interfaces
by passing in the right pm state.

Signed-off-by: Shuah Khan <shuah.kh@samsung.com>
---
 drivers/mmc/host/cb710-mmc.c |   37 +++++++++++++++++++++++++++++++++----
 1 file changed, 33 insertions(+), 4 deletions(-)

diff --git a/drivers/mmc/host/cb710-mmc.c b/drivers/mmc/host/cb710-mmc.c
index 1087b4c..00fd93f 100644
--- a/drivers/mmc/host/cb710-mmc.c
+++ b/drivers/mmc/host/cb710-mmc.c
@@ -664,7 +664,7 @@ static const struct mmc_host_ops cb710_mmc_host = {
 
 #ifdef CONFIG_PM
 
-static int cb710_mmc_suspend(struct platform_device *pdev, pm_message_t state)
+static int __cb710_mmc_suspend(struct platform_device *pdev, pm_message_t state)
 {
 	struct cb710_slot *slot = cb710_pdev_to_slot(pdev);
 
@@ -672,7 +672,22 @@ static int cb710_mmc_suspend(struct platform_device *pdev, pm_message_t state)
 	return 0;
 }
 
-static int cb710_mmc_resume(struct platform_device *pdev)
+static int cb710_mmc_suspend(struct device *dev)
+{
+	return __cb710_mmc_suspend(to_platform_device(dev), PMSG_SUSPEND);
+}
+
+static int cb710_mmc_freeze(struct device *dev)
+{
+	return __cb710_mmc_suspend(to_platform_device(dev), PMSG_FREEZE);
+}
+
+static int cb710_mmc_poweroff(struct device *dev)
+{
+	return __cb710_mmc_suspend(to_platform_device(dev), PMSG_HIBERNATE);
+}
+
+static int __cb710_mmc_resume(struct platform_device *pdev)
 {
 	struct cb710_slot *slot = cb710_pdev_to_slot(pdev);
 
@@ -680,6 +695,10 @@ static int cb710_mmc_resume(struct platform_device *pdev)
 	return 0;
 }
 
+static int cb710_mmc_resume(struct device *dev)
+{
+	return __cb710_mmc_resume(to_platform_device(dev));
+}
 #endif /* CONFIG_PM */
 
 static int cb710_mmc_init(struct platform_device *pdev)
@@ -762,13 +781,23 @@ static int cb710_mmc_exit(struct platform_device *pdev)
 	return 0;
 }
 
+#ifdef CONFIG_PM
+static const struct dev_pm_ops cb710_mmc_dev_pm_ops = {
+	.suspend = cb710_mmc_suspend,
+	.resume = cb710_mmc_resume,
+	/* Hibernate hooks */
+	.freeze = cb710_mmc_freeze,
+	.thaw = cb710_mmc_resume,
+	.poweroff = cb710_mmc_poweroff,
+	.restore = cb710_mmc_resume,
+};
+#endif
 static struct platform_driver cb710_mmc_driver = {
 	.driver.name = "cb710-mmc",
 	.probe = cb710_mmc_init,
 	.remove = cb710_mmc_exit,
 #ifdef CONFIG_PM
-	.suspend = cb710_mmc_suspend,
-	.resume = cb710_mmc_resume,
+	.driver.pm = &cb710_mmc_dev_pm_ops,
 #endif
 };
 
-- 
1.7.10.4


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

* [RFT][PATCH 09/12] mmc: change msm_sdcc platform power management to use dev_pm_ops
  2014-02-10 16:12 [RFT][PATCH 00/12] change drivers power management to use dev_pm_ops Shuah Khan
                   ` (7 preceding siblings ...)
  2014-02-10 16:12 ` [RFT][PATCH 08/12] mmc: change cb710-mmc platform " Shuah Khan
@ 2014-02-10 16:12 ` Shuah Khan
  2014-02-10 16:15 ` [RFT][PATCH 10/12] mmc: change tmio_mmc " Shuah Khan
                   ` (2 subsequent siblings)
  11 siblings, 0 replies; 15+ messages in thread
From: Shuah Khan @ 2014-02-10 16:12 UTC (permalink / raw)
  To: rjw, davidb, dwalker, bryanh, chris
  Cc: Shuah Khan, linux-pm, linux-kernel, linux-arm-msm, linux-mmc, shuahkhan

Change msm_sdcc platform driver to register pm ops using dev_pm_ops instead of
legacy pm_ops. .pm hooks call existing legacy suspend and resume interfaces
by passing in the right pm state.

Signed-off-by: Shuah Khan <shuah.kh@samsung.com>
---
 drivers/mmc/host/msm_sdcc.c |   42 +++++++++++++++++++++++++++++++++++-------
 1 file changed, 35 insertions(+), 7 deletions(-)

diff --git a/drivers/mmc/host/msm_sdcc.c b/drivers/mmc/host/msm_sdcc.c
index 9405ecd..311e32a 100644
--- a/drivers/mmc/host/msm_sdcc.c
+++ b/drivers/mmc/host/msm_sdcc.c
@@ -1417,7 +1417,7 @@ ioremap_free:
 
 #ifdef CONFIG_PM
 static int
-msmsdcc_suspend(struct platform_device *dev, pm_message_t state)
+__msmsdcc_suspend(struct platform_device *dev, pm_message_t state)
 {
 	struct mmc_host *mmc = mmc_get_drvdata(dev);
 
@@ -1434,8 +1434,23 @@ msmsdcc_suspend(struct platform_device *dev, pm_message_t state)
 	return 0;
 }
 
+static int msmsdcc_suspend(struct device *dev)
+{
+	return __msmsdcc_suspend(to_platform_device(dev), PMSG_SUSPEND);
+}
+
+static int msmsdcc_freeze(struct device *dev)
+{
+	return __msmsdcc_suspend(to_platform_device(dev), PMSG_FREEZE);
+}
+
+static int msmsdcc_poweroff(struct device *dev)
+{
+	return __msmsdcc_suspend(to_platform_device(dev), PMSG_HIBERNATE);
+}
+
 static int
-msmsdcc_resume(struct platform_device *dev)
+__msmsdcc_resume(struct platform_device *dev)
 {
 	struct mmc_host *mmc = mmc_get_drvdata(dev);
 
@@ -1454,17 +1469,30 @@ msmsdcc_resume(struct platform_device *dev)
 	}
 	return 0;
 }
-#else
-#define msmsdcc_suspend	0
-#define msmsdcc_resume 0
+
+static int msmsdcc_resume(struct device *dev)
+{
+	return __msmsdcc_resume(to_platform_device(dev));
+}
+
+static const struct dev_pm_ops msmsdcc_dev_pm_ops = {
+	.suspend = msmsdcc_suspend,
+	.resume = msmsdcc_resume,
+	/* Hibernate hooks */
+	.freeze = msmsdcc_freeze,
+	.thaw = msmsdcc_resume,
+	.poweroff = msmsdcc_poweroff,
+	.restore = msmsdcc_resume,
+};
 #endif
 
 static struct platform_driver msmsdcc_driver = {
 	.probe		= msmsdcc_probe,
-	.suspend	= msmsdcc_suspend,
-	.resume		= msmsdcc_resume,
 	.driver		= {
 		.name	= "msm_sdcc",
+#ifdef CONFIG_PM
+		.pm	= &msmsdcc_dev_pm_ops,
+#endif
 	},
 };
 
-- 
1.7.10.4


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

* [RFT][PATCH 10/12] mmc: change tmio_mmc platform power management to use dev_pm_ops
  2014-02-10 16:12 [RFT][PATCH 00/12] change drivers power management to use dev_pm_ops Shuah Khan
                   ` (8 preceding siblings ...)
  2014-02-10 16:12 ` [RFT][PATCH 09/12] mmc: change msm_sdcc " Shuah Khan
@ 2014-02-10 16:15 ` Shuah Khan
  2014-02-10 16:15 ` [RFT][PATCH 11/12] drivers/pcmcia: change ds driver " Shuah Khan
  2014-02-10 16:15 ` [RFT][PATCH 12/12] drivers/s390/crypto: change ap_bus " Shuah Khan
  11 siblings, 0 replies; 15+ messages in thread
From: Shuah Khan @ 2014-02-10 16:15 UTC (permalink / raw)
  To: rjw, ian, chris; +Cc: Shuah Khan, linux-pm, linux-kernel, linux-mmc, shuahkhan

Change tmio_mmc platform driver to register pm ops using dev_pm_ops instead
of legacy pm_ops. .pm hooks call existing legacy suspend and resume interfaces
by passing in the right pm state.

Signed-off-by: Shuah Khan <shuah.kh@samsung.com>
---
 drivers/mmc/host/tmio_mmc.c |   42 +++++++++++++++++++++++++++++++++++-------
 1 file changed, 35 insertions(+), 7 deletions(-)

diff --git a/drivers/mmc/host/tmio_mmc.c b/drivers/mmc/host/tmio_mmc.c
index 1900abb..e9b0a06 100644
--- a/drivers/mmc/host/tmio_mmc.c
+++ b/drivers/mmc/host/tmio_mmc.c
@@ -24,7 +24,7 @@
 #include "tmio_mmc.h"
 
 #ifdef CONFIG_PM
-static int tmio_mmc_suspend(struct platform_device *dev, pm_message_t state)
+static int __tmio_mmc_suspend(struct platform_device *dev, pm_message_t state)
 {
 	const struct mfd_cell *cell = mfd_get_cell(dev);
 	int ret;
@@ -38,7 +38,22 @@ static int tmio_mmc_suspend(struct platform_device *dev, pm_message_t state)
 	return ret;
 }
 
-static int tmio_mmc_resume(struct platform_device *dev)
+static int tmio_mmc_suspend(struct device *dev)
+{
+	return __tmio_mmc_suspend(to_platform_device(dev), PMSG_SUSPEND);
+}
+
+static int tmio_mmc_freeze(struct device *dev)
+{
+	return __tmio_mmc_suspend(to_platform_device(dev), PMSG_FREEZE);
+}
+
+static int tmio_mmc_poweroff(struct device *dev)
+{
+	return __tmio_mmc_suspend(to_platform_device(dev), PMSG_HIBERNATE);
+}
+
+static int __tmio_mmc_resume(struct platform_device *dev)
 {
 	const struct mfd_cell *cell = mfd_get_cell(dev);
 	int ret = 0;
@@ -52,9 +67,21 @@ static int tmio_mmc_resume(struct platform_device *dev)
 
 	return ret;
 }
-#else
-#define tmio_mmc_suspend NULL
-#define tmio_mmc_resume NULL
+
+static int tmio_mmc_resume(struct device *dev)
+{
+	return __tmio_mmc_resume(to_platform_device(dev));
+}
+
+static const struct dev_pm_ops tmio_mmc_dev_pm_ops = {
+	.suspend = tmio_mmc_suspend,
+	.resume = tmio_mmc_resume,
+	/* Hibernate hooks */
+	.freeze = tmio_mmc_freeze,
+	.thaw = tmio_mmc_resume,
+	.poweroff = tmio_mmc_poweroff,
+	.restore = tmio_mmc_resume,
+};
 #endif
 
 static int tmio_mmc_probe(struct platform_device *pdev)
@@ -138,11 +165,12 @@ static struct platform_driver tmio_mmc_driver = {
 	.driver = {
 		.name = "tmio-mmc",
 		.owner = THIS_MODULE,
+#ifdef CONFIG_PM
+		.pm = &tmio_mmc_dev_pm_ops,
+#endif
 	},
 	.probe = tmio_mmc_probe,
 	.remove = tmio_mmc_remove,
-	.suspend = tmio_mmc_suspend,
-	.resume = tmio_mmc_resume,
 };
 
 module_platform_driver(tmio_mmc_driver);
-- 
1.7.10.4


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

* [RFT][PATCH 11/12] drivers/pcmcia: change ds driver power management to use dev_pm_ops
  2014-02-10 16:12 [RFT][PATCH 00/12] change drivers power management to use dev_pm_ops Shuah Khan
                   ` (9 preceding siblings ...)
  2014-02-10 16:15 ` [RFT][PATCH 10/12] mmc: change tmio_mmc " Shuah Khan
@ 2014-02-10 16:15 ` Shuah Khan
  2014-02-10 16:15 ` [RFT][PATCH 12/12] drivers/s390/crypto: change ap_bus " Shuah Khan
  11 siblings, 0 replies; 15+ messages in thread
From: Shuah Khan @ 2014-02-10 16:15 UTC (permalink / raw)
  To: rjw, gregkh; +Cc: Shuah Khan, linux-pm, linux-kernel, linux-pcmcia, shuahkhan

Change ds driver to register pm ops using dev_pm_ops instead of legacy
pm_ops. .pm hooks call existing legacy suspend and resume interfaces
by passing in the right pm state.

Signed-off-by: Shuah Khan <shuah.kh@samsung.com>
---
 drivers/pcmcia/ds.c |   36 +++++++++++++++++++++++++++++++-----
 1 file changed, 31 insertions(+), 5 deletions(-)

diff --git a/drivers/pcmcia/ds.c b/drivers/pcmcia/ds.c
index 757119b..2979323 100644
--- a/drivers/pcmcia/ds.c
+++ b/drivers/pcmcia/ds.c
@@ -962,7 +962,10 @@ static int pcmcia_bus_uevent(struct device *dev, struct kobj_uevent_env *env)
 
 /************************ runtime PM support ***************************/
 
-static int pcmcia_dev_suspend(struct device *dev, pm_message_t state);
+static int __pcmcia_dev_suspend(struct device *dev, pm_message_t state);
+static int pcmcia_dev_suspend(struct device *dev);
+static int pcmcia_dev_poweroff(struct device *dev);
+static int pcmcia_dev_freeze(struct device *dev);
 static int pcmcia_dev_resume(struct device *dev);
 
 static int runtime_suspend(struct device *dev)
@@ -970,7 +973,7 @@ static int runtime_suspend(struct device *dev)
 	int rc;
 
 	device_lock(dev);
-	rc = pcmcia_dev_suspend(dev, PMSG_SUSPEND);
+	rc = __pcmcia_dev_suspend(dev, PMSG_SUSPEND);
 	device_unlock(dev);
 	return rc;
 }
@@ -1120,7 +1123,22 @@ ATTRIBUTE_GROUPS(pcmcia_dev);
 
 /* PM support, also needed for reset */
 
-static int pcmcia_dev_suspend(struct device *dev, pm_message_t state)
+static int pcmcia_dev_suspend(struct device *dev)
+{
+	return __pcmcia_dev_suspend(dev, PMSG_SUSPEND);
+}
+
+static int pcmcia_dev_poweroff(struct device *dev)
+{
+	return __pcmcia_dev_suspend(dev, PMSG_HIBERNATE);
+}
+
+static int pcmcia_dev_freeze(struct device *dev)
+{
+	return __pcmcia_dev_suspend(dev, PMSG_FREEZE);
+}
+
+static int __pcmcia_dev_suspend(struct device *dev, pm_message_t state)
 {
 	struct pcmcia_device *p_dev = to_pcmcia_dev(dev);
 	struct pcmcia_driver *p_drv = NULL;
@@ -1397,6 +1415,15 @@ static struct class_interface pcmcia_bus_interface __refdata = {
 	.remove_dev = &pcmcia_bus_remove_socket,
 };
 
+static const struct dev_pm_ops pcmcia_bus_dev_pm_ops = {
+	.suspend = pcmcia_dev_suspend,
+	.resume = pcmcia_dev_resume,
+	/* Hibernate callbacks */
+	.freeze = pcmcia_dev_freeze,
+	.thaw = pcmcia_dev_resume,
+	.poweroff = pcmcia_dev_poweroff,
+	.restore = pcmcia_dev_resume,
+};
 
 struct bus_type pcmcia_bus_type = {
 	.name = "pcmcia",
@@ -1405,8 +1432,7 @@ struct bus_type pcmcia_bus_type = {
 	.dev_groups = pcmcia_dev_groups,
 	.probe = pcmcia_device_probe,
 	.remove = pcmcia_device_remove,
-	.suspend = pcmcia_dev_suspend,
-	.resume = pcmcia_dev_resume,
+	.pm = &pcmcia_bus_dev_pm_ops,
 };
 
 
-- 
1.7.10.4


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

* [RFT][PATCH 12/12] drivers/s390/crypto: change ap_bus driver power management to use dev_pm_ops
  2014-02-10 16:12 [RFT][PATCH 00/12] change drivers power management to use dev_pm_ops Shuah Khan
                   ` (10 preceding siblings ...)
  2014-02-10 16:15 ` [RFT][PATCH 11/12] drivers/pcmcia: change ds driver " Shuah Khan
@ 2014-02-10 16:15 ` Shuah Khan
  11 siblings, 0 replies; 15+ messages in thread
From: Shuah Khan @ 2014-02-10 16:15 UTC (permalink / raw)
  To: rjw, ingo.tuchscherer, schwidefsky, heiko.carstens
  Cc: Shuah Khan, linux-pm, linux-kernel, linux390, linux-s390, shuahkhan

Change ap_bus driver to register pm ops using dev_pm_ops instead of legacy
pm_ops. .pm hooks call existing legacy suspend and resume interfaces by
passing in the right pm state.

Signed-off-by: Shuah Khan <shuah.kh@samsung.com>
---
 drivers/s390/crypto/ap_bus.c |   30 +++++++++++++++++++++++++++---
 1 file changed, 27 insertions(+), 3 deletions(-)

diff --git a/drivers/s390/crypto/ap_bus.c b/drivers/s390/crypto/ap_bus.c
index ab3baa7..c39c917 100644
--- a/drivers/s390/crypto/ap_bus.c
+++ b/drivers/s390/crypto/ap_bus.c
@@ -799,7 +799,7 @@ static int ap_uevent (struct device *dev, struct kobj_uevent_env *env)
 	return retval;
 }
 
-static int ap_bus_suspend(struct device *dev, pm_message_t state)
+static int __ap_bus_suspend(struct device *dev, pm_message_t state)
 {
 	struct ap_device *ap_dev = to_ap_dev(dev);
 	unsigned long flags;
@@ -833,6 +833,21 @@ static int ap_bus_suspend(struct device *dev, pm_message_t state)
 	return 0;
 }
 
+static int ap_bus_suspend(struct device *dev)
+{
+	return __ap_bus_suspend(dev, PMSG_SUSPEND);
+}
+
+static int ap_bus_freeze(struct device *dev)
+{
+	return __ap_bus_suspend(dev, PMSG_FREEZE);
+}
+
+static int ap_bus_poweroff(struct device *dev)
+{
+	return __ap_bus_suspend(dev, PMSG_HIBERNATE);
+}
+
 static int ap_bus_resume(struct device *dev)
 {
 	struct ap_device *ap_dev = to_ap_dev(dev);
@@ -886,12 +901,21 @@ static int ap_bus_resume(struct device *dev)
 	return rc;
 }
 
+static const struct dev_pm_ops ap_bus_dev_pm_ops = {
+	.suspend = ap_bus_suspend,
+	.resume = ap_bus_resume,
+	/* Hibernate callbacks */
+	.freeze = ap_bus_freeze,
+	.thaw = ap_bus_resume,
+	.poweroff = ap_bus_poweroff,
+	.restore = ap_bus_resume,
+};
+
 static struct bus_type ap_bus_type = {
 	.name = "ap",
 	.match = &ap_bus_match,
 	.uevent = &ap_uevent,
-	.suspend = ap_bus_suspend,
-	.resume = ap_bus_resume
+	.pm = &ap_bus_dev_pm_ops,
 };
 
 static int ap_device_probe(struct device *dev)
-- 
1.7.10.4


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

* Re: [RFT][PATCH 08/12] mmc: change cb710-mmc platform power management to use dev_pm_ops
  2014-02-10 16:12 ` [RFT][PATCH 08/12] mmc: change cb710-mmc platform " Shuah Khan
@ 2014-02-10 23:49   ` Michał Mirosław
  2014-02-11 15:38     ` Shuah Khan
  0 siblings, 1 reply; 15+ messages in thread
From: Michał Mirosław @ 2014-02-10 23:49 UTC (permalink / raw)
  To: Shuah Khan; +Cc: rjw, chris, linux-pm, linux-kernel, linux-mmc, shuahkhan

On Mon, Feb 10, 2014 at 09:12:31AM -0700, Shuah Khan wrote:
> Change cb710-mmc platform driver to register pm ops using dev_pm_ops instead
> of legacy pm_ops. .pm hooks call existing legacy suspend and resume interfaces
> by passing in the right pm state.
[all the patch cut]

Aaah, a bit mechanical - this change, isn't it?

The suspend/resume callbacks just clears IRQ mask in the device in case it
got undefined during sleep state. So the proper change here is to squash all
the functions in one, and point all of the hooks to it.

With the change you have my ack.

BTW, you could move cb710_mmc_suspend() (or whatever you'll call it) to one
ifdef block with cb710_mmc_dev_pm_ops.

Best Regards,
Michał Mirosław

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

* Re: [RFT][PATCH 08/12] mmc: change cb710-mmc platform power management to use dev_pm_ops
  2014-02-10 23:49   ` Michał Mirosław
@ 2014-02-11 15:38     ` Shuah Khan
  0 siblings, 0 replies; 15+ messages in thread
From: Shuah Khan @ 2014-02-11 15:38 UTC (permalink / raw)
  To: Michał Mirosław
  Cc: rjw, chris, linux-pm, linux-kernel, linux-mmc, shuahkhan, Shuah Khan

On 02/10/2014 04:49 PM, Michał Mirosław wrote:
> On Mon, Feb 10, 2014 at 09:12:31AM -0700, Shuah Khan wrote:
>> Change cb710-mmc platform driver to register pm ops using dev_pm_ops instead
>> of legacy pm_ops. .pm hooks call existing legacy suspend and resume interfaces
>> by passing in the right pm state.
> [all the patch cut]
>
> Aaah, a bit mechanical - this change, isn't it?

Yes :)

>
> The suspend/resume callbacks just clears IRQ mask in the device in case it
> got undefined during sleep state. So the proper change here is to squash all
> the functions in one, and point all of the hooks to it.
>
> With the change you have my ack.
>
> BTW, you could move cb710_mmc_suspend() (or whatever you'll call it) to one
> ifdef block with cb710_mmc_dev_pm_ops.
>

It makes perfect sense to squash suspend and resume. Thanks for the 
review. Code looks lot simpler now. Will send v2 patch shortly.

-- Shuah

-- 
Shuah Khan
Senior Linux Kernel Developer - Open Source Group
Samsung Research America(Silicon Valley)
shuah.kh@samsung.com | (970) 672-0658

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

end of thread, other threads:[~2014-02-11 15:38 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-02-10 16:12 [RFT][PATCH 00/12] change drivers power management to use dev_pm_ops Shuah Khan
2014-02-10 16:12 ` [RFT][PATCH 01/12] arm: change locomo platform and bus " Shuah Khan
2014-02-10 16:12 ` [RFT][PATCH 02/12] arm: change sa1111 " Shuah Khan
2014-02-10 16:12 ` [RFT][PATCH 03/12] arm: change scoop platform " Shuah Khan
2014-02-10 16:12 ` [RFT][PATCH 04/12] drivers/macintosh/adb: change " Shuah Khan
2014-02-10 16:12 ` [RFT][PATCH 05/12] mmc: change au1xmmc " Shuah Khan
2014-02-10 16:12 ` [RFT][PATCH 06/12] mmc: change bfin_sdh " Shuah Khan
2014-02-10 16:12 ` [RFT][PATCH 07/12] isa: change isa bus " Shuah Khan
2014-02-10 16:12 ` [RFT][PATCH 08/12] mmc: change cb710-mmc platform " Shuah Khan
2014-02-10 23:49   ` Michał Mirosław
2014-02-11 15:38     ` Shuah Khan
2014-02-10 16:12 ` [RFT][PATCH 09/12] mmc: change msm_sdcc " Shuah Khan
2014-02-10 16:15 ` [RFT][PATCH 10/12] mmc: change tmio_mmc " Shuah Khan
2014-02-10 16:15 ` [RFT][PATCH 11/12] drivers/pcmcia: change ds driver " Shuah Khan
2014-02-10 16:15 ` [RFT][PATCH 12/12] drivers/s390/crypto: change ap_bus " Shuah Khan

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).