mirror of https://gitee.com/openkylin/linux.git
max17040_battery: Use dev_pm_ops
Use dev_pm_ops instead of the deprecated legacy suspend/resume callbacks. Cc: Minkyu Kang <mk7.kang@samsung.com> Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Acked-by: Minkyu Kang <mk7.kang@samsung.com> Signed-off-by: Anton Vorontsov <anton@enomsg.org>
This commit is contained in:
parent
cc6616f690
commit
43cf454aba
|
@ -246,31 +246,34 @@ static int max17040_remove(struct i2c_client *client)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef CONFIG_PM
|
#ifdef CONFIG_PM_SLEEP
|
||||||
|
|
||||||
static int max17040_suspend(struct i2c_client *client,
|
static int max17040_suspend(struct device *dev)
|
||||||
pm_message_t state)
|
|
||||||
{
|
{
|
||||||
|
struct i2c_client *client = to_i2c_client(dev);
|
||||||
struct max17040_chip *chip = i2c_get_clientdata(client);
|
struct max17040_chip *chip = i2c_get_clientdata(client);
|
||||||
|
|
||||||
cancel_delayed_work(&chip->work);
|
cancel_delayed_work(&chip->work);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int max17040_resume(struct i2c_client *client)
|
static int max17040_resume(struct device *dev)
|
||||||
{
|
{
|
||||||
|
struct i2c_client *client = to_i2c_client(dev);
|
||||||
struct max17040_chip *chip = i2c_get_clientdata(client);
|
struct max17040_chip *chip = i2c_get_clientdata(client);
|
||||||
|
|
||||||
schedule_delayed_work(&chip->work, MAX17040_DELAY);
|
schedule_delayed_work(&chip->work, MAX17040_DELAY);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static SIMPLE_DEV_PM_OPS(max17040_pm_ops, max17040_suspend, max17040_resume);
|
||||||
|
#define MAX17040_PM_OPS (&max17040_pm_ops)
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
#define max17040_suspend NULL
|
#define MAX17040_PM_OPS NULL
|
||||||
#define max17040_resume NULL
|
|
||||||
|
|
||||||
#endif /* CONFIG_PM */
|
#endif /* CONFIG_PM_SLEEP */
|
||||||
|
|
||||||
static const struct i2c_device_id max17040_id[] = {
|
static const struct i2c_device_id max17040_id[] = {
|
||||||
{ "max17040", 0 },
|
{ "max17040", 0 },
|
||||||
|
@ -281,11 +284,10 @@ MODULE_DEVICE_TABLE(i2c, max17040_id);
|
||||||
static struct i2c_driver max17040_i2c_driver = {
|
static struct i2c_driver max17040_i2c_driver = {
|
||||||
.driver = {
|
.driver = {
|
||||||
.name = "max17040",
|
.name = "max17040",
|
||||||
|
.pm = MAX17040_PM_OPS,
|
||||||
},
|
},
|
||||||
.probe = max17040_probe,
|
.probe = max17040_probe,
|
||||||
.remove = max17040_remove,
|
.remove = max17040_remove,
|
||||||
.suspend = max17040_suspend,
|
|
||||||
.resume = max17040_resume,
|
|
||||||
.id_table = max17040_id,
|
.id_table = max17040_id,
|
||||||
};
|
};
|
||||||
module_i2c_driver(max17040_i2c_driver);
|
module_i2c_driver(max17040_i2c_driver);
|
||||||
|
|
Loading…
Reference in New Issue