[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1362922449-27531-1-git-send-email-lars@metafoo.de>
Date: Sun, 10 Mar 2013 14:34:05 +0100
From: Lars-Peter Clausen <lars@...afoo.de>
To: Anton Vorontsov <cbou@...l.ru>,
David Woodhouse <dwmw2@...radead.org>
Cc: linux-kernel@...r.kernel.org, Lars-Peter Clausen <lars@...afoo.de>,
Evgeny Romanov <romanov@...rosoft.ru>
Subject: [PATCH 1/5] power: ds2782_battery: Use dev_pm_ops
Use dev_pm_ops instead of the deprecated legacy suspend/resume callbacks.
Cc: Evgeny Romanov <romanov@...rosoft.ru>
Signed-off-by: Lars-Peter Clausen <lars@...afoo.de>
---
drivers/power/ds2782_battery.c | 22 +++++++++++-----------
1 file changed, 11 insertions(+), 11 deletions(-)
diff --git a/drivers/power/ds2782_battery.c b/drivers/power/ds2782_battery.c
index e7301b3..4fdf700 100644
--- a/drivers/power/ds2782_battery.c
+++ b/drivers/power/ds2782_battery.c
@@ -332,31 +332,32 @@ static int ds278x_battery_remove(struct i2c_client *client)
return 0;
}
-#ifdef CONFIG_PM
+#ifdef CONFIG_PM_SLEEP
-static int ds278x_suspend(struct i2c_client *client,
- pm_message_t state)
+static int ds278x_suspend(struct device *dev)
{
+ struct i2c_client *client = to_i2c_client(dev);
struct ds278x_info *info = i2c_get_clientdata(client);
cancel_delayed_work(&info->bat_work);
return 0;
}
-static int ds278x_resume(struct i2c_client *client)
+static int ds278x_resume(struct device *dev)
{
+ struct i2c_client *client = to_i2c_client(dev);
struct ds278x_info *info = i2c_get_clientdata(client);
schedule_delayed_work(&info->bat_work, DS278x_DELAY);
return 0;
}
-#else
-
-#define ds278x_suspend NULL
-#define ds278x_resume NULL
+static SIMPLE_DEV_PM_OPS(ds278x_battery_pm_ops, ds278x_suspend, ds278x_resume);
+#define DS278X_BATTERY_PM_OPS (&ds278x_battery_pm_ops)
-#endif /* CONFIG_PM */
+#else
+#define DS278X_BATTERY_PM_OPS NULL
+#endif /* CONFIG_PM_SLEEP */
enum ds278x_num_id {
@@ -465,11 +466,10 @@ MODULE_DEVICE_TABLE(i2c, ds278x_id);
static struct i2c_driver ds278x_battery_driver = {
.driver = {
.name = "ds2782-battery",
+ .pm = DS278X_BATERY_PM_OPS,
},
.probe = ds278x_battery_probe,
.remove = ds278x_battery_remove,
- .suspend = ds278x_suspend,
- .resume = ds278x_resume,
.id_table = ds278x_id,
};
module_i2c_driver(ds278x_battery_driver);
--
1.8.0
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists