mirror of https://gitee.com/openkylin/linux.git
sbs-battery: Use dev_pm_ops
Use dev_pm_ops instead of the deprecated legacy suspend/resume callbacks. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Acked-by: Rhyland Klein <rklein@nvidia.com> Signed-off-by: Anton Vorontsov <anton@enomsg.org>
This commit is contained in:
parent
43cf454aba
commit
9c1d1af0cf
|
@ -820,10 +820,11 @@ static int sbs_remove(struct i2c_client *client)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined CONFIG_PM
|
#if defined CONFIG_PM_SLEEP
|
||||||
static int sbs_suspend(struct i2c_client *client,
|
|
||||||
pm_message_t state)
|
static int sbs_suspend(struct device *dev)
|
||||||
{
|
{
|
||||||
|
struct i2c_client *client = to_i2c_client(dev);
|
||||||
struct sbs_info *chip = i2c_get_clientdata(client);
|
struct sbs_info *chip = i2c_get_clientdata(client);
|
||||||
s32 ret;
|
s32 ret;
|
||||||
|
|
||||||
|
@ -838,11 +839,13 @@ static int sbs_suspend(struct i2c_client *client,
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static SIMPLE_DEV_PM_OPS(sbs_pm_ops, sbs_suspend, NULL);
|
||||||
|
#define SBS_PM_OPS (&sbs_pm_ops)
|
||||||
|
|
||||||
#else
|
#else
|
||||||
#define sbs_suspend NULL
|
#define SBS_PM_OPS NULL
|
||||||
#endif
|
#endif
|
||||||
/* any smbus transaction will wake up sbs */
|
|
||||||
#define sbs_resume NULL
|
|
||||||
|
|
||||||
static const struct i2c_device_id sbs_id[] = {
|
static const struct i2c_device_id sbs_id[] = {
|
||||||
{ "bq20z75", 0 },
|
{ "bq20z75", 0 },
|
||||||
|
@ -854,12 +857,11 @@ MODULE_DEVICE_TABLE(i2c, sbs_id);
|
||||||
static struct i2c_driver sbs_battery_driver = {
|
static struct i2c_driver sbs_battery_driver = {
|
||||||
.probe = sbs_probe,
|
.probe = sbs_probe,
|
||||||
.remove = sbs_remove,
|
.remove = sbs_remove,
|
||||||
.suspend = sbs_suspend,
|
|
||||||
.resume = sbs_resume,
|
|
||||||
.id_table = sbs_id,
|
.id_table = sbs_id,
|
||||||
.driver = {
|
.driver = {
|
||||||
.name = "sbs-battery",
|
.name = "sbs-battery",
|
||||||
.of_match_table = of_match_ptr(sbs_dt_ids),
|
.of_match_table = of_match_ptr(sbs_dt_ids),
|
||||||
|
.pm = SBS_PM_OPS,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
module_i2c_driver(sbs_battery_driver);
|
module_i2c_driver(sbs_battery_driver);
|
||||||
|
|
Loading…
Reference in New Issue