aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/input/misc/adxl34x-spi.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/input/misc/adxl34x-spi.c')
-rw-r--r--drivers/input/misc/adxl34x-spi.c20
1 files changed, 11 insertions, 9 deletions
diff --git a/drivers/input/misc/adxl34x-spi.c b/drivers/input/misc/adxl34x-spi.c
index 782de9e8982..f29de22fdda 100644
--- a/drivers/input/misc/adxl34x-spi.c
+++ b/drivers/input/misc/adxl34x-spi.c
@@ -10,6 +10,7 @@
10#include <linux/input.h> /* BUS_SPI */ 10#include <linux/input.h> /* BUS_SPI */
11#include <linux/module.h> 11#include <linux/module.h>
12#include <linux/spi/spi.h> 12#include <linux/spi/spi.h>
13#include <linux/pm.h>
13#include <linux/types.h> 14#include <linux/types.h>
14#include "adxl34x.h" 15#include "adxl34x.h"
15 16
@@ -57,7 +58,7 @@ static int adxl34x_spi_read_block(struct device *dev,
57 return (status < 0) ? status : 0; 58 return (status < 0) ? status : 0;
58} 59}
59 60
60static const struct adxl34x_bus_ops adx134x_spi_bops = { 61static const struct adxl34x_bus_ops adxl34x_spi_bops = {
61 .bustype = BUS_SPI, 62 .bustype = BUS_SPI,
62 .write = adxl34x_spi_write, 63 .write = adxl34x_spi_write,
63 .read = adxl34x_spi_read, 64 .read = adxl34x_spi_read,
@@ -76,7 +77,7 @@ static int __devinit adxl34x_spi_probe(struct spi_device *spi)
76 77
77 ac = adxl34x_probe(&spi->dev, spi->irq, 78 ac = adxl34x_probe(&spi->dev, spi->irq,
78 spi->max_speed_hz > MAX_FREQ_NO_FIFODELAY, 79 spi->max_speed_hz > MAX_FREQ_NO_FIFODELAY,
79 &adx134x_spi_bops); 80 &adxl34x_spi_bops);
80 81
81 if (IS_ERR(ac)) 82 if (IS_ERR(ac))
82 return PTR_ERR(ac); 83 return PTR_ERR(ac);
@@ -94,8 +95,9 @@ static int __devexit adxl34x_spi_remove(struct spi_device *spi)
94} 95}
95 96
96#ifdef CONFIG_PM 97#ifdef CONFIG_PM
97static int adxl34x_spi_suspend(struct spi_device *spi, pm_message_t message) 98static int adxl34x_spi_suspend(struct device *dev)
98{ 99{
100 struct spi_device *spi = to_spi_device(dev);
99 struct adxl34x *ac = dev_get_drvdata(&spi->dev); 101 struct adxl34x *ac = dev_get_drvdata(&spi->dev);
100 102
101 adxl34x_suspend(ac); 103 adxl34x_suspend(ac);
@@ -103,29 +105,29 @@ static int adxl34x_spi_suspend(struct spi_device *spi, pm_message_t message)
103 return 0; 105 return 0;
104} 106}
105 107
106static int adxl34x_spi_resume(struct spi_device *spi) 108static int adxl34x_spi_resume(struct device *dev)
107{ 109{
110 struct spi_device *spi = to_spi_device(dev);
108 struct adxl34x *ac = dev_get_drvdata(&spi->dev); 111 struct adxl34x *ac = dev_get_drvdata(&spi->dev);
109 112
110 adxl34x_resume(ac); 113 adxl34x_resume(ac);
111 114
112 return 0; 115 return 0;
113} 116}
114#else
115# define adxl34x_spi_suspend NULL
116# define adxl34x_spi_resume NULL
117#endif 117#endif
118 118
119static SIMPLE_DEV_PM_OPS(adxl34x_spi_pm, adxl34x_spi_suspend,
120 adxl34x_spi_resume);
121
119static struct spi_driver adxl34x_driver = { 122static struct spi_driver adxl34x_driver = {
120 .driver = { 123 .driver = {
121 .name = "adxl34x", 124 .name = "adxl34x",
122 .bus = &spi_bus_type, 125 .bus = &spi_bus_type,
123 .owner = THIS_MODULE, 126 .owner = THIS_MODULE,
127 .pm = &adxl34x_spi_pm,
124 }, 128 },
125 .probe = adxl34x_spi_probe, 129 .probe = adxl34x_spi_probe,
126 .remove = __devexit_p(adxl34x_spi_remove), 130 .remove = __devexit_p(adxl34x_spi_remove),
127 .suspend = adxl34x_spi_suspend,
128 .resume = adxl34x_spi_resume,
129}; 131};
130 132
131static int __init adxl34x_spi_init(void) 133static int __init adxl34x_spi_init(void)