aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars-Peter Clausen <lars@metafoo.de>2009-12-15 18:22:18 +0100
committerLars-Peter Clausen <lars@metafoo.de>2009-12-21 17:17:40 +0100
commitdc90a4e8ecb13b51487c6a3e5a4f9866bf5641ad (patch)
tree274a2e02203f52f7e2ee24ee83dac7e84b099136
parentf1929d0afdb9423115674520752fcd75bbdb4407 (diff)
Use dev_pm_ops
-rw-r--r--arch/arm/mach-s3c2442/gta02-pm-gps.c21
-rw-r--r--arch/arm/mach-s3c2442/gta02-pm-gsm.c27
2 files changed, 28 insertions, 20 deletions
diff --git a/arch/arm/mach-s3c2442/gta02-pm-gps.c b/arch/arm/mach-s3c2442/gta02-pm-gps.c
index 02be4cec851..2b71b7e4811 100644
--- a/arch/arm/mach-s3c2442/gta02-pm-gps.c
+++ b/arch/arm/mach-s3c2442/gta02-pm-gps.c
@@ -126,19 +126,18 @@ static ssize_t power_gps_write(struct device *dev,
}
#ifdef CONFIG_PM
-static int gta02_pm_gps_suspend(struct platform_device *pdev,
- pm_message_t state)
+static int gta02_pm_gps_suspend(struct device *dev)
{
if (!gta02_gps.keep_on_in_suspend ||
!gta02_gps.power_was_on)
gps_pwron_set(0);
else
- dev_warn(&pdev->dev, "GTA02: keeping gps ON "
+ dev_warn(dev, "GTA02: keeping gps ON "
"during suspend\n");
return 0;
}
-static int gta02_pm_gps_resume(struct platform_device *pdev)
+static int gta02_pm_gps_resume(struct device *dev)
{
if (!gta02_gps.keep_on_in_suspend && gta02_gps.power_was_on)
gps_pwron_set(1);
@@ -147,9 +146,16 @@ static int gta02_pm_gps_resume(struct platform_device *pdev)
}
static DEVICE_ATTR(keep_on_in_suspend, 0644, power_gps_read, power_gps_write);
+
+static struct dev_pm_ops gta02_gps_pm_ops = {
+ .suspend = gta02_pm_gps_suspend,
+ .resume = gta02_pm_gps_resume,
+};
+
+#define GTA02_GPS_PM_OPS (&gta02_gps_pm_ops)
+
#else
-#define gta02_pm_gps_suspend NULL
-#define gta02_pm_gps_resume NULL
+#define GTA02_GPS_PM_OPS NULL
#endif
static DEVICE_ATTR(power_on, 0644, power_gps_read, power_gps_write);
@@ -218,10 +224,9 @@ static int gta02_pm_gps_remove(struct platform_device *pdev)
static struct platform_driver gta02_pm_gps_driver = {
.probe = gta02_pm_gps_probe,
.remove = gta02_pm_gps_remove,
- .suspend = gta02_pm_gps_suspend,
- .resume = gta02_pm_gps_resume,
.driver = {
.name = "gta02-pm-gps",
+ .pm = GTA02_GPS_PM_OPS,
},
};
diff --git a/arch/arm/mach-s3c2442/gta02-pm-gsm.c b/arch/arm/mach-s3c2442/gta02-pm-gsm.c
index bef8468dafe..4b6cad806fe 100644
--- a/arch/arm/mach-s3c2442/gta02-pm-gsm.c
+++ b/arch/arm/mach-s3c2442/gta02-pm-gsm.c
@@ -184,8 +184,7 @@ static DEVICE_ATTR(flowcontrolled, 0644, gsm_read, gsm_write);
#ifdef CONFIG_PM
-static int gta02_gsm_resume(struct platform_device *pdev);
-static int gta02_gsm_suspend(struct platform_device *pdev, pm_message_t state)
+static int gta02_gsm_suspend(struct device *dev)
{
/* GPIO state is saved/restored by S3C2410 core GPIO driver, so we
* don't need to do much here. */
@@ -204,8 +203,7 @@ busy:
return -EBUSY;
}
-static int
-gta02_gsm_suspend_late(struct platform_device *pdev, pm_message_t state)
+static int gta02_gsm_suspend_late(struct device *dev)
{
/* Last chance: abort if GSM already interrupted */
if (s3c2410_gpio_getcfg(S3C2410_GPH(1)) == S3C2410_GPIO_OUTPUT) {
@@ -215,7 +213,7 @@ gta02_gsm_suspend_late(struct platform_device *pdev, pm_message_t state)
return 0;
}
-static int gta02_gsm_resume(struct platform_device *pdev)
+static int gta02_gsm_resume(struct device *dev)
{
/* GPIO state is saved/restored by S3C2410 core GPIO driver, so we
* don't need to do much here. */
@@ -229,10 +227,17 @@ static int gta02_gsm_resume(struct platform_device *pdev)
return 0;
}
+
+static struct dev_pm_ops gta02_gsm_pm_ops = {
+ .suspend = gta02_gsm_suspend,
+ .suspend_noirq = gta02_gsm_suspend_late,
+ .resume = gta02_gsm_resume,
+};
+
+#define GTA02_GSM_PM_OPS (&gta02_gsm_pm_ops)
+
#else
-#define gta02_gsm_suspend NULL
-#define gta02_gsm_suspend_late NULL
-#define gta02_gsm_resume NULL
+#define GTA02_GSM_PM_OPS NULL
#endif /* CONFIG_PM */
static struct attribute *gta02_gsm_sysfs_entries[] = {
@@ -275,11 +280,9 @@ static int gta02_gsm_remove(struct platform_device *pdev)
static struct platform_driver gta02_gsm_driver = {
.probe = gta02_gsm_probe,
.remove = gta02_gsm_remove,
- .suspend = gta02_gsm_suspend,
- .suspend_late = gta02_gsm_suspend_late,
- .resume = gta02_gsm_resume,
.driver = {
- .name = "gta02-pm-gsm",
+ .name = "gta02-pm-gsm",
+ .pm = GTA02_GSM_PM_OPS,
},
};