diff options
author | Lars-Peter Clausen <lars@metafoo.de> | 2012-02-20 18:37:05 (GMT) |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2012-02-24 20:11:13 (GMT) |
commit | 01788c533acbd63702146a2be975ae4007cfb2cf (patch) | |
tree | 06af3b838bb42e46ad124c1841398c5113f455ae /drivers/staging/iio/light/tsl2583.c | |
parent | 4eeb3335bbfb4e9d6a7995f283deeecb06e07aea (diff) | |
download | linux-fsl-qoriq-01788c533acbd63702146a2be975ae4007cfb2cf.tar.xz |
staging:iio: Use dev_pm_ops
Use dev_pm_ops instead of legacy suspend/resume callbacks for IIO drivers.
Note that this patch introduces a few new #ifdef CONFIG_PM_SLEEP around the
suspend and resume callbacks to avoid warnings of unused functions if
CONFIG_PM_SLEEP is not defined.
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Acked-by: Jonathan Cameron <jic23@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/iio/light/tsl2583.c')
-rw-r--r-- | drivers/staging/iio/light/tsl2583.c | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/drivers/staging/iio/light/tsl2583.c b/drivers/staging/iio/light/tsl2583.c index 5b6455a..9fe9a67 100644 --- a/drivers/staging/iio/light/tsl2583.c +++ b/drivers/staging/iio/light/tsl2583.c @@ -884,9 +884,10 @@ fail2: return ret; } -static int taos_suspend(struct i2c_client *client, pm_message_t state) +#ifdef CONFIG_PM_SLEEP +static int taos_suspend(struct device *dev) { - struct iio_dev *indio_dev = i2c_get_clientdata(client); + struct iio_dev *indio_dev = i2c_get_clientdata(to_i2c_client(dev)); struct tsl2583_chip *chip = iio_priv(indio_dev); int ret = 0; @@ -901,9 +902,9 @@ static int taos_suspend(struct i2c_client *client, pm_message_t state) return ret; } -static int taos_resume(struct i2c_client *client) +static int taos_resume(struct device *dev) { - struct iio_dev *indio_dev = i2c_get_clientdata(client); + struct iio_dev *indio_dev = i2c_get_clientdata(to_i2c_client(dev)); struct tsl2583_chip *chip = iio_priv(indio_dev); int ret = 0; @@ -916,6 +917,11 @@ static int taos_resume(struct i2c_client *client) return ret; } +static SIMPLE_DEV_PM_OPS(taos_pm_ops, taos_suspend, taos_resume); +#define TAOS_PM_OPS (&taos_pm_ops) +#else +#define TAOS_PM_OPS NULL +#endif static int __devexit taos_remove(struct i2c_client *client) { @@ -937,10 +943,9 @@ MODULE_DEVICE_TABLE(i2c, taos_idtable); static struct i2c_driver taos_driver = { .driver = { .name = "tsl2583", + .pm = TAOS_PM_OPS, }, .id_table = taos_idtable, - .suspend = taos_suspend, - .resume = taos_resume, .probe = taos_probe, .remove = __devexit_p(taos_remove), }; |