Skip to contentSkip to conversation

ds2760: switch to new dev_pm_ops

PATCH In review Daniel Mack 3 participants 5 messages Aug 5, 2009

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 ds2760: switch to new dev_pm_ops

Cc Szabolcs Gyurko <[email protected]>
Cc Matt Reimer <[email protected]>
Cc Anton Vorontsov <[email protected]>
---
 drivers/power/ds2760_battery.c |   25 ++++++++++++++-----------
 1 files changed, 14 insertions(+), 11 deletions(-)
drivers/power/ds2760_battery.c +14 -11
index ca43b1c..ad2d615 100644
@@ -557,19 +557,18 @@ static int ds2760_battery_remove(struct platform_device *pdev)
 
 #ifdef CONFIG_PM
 
-static int ds2760_battery_suspend(struct platform_device *pdev,
-				  pm_message_t state)
+static int ds2760_battery_suspend(struct device *dev)
 {
-	struct ds2760_device_info *di = platform_get_drvdata(pdev);
+	struct ds2760_device_info *di = dev_get_drvdata(dev);
 
 	di->charge_status = POWER_SUPPLY_STATUS_UNKNOWN;
 
 	return 0;
 }
 
-static int ds2760_battery_resume(struct platform_device *pdev)
+static int ds2760_battery_resume(struct device *dev)
 {
-	struct ds2760_device_info *di = platform_get_drvdata(pdev);
+	struct ds2760_device_info *di = dev_get_drvdata(dev);
 
 	di->charge_status = POWER_SUPPLY_STATUS_UNKNOWN;
 	power_supply_changed(&di->bat);
@@ -580,23 +579,27 @@ static int ds2760_battery_resume(struct platform_device *pdev)
 	return 0;
 }
 
-#else
+static struct dev_pm_ops ds2760_battery_pm_ops = {
+	.suspend        = ds2760_battery_suspend,
+	.resume         = ds2760_battery_resume,
+};
 
-#define ds2760_battery_suspend NULL
-#define ds2760_battery_resume NULL
+#define DS2760_PM_OPS (&ds2760_battery_pm_ops)
 
+#else
+#define DS2760_PM_OPS NULL
 #endif /* CONFIG_PM */
 
 MODULE_ALIAS("platform:ds2760-battery");
 
 static struct platform_driver ds2760_battery_driver = {
 	.driver = {
-		.name = "ds2760-battery",
+		.owner	= THIS_MODULE,
+		.name	= "ds2760-battery",
+		.pm	= DS2760_PM_OPS,
 	},
 	.probe	  = ds2760_battery_probe,
 	.remove   = ds2760_battery_remove,
-	.suspend  = ds2760_battery_suspend,
-	.resume	  = ds2760_battery_resume,
 };
 
 static int __init ds2760_battery_init(void)
Signature · 1 line
1.6.3.3
#1 lore raw

drivers/power/ds2760_battery.c static int ds2760_battery_resume(struct platform_device *pdev) · line 585

Quoted 4 lines · Daniel Mack
drivers/power/ds2760_battery.c +4 -0
+static struct dev_pm_ops ds2760_battery_pm_ops = {
+       .suspend        = ds2760_battery_suspend,
+       .resume         = ds2760_battery_resume,
+};

Just to make sure...

Have you followed the earlier discussions on dev_pm_ops conversions and are you aware that if done like this the driver no longer supports hibernation?

If omitting hibernation is intentional, it should probably be justified in the commit log.

See http://lkml.org/lkml/2009/7/25/118 for background.

Same goes for your patch for w1_gpio of course.

Cheers,
FJP

#2 lore raw
Quoted 12 lines · Frans Pop

drivers/power/ds2760_battery.c static int ds2760_battery_resume(struct platform_device *pdev) · line 585

Quoted 4 lines · Daniel Mack
drivers/power/ds2760_battery.c +4 -0
+static struct dev_pm_ops ds2760_battery_pm_ops = {
+       .suspend        = ds2760_battery_suspend,
+       .resume         = ds2760_battery_resume,
+};

Just to make sure...

Have you followed the earlier discussions on dev_pm_ops conversions and are you aware that if done like this the driver no longer supports hibernation?

Quoted 6 lines

If omitting hibernation is intentional, it should probably be justified in the commit log.

See http://lkml.org/lkml/2009/7/25/118 for background.

Same goes for your patch for w1_gpio of course.

Frans, thanks for your vigilance. :-)

Daniel and everyone doing dev_pm_ops conversions or any other PM-related things, please CC your patches to [email protected] .

Best,
Rafael

#3 lore raw
In reply to Frans Pop
Quoted 12 lines · Frans Pop

drivers/power/ds2760_battery.c static int ds2760_battery_resume(struct platform_device *pdev) · line 585

Quoted 4 lines · Daniel Mack
drivers/power/ds2760_battery.c +4 -0
+static struct dev_pm_ops ds2760_battery_pm_ops = {
+       .suspend        = ds2760_battery_suspend,
+       .resume         = ds2760_battery_resume,
+};

Just to make sure...

Have you followed the earlier discussions on dev_pm_ops conversions and are you aware that if done like this the driver no longer supports hibernation?

Quoted 6 lines

If omitting hibernation is intentional, it should probably be justified in the commit log.

See http://lkml.org/lkml/2009/7/25/118 for background.

Same goes for your patch for w1_gpio of course.

Frans, thanks for your vigilance. :-)

Daniel and everyone doing dev_pm_ops conversions or any other PM-related things, please CC your patches to [email protected] .

Best,
Rafael

#4 lore raw
In reply to Frans Pop
Quoted 8 lines · Frans Pop

drivers/power/ds2760_battery.c static int ds2760_battery_resume(struct platform_device *pdev) · line 585

Quoted 4 lines · Daniel Mack
drivers/power/ds2760_battery.c +4 -0
+static struct dev_pm_ops ds2760_battery_pm_ops = {
+       .suspend        = ds2760_battery_suspend,
+       .resume         = ds2760_battery_resume,
+};

Just to make sure...

Quoted 8 lines

Have you followed the earlier discussions on dev_pm_ops conversions and are you aware that if done like this the driver no longer supports hibernation?

If omitting hibernation is intentional, it should probably be justified in the commit log.

See http://lkml.org/lkml/2009/7/25/118 for background.

Hmm, I tested that on a embedded hardware platform which doesn't supoprt hibernation anyway. But you're right, to prevent regressions, .freeze and .thaw should probably be given as well.

I'll fix that and resend.

Thanks,
Daniel