diff options
author | Lars-Peter Clausen <lars@metafoo.de> | 2015-01-11 15:37:04 +0100 |
---|---|---|
committer | Jonathan Cameron <jic23@kernel.org> | 2015-01-27 19:49:52 +0100 |
commit | 9d9f780000e0a2c2582843ee83612530a16920c8 (patch) | |
tree | e325fb064f1512e819776f39370962d54f822a9b | |
parent | iio: Added Capella cm3232 ambient light sensor driver. (diff) | |
download | linux-9d9f780000e0a2c2582843ee83612530a16920c8.tar.xz linux-9d9f780000e0a2c2582843ee83612530a16920c8.zip |
iio: as3935: Switch to PM ops
Switch from the legacy suspend/resume callbacks to device pm ops.
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
-rw-r--r-- | drivers/iio/proximity/as3935.c | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/drivers/iio/proximity/as3935.c b/drivers/iio/proximity/as3935.c index 466aa4314667..bc0d68efd455 100644 --- a/drivers/iio/proximity/as3935.c +++ b/drivers/iio/proximity/as3935.c @@ -273,9 +273,9 @@ static void calibrate_as3935(struct as3935_state *st) } #ifdef CONFIG_PM_SLEEP -static int as3935_suspend(struct spi_device *spi, pm_message_t msg) +static int as3935_suspend(struct device *dev) { - struct iio_dev *indio_dev = spi_get_drvdata(spi); + struct iio_dev *indio_dev = dev_get_drvdata(dev); struct as3935_state *st = iio_priv(indio_dev); int val, ret; @@ -293,9 +293,9 @@ err_suspend: return ret; } -static int as3935_resume(struct spi_device *spi) +static int as3935_resume(struct device *dev) { - struct iio_dev *indio_dev = spi_get_drvdata(spi); + struct iio_dev *indio_dev = dev_get_drvdata(dev); struct as3935_state *st = iio_priv(indio_dev); int val, ret; @@ -311,9 +311,12 @@ err_resume: return ret; } + +static SIMPLE_DEV_PM_OPS(as3935_pm_ops, as3935_suspend, as3935_resume); +#define AS3935_PM_OPS (&as3935_pm_ops) + #else -#define as3935_suspend NULL -#define as3935_resume NULL +#define AS3935_PM_OPS NULL #endif static int as3935_probe(struct spi_device *spi) @@ -441,12 +444,11 @@ static struct spi_driver as3935_driver = { .driver = { .name = "as3935", .owner = THIS_MODULE, + .pm = AS3935_PM_OPS, }, .probe = as3935_probe, .remove = as3935_remove, .id_table = as3935_id, - .suspend = as3935_suspend, - .resume = as3935_resume, }; module_spi_driver(as3935_driver); |