ARM: Rework omap suspend_late()/resume_early()
authorMagnus Damm <damm@igel.co.jp>
Wed, 8 Jul 2009 11:22:04 +0000 (13:22 +0200)
committerRafael J. Wysocki <rjw@sisk.pl>
Tue, 21 Jul 2009 22:28:38 +0000 (00:28 +0200)
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>
Acked-by: Greg Kroah-Hartman <gregkh@suse.de>
Acked-by: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
arch/arm/plat-omap/debug-leds.c
arch/arm/plat-omap/gpio.c

index be4eefda4767fa11f54177bb6ba8a3a1ed27d770..9395898dd49a38b5d0e517108580bf3cc0365f0b 100644 (file)
@@ -281,24 +281,27 @@ static int /* __init */ fpga_probe(struct platform_device *pdev)
        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)
index 26b387c1242393e9bd5450a6751d1ed9a2f3e54c..3d03337ad4227e10601767a4c4a6cf6ef8bb9f78 100644 (file)
@@ -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(struct platform_device *pdev, pm_message_t me
        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(struct platform_device *pdev)
        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,
        },
 };