diff options
author | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2011-01-21 01:48:44 -0500 |
---|---|---|
committer | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2011-01-21 01:54:49 -0500 |
commit | c7848c8e1a26ca6075d6cb538657f5381afcadc4 (patch) | |
tree | 3320391442264e0c01347e50bd1899520289839f /drivers/input/touchscreen/ad7879-spi.c | |
parent | fccdd7c4aeb7ed639b51126941545bc5b3824dab (diff) |
Input: ad7879 - convert SPI 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 ad7879 SPI 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>
Diffstat (limited to 'drivers/input/touchscreen/ad7879-spi.c')
-rw-r--r-- | drivers/input/touchscreen/ad7879-spi.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/drivers/input/touchscreen/ad7879-spi.c b/drivers/input/touchscreen/ad7879-spi.c index 59c6e68c4325..ddf732f3cafc 100644 --- a/drivers/input/touchscreen/ad7879-spi.c +++ b/drivers/input/touchscreen/ad7879-spi.c | |||
@@ -7,6 +7,7 @@ | |||
7 | */ | 7 | */ |
8 | 8 | ||
9 | #include <linux/input.h> /* BUS_SPI */ | 9 | #include <linux/input.h> /* BUS_SPI */ |
10 | #include <linux/pm.h> | ||
10 | #include <linux/spi/spi.h> | 11 | #include <linux/spi/spi.h> |
11 | 12 | ||
12 | #include "ad7879.h" | 13 | #include "ad7879.h" |
@@ -20,9 +21,10 @@ | |||
20 | #define AD7879_WRITECMD(reg) (AD7879_CMD(reg)) | 21 | #define AD7879_WRITECMD(reg) (AD7879_CMD(reg)) |
21 | #define AD7879_READCMD(reg) (AD7879_CMD(reg) | AD7879_CMD_READ) | 22 | #define AD7879_READCMD(reg) (AD7879_CMD(reg) | AD7879_CMD_READ) |
22 | 23 | ||
23 | #ifdef CONFIG_PM | 24 | #ifdef CONFIG_PM_SLEEP |
24 | static int ad7879_spi_suspend(struct spi_device *spi, pm_message_t message) | 25 | static int ad7879_spi_suspend(struct device *dev) |
25 | { | 26 | { |
27 | struct spi_device *spi = to_spi_device(dev); | ||
26 | struct ad7879 *ts = spi_get_drvdata(spi); | 28 | struct ad7879 *ts = spi_get_drvdata(spi); |
27 | 29 | ||
28 | ad7879_suspend(ts); | 30 | ad7879_suspend(ts); |
@@ -30,19 +32,19 @@ static int ad7879_spi_suspend(struct spi_device *spi, pm_message_t message) | |||
30 | return 0; | 32 | return 0; |
31 | } | 33 | } |
32 | 34 | ||
33 | static int ad7879_spi_resume(struct spi_device *spi) | 35 | static int ad7879_spi_resume(struct device *dev) |
34 | { | 36 | { |
37 | struct spi_device *spi = to_spi_device(dev); | ||
35 | struct ad7879 *ts = spi_get_drvdata(spi); | 38 | struct ad7879 *ts = spi_get_drvdata(spi); |
36 | 39 | ||
37 | ad7879_resume(ts); | 40 | ad7879_resume(ts); |
38 | 41 | ||
39 | return 0; | 42 | return 0; |
40 | } | 43 | } |
41 | #else | ||
42 | # define ad7879_spi_suspend NULL | ||
43 | # define ad7879_spi_resume NULL | ||
44 | #endif | 44 | #endif |
45 | 45 | ||
46 | static SIMPLE_DEV_PM_OPS(ad7879_spi_pm, ad7879_spi_suspend, ad7879_spi_resume); | ||
47 | |||
46 | /* | 48 | /* |
47 | * ad7879_read/write are only used for initial setup and for sysfs controls. | 49 | * ad7879_read/write are only used for initial setup and for sysfs controls. |
48 | * The main traffic is done in ad7879_collect(). | 50 | * The main traffic is done in ad7879_collect(). |
@@ -173,11 +175,10 @@ static struct spi_driver ad7879_spi_driver = { | |||
173 | .name = "ad7879", | 175 | .name = "ad7879", |
174 | .bus = &spi_bus_type, | 176 | .bus = &spi_bus_type, |
175 | .owner = THIS_MODULE, | 177 | .owner = THIS_MODULE, |
178 | .pm = &ad7879_spi_pm, | ||
176 | }, | 179 | }, |
177 | .probe = ad7879_spi_probe, | 180 | .probe = ad7879_spi_probe, |
178 | .remove = __devexit_p(ad7879_spi_remove), | 181 | .remove = __devexit_p(ad7879_spi_remove), |
179 | .suspend = ad7879_spi_suspend, | ||
180 | .resume = ad7879_spi_resume, | ||
181 | }; | 182 | }; |
182 | 183 | ||
183 | static int __init ad7879_spi_init(void) | 184 | static int __init ad7879_spi_init(void) |