Commit 5cbd28df authored by Mark Brown's avatar Mark Brown Committed by Mauro Carvalho Chehab

[media] Convert I2C drivers to dev_pm_ops

The legacy I2C PM functions have been deprecated and warning on boot
for over a year, convert the drivers still using them to dev_pm_ops.
Signed-off-by: default avatarMark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent b1890008
...@@ -597,19 +597,23 @@ static int msp_log_status(struct v4l2_subdev *sd) ...@@ -597,19 +597,23 @@ static int msp_log_status(struct v4l2_subdev *sd)
return 0; return 0;
} }
static int msp_suspend(struct i2c_client *client, pm_message_t state) #ifdef CONFIG_PM_SLEEP
static int msp_suspend(struct device *dev)
{ {
struct i2c_client *client = to_i2c_client(dev);
v4l_dbg(1, msp_debug, client, "suspend\n"); v4l_dbg(1, msp_debug, client, "suspend\n");
msp_reset(client); msp_reset(client);
return 0; return 0;
} }
static int msp_resume(struct i2c_client *client) static int msp_resume(struct device *dev)
{ {
struct i2c_client *client = to_i2c_client(dev);
v4l_dbg(1, msp_debug, client, "resume\n"); v4l_dbg(1, msp_debug, client, "resume\n");
msp_wake_thread(client); msp_wake_thread(client);
return 0; return 0;
} }
#endif
/* ----------------------------------------------------------------------- */ /* ----------------------------------------------------------------------- */
...@@ -863,6 +867,10 @@ static int msp_remove(struct i2c_client *client) ...@@ -863,6 +867,10 @@ static int msp_remove(struct i2c_client *client)
/* ----------------------------------------------------------------------- */ /* ----------------------------------------------------------------------- */
static const struct dev_pm_ops msp3400_pm_ops = {
SET_SYSTEM_SLEEP_PM_OPS(msp_suspend, msp_resume)
};
static const struct i2c_device_id msp_id[] = { static const struct i2c_device_id msp_id[] = {
{ "msp3400", 0 }, { "msp3400", 0 },
{ } { }
...@@ -873,11 +881,10 @@ static struct i2c_driver msp_driver = { ...@@ -873,11 +881,10 @@ static struct i2c_driver msp_driver = {
.driver = { .driver = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.name = "msp3400", .name = "msp3400",
.pm = &msp3400_pm_ops,
}, },
.probe = msp_probe, .probe = msp_probe,
.remove = msp_remove, .remove = msp_remove,
.suspend = msp_suspend,
.resume = msp_resume,
.id_table = msp_id, .id_table = msp_id,
}; };
......
...@@ -1241,8 +1241,10 @@ static int tuner_log_status(struct v4l2_subdev *sd) ...@@ -1241,8 +1241,10 @@ static int tuner_log_status(struct v4l2_subdev *sd)
return 0; return 0;
} }
static int tuner_suspend(struct i2c_client *c, pm_message_t state) #ifdef CONFIG_PM_SLEEP
static int tuner_suspend(struct device *dev)
{ {
struct i2c_client *c = to_i2c_client(dev);
struct tuner *t = to_tuner(i2c_get_clientdata(c)); struct tuner *t = to_tuner(i2c_get_clientdata(c));
struct analog_demod_ops *analog_ops = &t->fe.ops.analog_ops; struct analog_demod_ops *analog_ops = &t->fe.ops.analog_ops;
...@@ -1254,8 +1256,9 @@ static int tuner_suspend(struct i2c_client *c, pm_message_t state) ...@@ -1254,8 +1256,9 @@ static int tuner_suspend(struct i2c_client *c, pm_message_t state)
return 0; return 0;
} }
static int tuner_resume(struct i2c_client *c) static int tuner_resume(struct device *dev)
{ {
struct i2c_client *c = to_i2c_client(dev);
struct tuner *t = to_tuner(i2c_get_clientdata(c)); struct tuner *t = to_tuner(i2c_get_clientdata(c));
tuner_dbg("resume\n"); tuner_dbg("resume\n");
...@@ -1266,6 +1269,7 @@ static int tuner_resume(struct i2c_client *c) ...@@ -1266,6 +1269,7 @@ static int tuner_resume(struct i2c_client *c)
return 0; return 0;
} }
#endif
static int tuner_command(struct i2c_client *client, unsigned cmd, void *arg) static int tuner_command(struct i2c_client *client, unsigned cmd, void *arg)
{ {
...@@ -1310,6 +1314,10 @@ static const struct v4l2_subdev_ops tuner_ops = { ...@@ -1310,6 +1314,10 @@ static const struct v4l2_subdev_ops tuner_ops = {
* I2C structs and module init functions * I2C structs and module init functions
*/ */
static const struct dev_pm_ops tuner_pm_ops = {
SET_SYSTEM_SLEEP_PM_OPS(tuner_suspend, tuner_resume)
};
static const struct i2c_device_id tuner_id[] = { static const struct i2c_device_id tuner_id[] = {
{ "tuner", }, /* autodetect */ { "tuner", }, /* autodetect */
{ } { }
...@@ -1320,12 +1328,11 @@ static struct i2c_driver tuner_driver = { ...@@ -1320,12 +1328,11 @@ static struct i2c_driver tuner_driver = {
.driver = { .driver = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.name = "tuner", .name = "tuner",
.pm = &tuner_pm_ops,
}, },
.probe = tuner_probe, .probe = tuner_probe,
.remove = tuner_remove, .remove = tuner_remove,
.command = tuner_command, .command = tuner_command,
.suspend = tuner_suspend,
.resume = tuner_resume,
.id_table = tuner_id, .id_table = tuner_id,
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment