misc: isl29003: 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>
Cc: Daniel Mack <daniel@caiaq.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Lars-Peter Clausen 2013-04-11 11:24:41 +02:00 committed by Greg Kroah-Hartman
parent 5d4717d76f
commit 873bf4f46c
1 changed files with 11 additions and 8 deletions

View File

@ -409,18 +409,20 @@ static int isl29003_remove(struct i2c_client *client)
return 0; return 0;
} }
#ifdef CONFIG_PM #ifdef CONFIG_PM_SLEEP
static int isl29003_suspend(struct i2c_client *client, pm_message_t mesg) static int isl29003_suspend(struct device *dev)
{ {
struct i2c_client *client = to_i2c_client(dev);
struct isl29003_data *data = i2c_get_clientdata(client); struct isl29003_data *data = i2c_get_clientdata(client);
data->power_state_before_suspend = isl29003_get_power_state(client); data->power_state_before_suspend = isl29003_get_power_state(client);
return isl29003_set_power_state(client, 0); return isl29003_set_power_state(client, 0);
} }
static int isl29003_resume(struct i2c_client *client) static int isl29003_resume(struct device *dev)
{ {
int i; int i;
struct i2c_client *client = to_i2c_client(dev);
struct isl29003_data *data = i2c_get_clientdata(client); struct isl29003_data *data = i2c_get_clientdata(client);
/* restore registers from cache */ /* restore registers from cache */
@ -432,10 +434,12 @@ static int isl29003_resume(struct i2c_client *client)
data->power_state_before_suspend); data->power_state_before_suspend);
} }
static SIMPLE_DEV_PM_OPS(isl29003_pm_ops, isl29003_suspend, isl29003_resume);
#define ISL29003_PM_OPS (&isl29003_pm_ops)
#else #else
#define isl29003_suspend NULL #define ISL29003_PM_OPS NULL
#define isl29003_resume NULL #endif /* CONFIG_PM_SLEEP */
#endif /* CONFIG_PM */
static const struct i2c_device_id isl29003_id[] = { static const struct i2c_device_id isl29003_id[] = {
{ "isl29003", 0 }, { "isl29003", 0 },
@ -447,9 +451,8 @@ static struct i2c_driver isl29003_driver = {
.driver = { .driver = {
.name = ISL29003_DRV_NAME, .name = ISL29003_DRV_NAME,
.owner = THIS_MODULE, .owner = THIS_MODULE,
.pm = ISL29003_PM_OPS,
}, },
.suspend = isl29003_suspend,
.resume = isl29003_resume,
.probe = isl29003_probe, .probe = isl29003_probe,
.remove = isl29003_remove, .remove = isl29003_remove,
.id_table = isl29003_id, .id_table = isl29003_id,