diff options
author | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2011-01-21 01:51:26 -0500 |
---|---|---|
committer | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2011-01-21 01:54:53 -0500 |
commit | 3c36e719033ddc09aded770472cbdb477fcb4479 (patch) | |
tree | e1dd4cedf5a17367023ebf36151bb23f453b0931 | |
parent | c7848c8e1a26ca6075d6cb538657f5381afcadc4 (diff) |
Input: ads7846 - convert to dev_pm_ops
There is a move to deprecate bus-specific PM operations and move to
using dev_pm_ops instead in order to reduce the amount of boilerplate
code in buses and facilitate updates to the PM core. Do this move for
the ads7846 driver.
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Michael Hennerich <Michael.Hennerich@analog.com>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
-rw-r--r-- | drivers/input/touchscreen/ads7846.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/drivers/input/touchscreen/ads7846.c b/drivers/input/touchscreen/ads7846.c index 14ea54b78e46..b31e90f0d44b 100644 --- a/drivers/input/touchscreen/ads7846.c +++ b/drivers/input/touchscreen/ads7846.c | |||
@@ -26,6 +26,7 @@ | |||
26 | #include <linux/input.h> | 26 | #include <linux/input.h> |
27 | #include <linux/interrupt.h> | 27 | #include <linux/interrupt.h> |
28 | #include <linux/slab.h> | 28 | #include <linux/slab.h> |
29 | #include <linux/pm.h> | ||
29 | #include <linux/gpio.h> | 30 | #include <linux/gpio.h> |
30 | #include <linux/spi/spi.h> | 31 | #include <linux/spi/spi.h> |
31 | #include <linux/spi/ads7846.h> | 32 | #include <linux/spi/ads7846.h> |
@@ -892,9 +893,10 @@ static irqreturn_t ads7846_irq(int irq, void *handle) | |||
892 | return IRQ_HANDLED; | 893 | return IRQ_HANDLED; |
893 | } | 894 | } |
894 | 895 | ||
895 | static int ads7846_suspend(struct spi_device *spi, pm_message_t message) | 896 | #ifdef CONFIG_PM_SLEEP |
897 | static int ads7846_suspend(struct device *dev) | ||
896 | { | 898 | { |
897 | struct ads7846 *ts = dev_get_drvdata(&spi->dev); | 899 | struct ads7846 *ts = dev_get_drvdata(dev); |
898 | 900 | ||
899 | mutex_lock(&ts->lock); | 901 | mutex_lock(&ts->lock); |
900 | 902 | ||
@@ -914,9 +916,9 @@ static int ads7846_suspend(struct spi_device *spi, pm_message_t message) | |||
914 | return 0; | 916 | return 0; |
915 | } | 917 | } |
916 | 918 | ||
917 | static int ads7846_resume(struct spi_device *spi) | 919 | static int ads7846_resume(struct device *dev) |
918 | { | 920 | { |
919 | struct ads7846 *ts = dev_get_drvdata(&spi->dev); | 921 | struct ads7846 *ts = dev_get_drvdata(dev); |
920 | 922 | ||
921 | mutex_lock(&ts->lock); | 923 | mutex_lock(&ts->lock); |
922 | 924 | ||
@@ -935,6 +937,9 @@ static int ads7846_resume(struct spi_device *spi) | |||
935 | 937 | ||
936 | return 0; | 938 | return 0; |
937 | } | 939 | } |
940 | #endif | ||
941 | |||
942 | static SIMPLE_DEV_PM_OPS(ads7846_pm, ads7846_suspend, ads7846_resume); | ||
938 | 943 | ||
939 | static int __devinit ads7846_setup_pendown(struct spi_device *spi, struct ads7846 *ts) | 944 | static int __devinit ads7846_setup_pendown(struct spi_device *spi, struct ads7846 *ts) |
940 | { | 945 | { |
@@ -1402,11 +1407,10 @@ static struct spi_driver ads7846_driver = { | |||
1402 | .name = "ads7846", | 1407 | .name = "ads7846", |
1403 | .bus = &spi_bus_type, | 1408 | .bus = &spi_bus_type, |
1404 | .owner = THIS_MODULE, | 1409 | .owner = THIS_MODULE, |
1410 | .pm = &ads7846_pm, | ||
1405 | }, | 1411 | }, |
1406 | .probe = ads7846_probe, | 1412 | .probe = ads7846_probe, |
1407 | .remove = __devexit_p(ads7846_remove), | 1413 | .remove = __devexit_p(ads7846_remove), |
1408 | .suspend = ads7846_suspend, | ||
1409 | .resume = ads7846_resume, | ||
1410 | }; | 1414 | }; |
1411 | 1415 | ||
1412 | static int __init ads7846_init(void) | 1416 | static int __init ads7846_init(void) |