1
0
Fork 0

ds2782_battery: Use dev_pm_ops

Use dev_pm_ops instead of the deprecated legacy suspend/resume callbacks.

Cc: Evgeny Romanov <romanov@neurosoft.ru>
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Anton Vorontsov <anton@enomsg.org>
wifi-calibration
Lars-Peter Clausen 2013-03-10 14:34:05 +01:00 committed by Anton Vorontsov
parent 075ed03ce6
commit cc6616f690
1 changed files with 11 additions and 12 deletions

View File

@ -332,32 +332,32 @@ static int ds278x_battery_remove(struct i2c_client *client)
return 0; return 0;
} }
#ifdef CONFIG_PM #ifdef CONFIG_PM_SLEEP
static int ds278x_suspend(struct i2c_client *client, static int ds278x_suspend(struct device *dev)
pm_message_t state)
{ {
struct i2c_client *client = to_i2c_client(dev);
struct ds278x_info *info = i2c_get_clientdata(client); struct ds278x_info *info = i2c_get_clientdata(client);
cancel_delayed_work(&info->bat_work); cancel_delayed_work(&info->bat_work);
return 0; 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); struct ds278x_info *info = i2c_get_clientdata(client);
schedule_delayed_work(&info->bat_work, DS278x_DELAY); schedule_delayed_work(&info->bat_work, DS278x_DELAY);
return 0; return 0;
} }
static SIMPLE_DEV_PM_OPS(ds278x_battery_pm_ops, ds278x_suspend, ds278x_resume);
#define DS278X_BATTERY_PM_OPS (&ds278x_battery_pm_ops)
#else #else
#define DS278X_BATTERY_PM_OPS NULL
#define ds278x_suspend NULL #endif /* CONFIG_PM_SLEEP */
#define ds278x_resume NULL
#endif /* CONFIG_PM */
enum ds278x_num_id { enum ds278x_num_id {
DS2782 = 0, DS2782 = 0,
@ -460,11 +460,10 @@ MODULE_DEVICE_TABLE(i2c, ds278x_id);
static struct i2c_driver ds278x_battery_driver = { static struct i2c_driver ds278x_battery_driver = {
.driver = { .driver = {
.name = "ds2782-battery", .name = "ds2782-battery",
.pm = DS278X_BATTERY_PM_OPS,
}, },
.probe = ds278x_battery_probe, .probe = ds278x_battery_probe,
.remove = ds278x_battery_remove, .remove = ds278x_battery_remove,
.suspend = ds278x_suspend,
.resume = ds278x_resume,
.id_table = ds278x_id, .id_table = ds278x_id,
}; };
module_i2c_driver(ds278x_battery_driver); module_i2c_driver(ds278x_battery_driver);