public inbox for linux-omap@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 00/07] pm: remove late/early platform driver pm callbacks
@ 2009-06-05  7:54 Magnus Damm
  2009-06-05  7:54 ` [PATCH 01/07] arm: rework omap suspend_late()/resume_early() Magnus Damm
                   ` (7 more replies)
  0 siblings, 8 replies; 13+ messages in thread
From: Magnus Damm @ 2009-06-05  7:54 UTC (permalink / raw)
  To: linux-pm
  Cc: pavel, hskinnemoen, anemo, gregkh, rjw, stern, ben-linux,
	felipe.balbi, linux-omap, Magnus Damm

pm: remove late/early platform driver pm callbacks

[PATCH 01/07] arm: rework omap suspend_late()/resume_early()
[PATCH 02/07] dma: rework dw_dmac suspend_late()/resume_early()
[PATCH 03/07] dma: rework txx9dmac suspend_late()/resume_early()
[PATCH 04/07] i2c: rework i2c-pxa suspend_late()/resume_early()
[PATCH 05/07] i2c: rework i2c-s3c2410 suspend_late()/resume()
[PATCH 06/07] usb: rework musb suspend()/resume_early()
[PATCH 07/07] pm: remove platform device suspend_late()/resume_early()

These patches simply remove ->suspend_late() and ->resume_early()
from struct platform_driver. Drivers are converted to dev_pm_ops
with CONFIG_SUSPEND in mind. Untested.

All patches except [02/07] are known to compile.

Signed-off-by: Magnus Damm <damm@igel.co.jp>
---

 arch/arm/plat-omap/debug-leds.c  |   11 +++++++----
 arch/arm/plat-omap/gpio.c        |   14 ++++++++++----
 drivers/base/platform.c          |   36 ------------------------------------
 drivers/dma/dw_dmac.c            |   15 ++++++++++-----
 drivers/dma/txx9dmac.c           |   15 ++++++++++-----
 drivers/i2c/busses/i2c-pxa.c     |   25 +++++++++++++++++--------
 drivers/i2c/busses/i2c-s3c2410.c |   28 +++++++++++++++++-----------
 drivers/usb/musb/musb_core.c     |   18 ++++++++++++------
 include/linux/platform_device.h  |    2 --
 9 files changed, 83 insertions(+), 81 deletions(-)

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

* [PATCH 01/07] arm: rework omap suspend_late()/resume_early()
  2009-06-05  7:54 [PATCH 00/07] pm: remove late/early platform driver pm callbacks Magnus Damm
@ 2009-06-05  7:54 ` Magnus Damm
  2009-06-05  7:54 ` [PATCH 02/07] dma: rework dw_dmac suspend_late()/resume_early() Magnus Damm
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 13+ messages in thread
From: Magnus Damm @ 2009-06-05  7:54 UTC (permalink / raw)
  To: linux-pm
  Cc: ben-linux, hskinnemoen, anemo, gregkh, rjw, stern, pavel,
	felipe.balbi, linux-omap, Magnus Damm

From: Magnus Damm <damm@igel.co.jp>

This patch reworks platform driver power management code
for omap drivers using late/early legacy callbacks.

The callbacks are converted for CONFIG_SUSPEND like this:
  suspend_late() -> suspend_noirq()
  resume_early() -> resume_noirq()

Signed-off-by: Magnus Damm <damm@igel.co.jp>
---

 Untested but compiles just fine.

 arch/arm/plat-omap/debug-leds.c |   11 +++++++----
 arch/arm/plat-omap/gpio.c       |   14 ++++++++++----
 2 files changed, 17 insertions(+), 8 deletions(-)

--- 0001/arch/arm/plat-omap/debug-leds.c
+++ work/arch/arm/plat-omap/debug-leds.c	2009-06-01 15:50:21.000000000 +0900
@@ -281,24 +281,27 @@ static int /* __init */ fpga_probe(struc
 	return 0;
 }
 
-static int fpga_suspend_late(struct platform_device *pdev, pm_message_t mesg)
+static int fpga_suspend_noirq(struct device *dev)
 {
 	__raw_writew(~0, &fpga->leds);
 	return 0;
 }
 
-static int fpga_resume_early(struct platform_device *pdev)
+static int fpga_resume_noirq(struct device *dev)
 {
 	__raw_writew(~hw_led_state, &fpga->leds);
 	return 0;
 }
 
+static struct dev_pm_ops fpga_dev_pm_ops = {
+	.suspend_noirq = fpga_suspend_noirq,
+	.resume_noirq = fpga_resume_noirq,
+};
 
 static struct platform_driver led_driver = {
 	.driver.name	= "omap_dbg_led",
+	.driver.pm	= &fpga_dev_pm_ops,
 	.probe		= fpga_probe,
-	.suspend_late	= fpga_suspend_late,
-	.resume_early	= fpga_resume_early,
 };
 
 static int __init fpga_init(void)
--- 0001/arch/arm/plat-omap/gpio.c
+++ work/arch/arm/plat-omap/gpio.c	2009-06-01 16:30:56.000000000 +0900
@@ -1264,8 +1264,9 @@ static struct irq_chip mpuio_irq_chip = 
 
 #include <linux/platform_device.h>
 
-static int omap_mpuio_suspend_late(struct platform_device *pdev, pm_message_t mesg)
+static int omap_mpuio_suspend_noirq(struct device *dev)
 {
+	struct platform_device *pdev = to_platform_device(dev);
 	struct gpio_bank	*bank = platform_get_drvdata(pdev);
 	void __iomem		*mask_reg = bank->base + OMAP_MPUIO_GPIO_MASKIT;
 	unsigned long		flags;
@@ -1278,8 +1279,9 @@ static int omap_mpuio_suspend_late(struc
 	return 0;
 }
 
-static int omap_mpuio_resume_early(struct platform_device *pdev)
+static int omap_mpuio_resume_noirq(struct device *dev)
 {
+	struct platform_device *pdev = to_platform_device(dev);
 	struct gpio_bank	*bank = platform_get_drvdata(pdev);
 	void __iomem		*mask_reg = bank->base + OMAP_MPUIO_GPIO_MASKIT;
 	unsigned long		flags;
@@ -1291,14 +1293,18 @@ static int omap_mpuio_resume_early(struc
 	return 0;
 }
 
+static struct dev_pm_ops omap_mpuio_dev_pm_ops = {
+	.suspend_noirq = omap_mpuio_suspend_noirq,
+	.resume_noirq = omap_mpuio_resume_noirq,
+};
+
 /* use platform_driver for this, now that there's no longer any
  * point to sys_device (other than not disturbing old code).
  */
 static struct platform_driver omap_mpuio_driver = {
-	.suspend_late	= omap_mpuio_suspend_late,
-	.resume_early	= omap_mpuio_resume_early,
 	.driver		= {
 		.name	= "mpuio",
+		.pm	= &omap_mpuio_dev_pm_ops,
 	},
 };
 

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

* [PATCH 02/07] dma: rework dw_dmac suspend_late()/resume_early()
  2009-06-05  7:54 [PATCH 00/07] pm: remove late/early platform driver pm callbacks Magnus Damm
  2009-06-05  7:54 ` [PATCH 01/07] arm: rework omap suspend_late()/resume_early() Magnus Damm
@ 2009-06-05  7:54 ` Magnus Damm
  2009-06-05  8:18   ` Haavard Skinnemoen
  2009-06-05  7:55 ` [PATCH 03/07] dma: rework txx9dmac suspend_late()/resume_early() Magnus Damm
                   ` (5 subsequent siblings)
  7 siblings, 1 reply; 13+ messages in thread
From: Magnus Damm @ 2009-06-05  7:54 UTC (permalink / raw)
  To: linux-pm
  Cc: pavel, hskinnemoen, anemo, gregkh, rjw, stern, ben-linux,
	felipe.balbi, linux-omap, Magnus Damm

From: Magnus Damm <damm@igel.co.jp>

This patch reworks platform driver power management code
for dw_dmac from legacy late/early callbacks to dev_pm_ops.

The callbacks are converted for CONFIG_SUSPEND like this:
  suspend_late() -> suspend_noirq()
  resume_early() -> resume_noirq()

Signed-off-by: Magnus Damm <damm@igel.co.jp>
---

 Untested and not test compiled due to lack of cross compiler.

 drivers/dma/dw_dmac.c |   15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

--- 0001/drivers/dma/dw_dmac.c
+++ work/drivers/dma/dw_dmac.c	2009-06-01 16:31:34.000000000 +0900
@@ -1399,8 +1399,9 @@ static void dw_shutdown(struct platform_
 	clk_disable(dw->clk);
 }
 
-static int dw_suspend_late(struct platform_device *pdev, pm_message_t mesg)
+static int dw_suspend_noirq(struct device *dev)
 {
+	struct platform_device *pdev = to_platform_device(dev);
 	struct dw_dma	*dw = platform_get_drvdata(pdev);
 
 	dw_dma_off(platform_get_drvdata(pdev));
@@ -1408,23 +1409,27 @@ static int dw_suspend_late(struct platfo
 	return 0;
 }
 
-static int dw_resume_early(struct platform_device *pdev)
+static int dw_resume_noirq(struct device *dev)
 {
+	struct platform_device *pdev = to_platform_device(dev);
 	struct dw_dma	*dw = platform_get_drvdata(pdev);
 
 	clk_enable(dw->clk);
 	dma_writel(dw, CFG, DW_CFG_DMA_EN);
 	return 0;
-
 }
 
+static struct dev_pm_ops dw_dev_pm_ops = {
+	.suspend_noirq = dw_suspend_noirq,
+	.resume_noirq = dw_resume_noirq,
+};
+
 static struct platform_driver dw_driver = {
 	.remove		= __exit_p(dw_remove),
 	.shutdown	= dw_shutdown,
-	.suspend_late	= dw_suspend_late,
-	.resume_early	= dw_resume_early,
 	.driver = {
 		.name	= "dw_dmac",
+		.pm	= &dw_dev_pm_ops,
 	},
 };
 

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

* [PATCH 03/07] dma: rework txx9dmac suspend_late()/resume_early()
  2009-06-05  7:54 [PATCH 00/07] pm: remove late/early platform driver pm callbacks Magnus Damm
  2009-06-05  7:54 ` [PATCH 01/07] arm: rework omap suspend_late()/resume_early() Magnus Damm
  2009-06-05  7:54 ` [PATCH 02/07] dma: rework dw_dmac suspend_late()/resume_early() Magnus Damm
@ 2009-06-05  7:55 ` Magnus Damm
  2009-06-05  7:55 ` [PATCH 04/07] i2c: rework i2c-pxa suspend_late()/resume_early() Magnus Damm
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 13+ messages in thread
From: Magnus Damm @ 2009-06-05  7:55 UTC (permalink / raw)
  To: linux-pm
  Cc: ben-linux, hskinnemoen, anemo, gregkh, rjw, stern, pavel,
	felipe.balbi, linux-omap, Magnus Damm

From: Magnus Damm <damm@igel.co.jp>

This patch reworks platform driver power management code
for txx9dmac from legacy late/early callbacks to dev_pm_ops.

The callbacks are converted for CONFIG_SUSPEND like this:
  suspend_late() -> suspend_noirq()
  resume_early() -> resume_noirq()

Signed-off-by: Magnus Damm <damm@igel.co.jp>
---

 Untested but compiles fine.

 drivers/dma/txx9dmac.c |   15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

--- 0001/drivers/dma/txx9dmac.c
+++ work/drivers/dma/txx9dmac.c	2009-06-01 16:34:23.000000000 +0900
@@ -1287,17 +1287,18 @@ static void txx9dmac_shutdown(struct pla
 	txx9dmac_off(ddev);
 }
 
-static int txx9dmac_suspend_late(struct platform_device *pdev,
-				 pm_message_t mesg)
+static int txx9dmac_suspend_noirq(struct device *dev)
 {
+	struct platform_device *pdev = to_platform_device(dev);
 	struct txx9dmac_dev *ddev = platform_get_drvdata(pdev);
 
 	txx9dmac_off(ddev);
 	return 0;
 }
 
-static int txx9dmac_resume_early(struct platform_device *pdev)
+static int txx9dmac_resume_noirq(struct device *dev)
 {
+	struct platform_device *pdev = to_platform_device(dev);
 	struct txx9dmac_dev *ddev = platform_get_drvdata(pdev);
 	struct txx9dmac_platform_data *pdata = pdev->dev.platform_data;
 	u32 mcr;
@@ -1310,6 +1311,11 @@ static int txx9dmac_resume_early(struct 
 
 }
 
+static struct dev_pm_ops txx9dmac_dev_pm_ops = {
+	.suspend_noirq = txx9dmac_suspend_noirq,
+	.resume_noirq = txx9dmac_resume_noirq,
+};
+
 static struct platform_driver txx9dmac_chan_driver = {
 	.remove		= __exit_p(txx9dmac_chan_remove),
 	.driver = {
@@ -1320,10 +1326,9 @@ static struct platform_driver txx9dmac_c
 static struct platform_driver txx9dmac_driver = {
 	.remove		= __exit_p(txx9dmac_remove),
 	.shutdown	= txx9dmac_shutdown,
-	.suspend_late	= txx9dmac_suspend_late,
-	.resume_early	= txx9dmac_resume_early,
 	.driver = {
 		.name	= "txx9dmac",
+		.pm	= &txx9dmac_dev_pm_ops,
 	},
 };
 

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

* [PATCH 04/07] i2c: rework i2c-pxa suspend_late()/resume_early()
  2009-06-05  7:54 [PATCH 00/07] pm: remove late/early platform driver pm callbacks Magnus Damm
                   ` (2 preceding siblings ...)
  2009-06-05  7:55 ` [PATCH 03/07] dma: rework txx9dmac suspend_late()/resume_early() Magnus Damm
@ 2009-06-05  7:55 ` Magnus Damm
  2009-06-05  7:55 ` [PATCH 05/07] i2c: rework i2c-s3c2410 suspend_late()/resume() Magnus Damm
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 13+ messages in thread
From: Magnus Damm @ 2009-06-05  7:55 UTC (permalink / raw)
  To: linux-pm
  Cc: pavel, hskinnemoen, anemo, gregkh, rjw, stern, ben-linux,
	felipe.balbi, linux-omap, Magnus Damm

From: Magnus Damm <damm@igel.co.jp>

This patch reworks platform driver power management code
for i2c-pxa from legacy late/early callbacks to dev_pm_ops.

The callbacks are converted for CONFIG_SUSPEND like this:
  suspend_late() -> suspend_noirq()
  resume_early() -> resume_noirq()

Signed-off-by: Magnus Damm <damm@igel.co.jp>
---

 Untested but compiles fine.

 drivers/i2c/busses/i2c-pxa.c |   25 +++++++++++++++++--------
 1 file changed, 17 insertions(+), 8 deletions(-)

--- 0001/drivers/i2c/busses/i2c-pxa.c
+++ work/drivers/i2c/busses/i2c-pxa.c	2009-06-01 15:26:06.000000000 +0900
@@ -1135,35 +1135,44 @@ static int __exit i2c_pxa_remove(struct 
 }
 
 #ifdef CONFIG_PM
-static int i2c_pxa_suspend_late(struct platform_device *dev, pm_message_t state)
+static int i2c_pxa_suspend_noirq(struct device *dev)
 {
-	struct pxa_i2c *i2c = platform_get_drvdata(dev);
+	struct platform_device *pdev = to_platform_device(dev);
+	struct pxa_i2c *i2c = platform_get_drvdata(pdev);
+
 	clk_disable(i2c->clk);
+
 	return 0;
 }
 
-static int i2c_pxa_resume_early(struct platform_device *dev)
+static int i2c_pxa_resume_noirq(struct device *dev)
 {
-	struct pxa_i2c *i2c = platform_get_drvdata(dev);
+	struct platform_device *pdev = to_platform_device(dev);
+	struct pxa_i2c *i2c = platform_get_drvdata(pdev);
 
 	clk_enable(i2c->clk);
 	i2c_pxa_reset(i2c);
 
 	return 0;
 }
+
+static struct dev_pm_ops i2c_pxa_dev_pm_ops = {
+	.suspend_noirq = i2c_pxa_suspend_noirq,
+	.resume_noirq = i2c_pxa_resume_noirq,
+};
+
+#define I2C_PXA_DEV_PM_OPS (&i2c_pxa_dev_pm_ops)
 #else
-#define i2c_pxa_suspend_late NULL
-#define i2c_pxa_resume_early NULL
+#define I2C_PXA_DEV_PM_OPS NULL
 #endif
 
 static struct platform_driver i2c_pxa_driver = {
 	.probe		= i2c_pxa_probe,
 	.remove		= __exit_p(i2c_pxa_remove),
-	.suspend_late	= i2c_pxa_suspend_late,
-	.resume_early	= i2c_pxa_resume_early,
 	.driver		= {
 		.name	= "pxa2xx-i2c",
 		.owner	= THIS_MODULE,
+		.pm	= I2C_PXA_DEV_PM_OPS,
 	},
 	.id_table	= i2c_pxa_id_table,
 };

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

* [PATCH 05/07] i2c: rework i2c-s3c2410 suspend_late()/resume()
  2009-06-05  7:54 [PATCH 00/07] pm: remove late/early platform driver pm callbacks Magnus Damm
                   ` (3 preceding siblings ...)
  2009-06-05  7:55 ` [PATCH 04/07] i2c: rework i2c-pxa suspend_late()/resume_early() Magnus Damm
@ 2009-06-05  7:55 ` Magnus Damm
  2009-06-05  7:55 ` [PATCH 06/07] usb: rework musb suspend()/resume_early() Magnus Damm
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 13+ messages in thread
From: Magnus Damm @ 2009-06-05  7:55 UTC (permalink / raw)
  To: linux-pm
  Cc: ben-linux, hskinnemoen, anemo, gregkh, rjw, stern, pavel,
	felipe.balbi, linux-omap, Magnus Damm

From: Magnus Damm <damm@igel.co.jp>

This patch reworks platform driver power management code
for i2c-s3c2410 from legacy callbacks to dev_pm_ops.

The callbacks are converted for CONFIG_SUSPEND like this:
  suspend_late() -> suspend_noirq()
  resume() -> resume()

Signed-off-by: Magnus Damm <damm@igel.co.jp>
---

 Untested but compiles fine.

 drivers/i2c/busses/i2c-s3c2410.c |   28 +++++++++++++++++-----------
 1 file changed, 17 insertions(+), 11 deletions(-)

--- 0001/drivers/i2c/busses/i2c-s3c2410.c
+++ work/drivers/i2c/busses/i2c-s3c2410.c	2009-06-01 15:26:38.000000000 +0900
@@ -944,17 +944,20 @@ static int s3c24xx_i2c_remove(struct pla
 }
 
 #ifdef CONFIG_PM
-static int s3c24xx_i2c_suspend_late(struct platform_device *dev,
-				    pm_message_t msg)
+static int s3c24xx_i2c_suspend_noirq(struct device *dev)
 {
-	struct s3c24xx_i2c *i2c = platform_get_drvdata(dev);
+	struct platform_device *pdev = to_platform_device(dev);
+	struct s3c24xx_i2c *i2c = platform_get_drvdata(pdev);
+
 	i2c->suspended = 1;
+
 	return 0;
 }
 
-static int s3c24xx_i2c_resume(struct platform_device *dev)
+static int s3c24xx_i2c_resume(struct device *dev)
 {
-	struct s3c24xx_i2c *i2c = platform_get_drvdata(dev);
+	struct platform_device *pdev = to_platform_device(dev);
+	struct s3c24xx_i2c *i2c = platform_get_drvdata(pdev);
 
 	i2c->suspended = 0;
 	s3c24xx_i2c_init(i2c);
@@ -962,9 +965,14 @@ static int s3c24xx_i2c_resume(struct pla
 	return 0;
 }
 
+static struct dev_pm_ops s3c24xx_i2c_dev_pm_ops = {
+	.suspend_noirq = s3c24xx_i2c_suspend_noirq,
+	.resume = s3c24xx_i2c_resume,
+};
+
+#define S3C24XX_DEV_PM_OPS (&s3c24xx_i2c_dev_pm_ops)
 #else
-#define s3c24xx_i2c_suspend_late NULL
-#define s3c24xx_i2c_resume NULL
+#define S3C24XX_DEV_PM_OPS NULL
 #endif
 
 /* device driver for platform bus bits */
@@ -972,22 +980,20 @@ static int s3c24xx_i2c_resume(struct pla
 static struct platform_driver s3c2410_i2c_driver = {
 	.probe		= s3c24xx_i2c_probe,
 	.remove		= s3c24xx_i2c_remove,
-	.suspend_late	= s3c24xx_i2c_suspend_late,
-	.resume		= s3c24xx_i2c_resume,
 	.driver		= {
 		.owner	= THIS_MODULE,
 		.name	= "s3c2410-i2c",
+		.pm	= S3C24XX_DEV_PM_OPS,
 	},
 };
 
 static struct platform_driver s3c2440_i2c_driver = {
 	.probe		= s3c24xx_i2c_probe,
 	.remove		= s3c24xx_i2c_remove,
-	.suspend_late	= s3c24xx_i2c_suspend_late,
-	.resume		= s3c24xx_i2c_resume,
 	.driver		= {
 		.owner	= THIS_MODULE,
 		.name	= "s3c2440-i2c",
+		.pm	= S3C24XX_DEV_PM_OPS,
 	},
 };
 

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

* [PATCH 06/07] usb: rework musb suspend()/resume_early()
  2009-06-05  7:54 [PATCH 00/07] pm: remove late/early platform driver pm callbacks Magnus Damm
                   ` (4 preceding siblings ...)
  2009-06-05  7:55 ` [PATCH 05/07] i2c: rework i2c-s3c2410 suspend_late()/resume() Magnus Damm
@ 2009-06-05  7:55 ` Magnus Damm
  2009-06-05  7:55 ` [PATCH 07/07] pm: remove platform device suspend_late()/resume_early() Magnus Damm
  2009-06-05 19:10 ` [PATCH 00/07] pm: remove late/early platform driver pm callbacks Rafael J. Wysocki
  7 siblings, 0 replies; 13+ messages in thread
From: Magnus Damm @ 2009-06-05  7:55 UTC (permalink / raw)
  To: linux-pm
  Cc: pavel, hskinnemoen, anemo, gregkh, rjw, stern, ben-linux,
	felipe.balbi, linux-omap, Magnus Damm

From: Magnus Damm <damm@igel.co.jp>

This patch reworks platform driver power management code
for musb from legacy callbacks to dev_pm_ops.

The callbacks are converted for CONFIG_SUSPEND like this:
  suspend() -> suspend()
  resume_early() -> resume_noirq()

Signed-off-by: Magnus Damm <damm@igel.co.jp>
---

 Untested but compiles fine.

 drivers/i2c/busses/i2c-pxa.c |   25 +++++++++++++++++--------
 1 file changed, 17 insertions(+), 8 deletions(-)

--- 0001/drivers/usb/musb/musb_core.c
+++ work/drivers/usb/musb/musb_core.c	2009-06-01 15:27:12.000000000 +0900
@@ -2168,8 +2168,9 @@ static int __devexit musb_remove(struct 
 
 #ifdef	CONFIG_PM
 
-static int musb_suspend(struct platform_device *pdev, pm_message_t message)
+static int musb_suspend(struct device *dev)
 {
+	struct platform_device *pdev = to_platform_device(dev);
 	unsigned long	flags;
 	struct musb	*musb = dev_to_musb(&pdev->dev);
 
@@ -2196,8 +2197,9 @@ static int musb_suspend(struct platform_
 	return 0;
 }
 
-static int musb_resume_early(struct platform_device *pdev)
+static int musb_resume_noirq(struct device *dev)
 {
+	struct platform_device *pdev = to_platform_device(dev);
 	struct musb	*musb = dev_to_musb(&pdev->dev);
 
 	if (!musb->clock)
@@ -2215,9 +2217,14 @@ static int musb_resume_early(struct plat
 	return 0;
 }
 
+static struct dev_pm_ops musb_dev_pm_ops = {
+	.suspend	= musb_suspend,
+	.resume_noirq	= musb_resume_noirq,
+};
+
+#define MUSB_DEV_PM_OPS (&musb_dev_pm_ops)
 #else
-#define	musb_suspend	NULL
-#define	musb_resume_early	NULL
+#define	MUSB_DEV_PM_OPS	NULL
 #endif
 
 static struct platform_driver musb_driver = {
@@ -2225,11 +2232,10 @@ static struct platform_driver musb_drive
 		.name		= (char *)musb_driver_name,
 		.bus		= &platform_bus_type,
 		.owner		= THIS_MODULE,
+		.pm		= MUSB_DEV_PM_OPS,
 	},
 	.remove		= __devexit_p(musb_remove),
 	.shutdown	= musb_shutdown,
-	.suspend	= musb_suspend,
-	.resume_early	= musb_resume_early,
 };
 
 /*-------------------------------------------------------------------------*/

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

* [PATCH 07/07] pm: remove platform device suspend_late()/resume_early()
  2009-06-05  7:54 [PATCH 00/07] pm: remove late/early platform driver pm callbacks Magnus Damm
                   ` (5 preceding siblings ...)
  2009-06-05  7:55 ` [PATCH 06/07] usb: rework musb suspend()/resume_early() Magnus Damm
@ 2009-06-05  7:55 ` Magnus Damm
  2009-06-05 19:10 ` [PATCH 00/07] pm: remove late/early platform driver pm callbacks Rafael J. Wysocki
  7 siblings, 0 replies; 13+ messages in thread
From: Magnus Damm @ 2009-06-05  7:55 UTC (permalink / raw)
  To: linux-pm
  Cc: ben-linux, hskinnemoen, anemo, gregkh, rjw, stern, pavel,
	felipe.balbi, linux-omap, Magnus Damm

From: Magnus Damm <damm@igel.co.jp>

This patch removes the legacy platform driver power management
callbacks ->suspend_late() and ->resume_early() since all in-tree
users have been migrated to dev_pm_ops.

Signed-off-by: Magnus Damm <damm@igel.co.jp>
---

 Untested but compiles fine.

 drivers/base/platform.c         |   36 ------------------------------------
 include/linux/platform_device.h |    2 --
 2 files changed, 38 deletions(-)

--- 0001/drivers/base/platform.c
+++ work/drivers/base/platform.c	2009-06-01 15:27:57.000000000 +0900
@@ -642,30 +642,6 @@ static int platform_legacy_suspend(struc
 	return ret;
 }
 
-static int platform_legacy_suspend_late(struct device *dev, pm_message_t mesg)
-{
-	struct platform_driver *pdrv = to_platform_driver(dev->driver);
-	struct platform_device *pdev = to_platform_device(dev);
-	int ret = 0;
-
-	if (dev->driver && pdrv->suspend_late)
-		ret = pdrv->suspend_late(pdev, mesg);
-
-	return ret;
-}
-
-static int platform_legacy_resume_early(struct device *dev)
-{
-	struct platform_driver *pdrv = to_platform_driver(dev->driver);
-	struct platform_device *pdev = to_platform_device(dev);
-	int ret = 0;
-
-	if (dev->driver && pdrv->resume_early)
-		ret = pdrv->resume_early(pdev);
-
-	return ret;
-}
-
 static int platform_legacy_resume(struct device *dev)
 {
 	int ret = 0;
@@ -726,8 +702,6 @@ static int platform_pm_suspend_noirq(str
 	if (drv->pm) {
 		if (drv->pm->suspend_noirq)
 			ret = drv->pm->suspend_noirq(dev);
-	} else {
-		ret = platform_legacy_suspend_late(dev, PMSG_SUSPEND);
 	}
 
 	return ret;
@@ -762,8 +736,6 @@ static int platform_pm_resume_noirq(stru
 	if (drv->pm) {
 		if (drv->pm->resume_noirq)
 			ret = drv->pm->resume_noirq(dev);
-	} else {
-		ret = platform_legacy_resume_early(dev);
 	}
 
 	return ret;
@@ -809,8 +781,6 @@ static int platform_pm_freeze_noirq(stru
 	if (drv->pm) {
 		if (drv->pm->freeze_noirq)
 			ret = drv->pm->freeze_noirq(dev);
-	} else {
-		ret = platform_legacy_suspend_late(dev, PMSG_FREEZE);
 	}
 
 	return ret;
@@ -845,8 +815,6 @@ static int platform_pm_thaw_noirq(struct
 	if (drv->pm) {
 		if (drv->pm->thaw_noirq)
 			ret = drv->pm->thaw_noirq(dev);
-	} else {
-		ret = platform_legacy_resume_early(dev);
 	}
 
 	return ret;
@@ -881,8 +849,6 @@ static int platform_pm_poweroff_noirq(st
 	if (drv->pm) {
 		if (drv->pm->poweroff_noirq)
 			ret = drv->pm->poweroff_noirq(dev);
-	} else {
-		ret = platform_legacy_suspend_late(dev, PMSG_HIBERNATE);
 	}
 
 	return ret;
@@ -917,8 +883,6 @@ static int platform_pm_restore_noirq(str
 	if (drv->pm) {
 		if (drv->pm->restore_noirq)
 			ret = drv->pm->restore_noirq(dev);
-	} else {
-		ret = platform_legacy_resume_early(dev);
 	}
 
 	return ret;
--- 0002/include/linux/platform_device.h
+++ work/include/linux/platform_device.h	2009-06-01 15:27:57.000000000 +0900
@@ -60,8 +60,6 @@ struct platform_driver {
 	int (*remove)(struct platform_device *);
 	void (*shutdown)(struct platform_device *);
 	int (*suspend)(struct platform_device *, pm_message_t state);
-	int (*suspend_late)(struct platform_device *, pm_message_t state);
-	int (*resume_early)(struct platform_device *);
 	int (*resume)(struct platform_device *);
 	struct device_driver driver;
 	struct platform_device_id *id_table;

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

* Re: [PATCH 02/07] dma: rework dw_dmac suspend_late()/resume_early()
  2009-06-05  7:54 ` [PATCH 02/07] dma: rework dw_dmac suspend_late()/resume_early() Magnus Damm
@ 2009-06-05  8:18   ` Haavard Skinnemoen
  2009-06-05  8:34     ` Magnus Damm
  0 siblings, 1 reply; 13+ messages in thread
From: Haavard Skinnemoen @ 2009-06-05  8:18 UTC (permalink / raw)
  Cc: linux-pm, pavel, anemo, gregkh, rjw, stern, ben-linux,
	felipe.balbi, linux-omap, Magnus Damm

Magnus Damm wrote:
> +static struct dev_pm_ops dw_dev_pm_ops = {
> +	.suspend_noirq = dw_suspend_noirq,
> +	.resume_noirq = dw_resume_noirq,
> +};

Can this be const?

Haavard

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

* Re: [PATCH 02/07] dma: rework dw_dmac suspend_late()/resume_early()
  2009-06-05  8:18   ` Haavard Skinnemoen
@ 2009-06-05  8:34     ` Magnus Damm
  2009-06-05  8:45       ` Haavard Skinnemoen
  0 siblings, 1 reply; 13+ messages in thread
From: Magnus Damm @ 2009-06-05  8:34 UTC (permalink / raw)
  To: Haavard Skinnemoen
  Cc: linux-pm, pavel, anemo, gregkh, rjw, stern, ben-linux,
	felipe.balbi, linux-omap

On Fri, Jun 5, 2009 at 5:18 PM, Haavard
Skinnemoen<haavard.skinnemoen@atmel.com> wrote:
> Magnus Damm wrote:
>> +static struct dev_pm_ops dw_dev_pm_ops = {
>> +     .suspend_noirq = dw_suspend_noirq,
>> +     .resume_noirq = dw_resume_noirq,
>> +};
>
> Can this be const?

Hm, adding const generates a warning for me. At on SuperH with
gcc-4.3.3 (Sourcery G++ Lite 4.3-143):

[modified dev_pm_ops to const in sh_keysc.c]

  CC      drivers/input/keyboard/sh_keysc.o
drivers/input/keyboard/sh_keysc.c:299: warning: initialization
discards qualifiers from pointer target type

/ magnus
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH 02/07] dma: rework dw_dmac suspend_late()/resume_early()
  2009-06-05  8:34     ` Magnus Damm
@ 2009-06-05  8:45       ` Haavard Skinnemoen
  0 siblings, 0 replies; 13+ messages in thread
From: Haavard Skinnemoen @ 2009-06-05  8:45 UTC (permalink / raw)
  To: Magnus Damm
  Cc: linux-pm, pavel, anemo, gregkh, rjw, stern, ben-linux,
	felipe.balbi, linux-omap

Magnus Damm wrote:
> On Fri, Jun 5, 2009 at 5:18 PM, Haavard
> Skinnemoen<haavard.skinnemoen@atmel.com> wrote:
> > Magnus Damm wrote:
> >> +static struct dev_pm_ops dw_dev_pm_ops = {
> >> +     .suspend_noirq = dw_suspend_noirq,
> >> +     .resume_noirq = dw_resume_noirq,
> >> +};
> >
> > Can this be const?
> 
> Hm, adding const generates a warning for me. At on SuperH with
> gcc-4.3.3 (Sourcery G++ Lite 4.3-143):
> 
> [modified dev_pm_ops to const in sh_keysc.c]
> 
>   CC      drivers/input/keyboard/sh_keysc.o
> drivers/input/keyboard/sh_keysc.c:299: warning: initialization
> discards qualifiers from pointer target type

Ok, it looks like the .pm field in struct device_driver is not const.
Changing that will introduce lots of warnings elsewhere, so it's
probably better to leave it alone.

So I guess the answer is no, it can't be const.

Haavard
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH 00/07] pm: remove late/early platform driver pm callbacks
  2009-06-05  7:54 [PATCH 00/07] pm: remove late/early platform driver pm callbacks Magnus Damm
                   ` (6 preceding siblings ...)
  2009-06-05  7:55 ` [PATCH 07/07] pm: remove platform device suspend_late()/resume_early() Magnus Damm
@ 2009-06-05 19:10 ` Rafael J. Wysocki
  7 siblings, 0 replies; 13+ messages in thread
From: Rafael J. Wysocki @ 2009-06-05 19:10 UTC (permalink / raw)
  To: Magnus Damm
  Cc: linux-pm, pavel, hskinnemoen, anemo, gregkh, stern, ben-linux,
	felipe.balbi, linux-omap

On Friday 05 June 2009, Magnus Damm wrote:
> pm: remove late/early platform driver pm callbacks
> 
> [PATCH 01/07] arm: rework omap suspend_late()/resume_early()
> [PATCH 02/07] dma: rework dw_dmac suspend_late()/resume_early()
> [PATCH 03/07] dma: rework txx9dmac suspend_late()/resume_early()
> [PATCH 04/07] i2c: rework i2c-pxa suspend_late()/resume_early()
> [PATCH 05/07] i2c: rework i2c-s3c2410 suspend_late()/resume()
> [PATCH 06/07] usb: rework musb suspend()/resume_early()
> [PATCH 07/07] pm: remove platform device suspend_late()/resume_early()
> 
> These patches simply remove ->suspend_late() and ->resume_early()
> from struct platform_driver. Drivers are converted to dev_pm_ops
> with CONFIG_SUSPEND in mind. Untested.
> 
> All patches except [02/07] are known to compile.

I think the last patch will need to be rebased on top of linux-next, but rather
trivially.

I like the series, but I think it needs some more exposure.

Care to repost with a CC to the LKML and usb-devel?

Best,
Rafael


> Signed-off-by: Magnus Damm <damm@igel.co.jp>
> ---
> 
>  arch/arm/plat-omap/debug-leds.c  |   11 +++++++----
>  arch/arm/plat-omap/gpio.c        |   14 ++++++++++----
>  drivers/base/platform.c          |   36 ------------------------------------
>  drivers/dma/dw_dmac.c            |   15 ++++++++++-----
>  drivers/dma/txx9dmac.c           |   15 ++++++++++-----
>  drivers/i2c/busses/i2c-pxa.c     |   25 +++++++++++++++++--------
>  drivers/i2c/busses/i2c-s3c2410.c |   28 +++++++++++++++++-----------
>  drivers/usb/musb/musb_core.c     |   18 ++++++++++++------
>  include/linux/platform_device.h  |    2 --
>  9 files changed, 83 insertions(+), 81 deletions(-)

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

* [PATCH 01/07] arm: rework omap suspend_late()/resume_early()
  2009-06-24  9:23 [PATCH 00/07] pm: remove late/early platform driver pm callbacks V2 Magnus Damm
@ 2009-06-24  9:23 ` Magnus Damm
  0 siblings, 0 replies; 13+ messages in thread
From: Magnus Damm @ 2009-06-24  9:23 UTC (permalink / raw)
  To: linux-kernel
  Cc: gregkh, hskinnemoen, anemo, linux-usb, ben-linux, linux-pm,
	linux-omap, akpm, felipe.balbi

From: Magnus Damm <damm@igel.co.jp>

This patch reworks platform driver power management code
for omap drivers using late/early legacy callbacks.

The callbacks are converted for CONFIG_SUSPEND like this:
  suspend_late() -> suspend_noirq()
  resume_early() -> resume_noirq()

Signed-off-by: Magnus Damm <damm@igel.co.jp>
---

 Untested but compiles just fine.

 arch/arm/plat-omap/debug-leds.c |   11 +++++++----
 arch/arm/plat-omap/gpio.c       |   14 ++++++++++----
 2 files changed, 17 insertions(+), 8 deletions(-)

--- 0001/arch/arm/plat-omap/debug-leds.c
+++ work/arch/arm/plat-omap/debug-leds.c	2009-06-01 15:50:21.000000000 +0900
@@ -281,24 +281,27 @@ static int /* __init */ fpga_probe(struc
 	return 0;
 }
 
-static int fpga_suspend_late(struct platform_device *pdev, pm_message_t mesg)
+static int fpga_suspend_noirq(struct device *dev)
 {
 	__raw_writew(~0, &fpga->leds);
 	return 0;
 }
 
-static int fpga_resume_early(struct platform_device *pdev)
+static int fpga_resume_noirq(struct device *dev)
 {
 	__raw_writew(~hw_led_state, &fpga->leds);
 	return 0;
 }
 
+static struct dev_pm_ops fpga_dev_pm_ops = {
+	.suspend_noirq = fpga_suspend_noirq,
+	.resume_noirq = fpga_resume_noirq,
+};
 
 static struct platform_driver led_driver = {
 	.driver.name	= "omap_dbg_led",
+	.driver.pm	= &fpga_dev_pm_ops,
 	.probe		= fpga_probe,
-	.suspend_late	= fpga_suspend_late,
-	.resume_early	= fpga_resume_early,
 };
 
 static int __init fpga_init(void)
--- 0001/arch/arm/plat-omap/gpio.c
+++ work/arch/arm/plat-omap/gpio.c	2009-06-01 16:30:56.000000000 +0900
@@ -1264,8 +1264,9 @@ static struct irq_chip mpuio_irq_chip = 
 
 #include <linux/platform_device.h>
 
-static int omap_mpuio_suspend_late(struct platform_device *pdev, pm_message_t mesg)
+static int omap_mpuio_suspend_noirq(struct device *dev)
 {
+	struct platform_device *pdev = to_platform_device(dev);
 	struct gpio_bank	*bank = platform_get_drvdata(pdev);
 	void __iomem		*mask_reg = bank->base + OMAP_MPUIO_GPIO_MASKIT;
 	unsigned long		flags;
@@ -1278,8 +1279,9 @@ static int omap_mpuio_suspend_late(struc
 	return 0;
 }
 
-static int omap_mpuio_resume_early(struct platform_device *pdev)
+static int omap_mpuio_resume_noirq(struct device *dev)
 {
+	struct platform_device *pdev = to_platform_device(dev);
 	struct gpio_bank	*bank = platform_get_drvdata(pdev);
 	void __iomem		*mask_reg = bank->base + OMAP_MPUIO_GPIO_MASKIT;
 	unsigned long		flags;
@@ -1291,14 +1293,18 @@ static int omap_mpuio_resume_early(struc
 	return 0;
 }
 
+static struct dev_pm_ops omap_mpuio_dev_pm_ops = {
+	.suspend_noirq = omap_mpuio_suspend_noirq,
+	.resume_noirq = omap_mpuio_resume_noirq,
+};
+
 /* use platform_driver for this, now that there's no longer any
  * point to sys_device (other than not disturbing old code).
  */
 static struct platform_driver omap_mpuio_driver = {
-	.suspend_late	= omap_mpuio_suspend_late,
-	.resume_early	= omap_mpuio_resume_early,
 	.driver		= {
 		.name	= "mpuio",
+		.pm	= &omap_mpuio_dev_pm_ops,
 	},
 };
 

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

end of thread, other threads:[~2009-06-24  9:23 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-06-05  7:54 [PATCH 00/07] pm: remove late/early platform driver pm callbacks Magnus Damm
2009-06-05  7:54 ` [PATCH 01/07] arm: rework omap suspend_late()/resume_early() Magnus Damm
2009-06-05  7:54 ` [PATCH 02/07] dma: rework dw_dmac suspend_late()/resume_early() Magnus Damm
2009-06-05  8:18   ` Haavard Skinnemoen
2009-06-05  8:34     ` Magnus Damm
2009-06-05  8:45       ` Haavard Skinnemoen
2009-06-05  7:55 ` [PATCH 03/07] dma: rework txx9dmac suspend_late()/resume_early() Magnus Damm
2009-06-05  7:55 ` [PATCH 04/07] i2c: rework i2c-pxa suspend_late()/resume_early() Magnus Damm
2009-06-05  7:55 ` [PATCH 05/07] i2c: rework i2c-s3c2410 suspend_late()/resume() Magnus Damm
2009-06-05  7:55 ` [PATCH 06/07] usb: rework musb suspend()/resume_early() Magnus Damm
2009-06-05  7:55 ` [PATCH 07/07] pm: remove platform device suspend_late()/resume_early() Magnus Damm
2009-06-05 19:10 ` [PATCH 00/07] pm: remove late/early platform driver pm callbacks Rafael J. Wysocki
  -- strict thread matches above, loose matches on Subject: below --
2009-06-24  9:23 [PATCH 00/07] pm: remove late/early platform driver pm callbacks V2 Magnus Damm
2009-06-24  9:23 ` [PATCH 01/07] arm: rework omap suspend_late()/resume_early() Magnus Damm

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox