aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hwmon/lis3lv02d_spi.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/hwmon/lis3lv02d_spi.c')
-rw-r--r--drivers/hwmon/lis3lv02d_spi.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/drivers/hwmon/lis3lv02d_spi.c b/drivers/hwmon/lis3lv02d_spi.c
index 2549de1de4e2..c1f8a8fbf694 100644
--- a/drivers/hwmon/lis3lv02d_spi.c
+++ b/drivers/hwmon/lis3lv02d_spi.c
@@ -16,6 +16,7 @@
16#include <linux/interrupt.h> 16#include <linux/interrupt.h>
17#include <linux/workqueue.h> 17#include <linux/workqueue.h>
18#include <linux/spi/spi.h> 18#include <linux/spi/spi.h>
19#include <linux/pm.h>
19 20
20#include "lis3lv02d.h" 21#include "lis3lv02d.h"
21 22
@@ -88,9 +89,10 @@ static int __devexit lis302dl_spi_remove(struct spi_device *spi)
88 return lis3lv02d_remove_fs(&lis3_dev); 89 return lis3lv02d_remove_fs(&lis3_dev);
89} 90}
90 91
91#ifdef CONFIG_PM 92#ifdef CONFIG_PM_SLEEP
92static int lis3lv02d_spi_suspend(struct spi_device *spi, pm_message_t mesg) 93static int lis3lv02d_spi_suspend(struct device *dev)
93{ 94{
95 struct spi_device *spi = to_spi_device(dev);
94 struct lis3lv02d *lis3 = spi_get_drvdata(spi); 96 struct lis3lv02d *lis3 = spi_get_drvdata(spi);
95 97
96 if (!lis3->pdata || !lis3->pdata->wakeup_flags) 98 if (!lis3->pdata || !lis3->pdata->wakeup_flags)
@@ -99,8 +101,9 @@ static int lis3lv02d_spi_suspend(struct spi_device *spi, pm_message_t mesg)
99 return 0; 101 return 0;
100} 102}
101 103
102static int lis3lv02d_spi_resume(struct spi_device *spi) 104static int lis3lv02d_spi_resume(struct device *dev)
103{ 105{
106 struct spi_device *spi = to_spi_device(dev);
104 struct lis3lv02d *lis3 = spi_get_drvdata(spi); 107 struct lis3lv02d *lis3 = spi_get_drvdata(spi);
105 108
106 if (!lis3->pdata || !lis3->pdata->wakeup_flags) 109 if (!lis3->pdata || !lis3->pdata->wakeup_flags)
@@ -108,21 +111,19 @@ static int lis3lv02d_spi_resume(struct spi_device *spi)
108 111
109 return 0; 112 return 0;
110} 113}
111
112#else
113#define lis3lv02d_spi_suspend NULL
114#define lis3lv02d_spi_resume NULL
115#endif 114#endif
116 115
116static SIMPLE_DEV_PM_OPS(lis3lv02d_spi_pm, lis3lv02d_spi_suspend,
117 lis3lv02d_spi_resume);
118
117static struct spi_driver lis302dl_spi_driver = { 119static struct spi_driver lis302dl_spi_driver = {
118 .driver = { 120 .driver = {
119 .name = DRV_NAME, 121 .name = DRV_NAME,
120 .owner = THIS_MODULE, 122 .owner = THIS_MODULE,
123 .pm = &lis3lv02d_spi_pm,
121 }, 124 },
122 .probe = lis302dl_spi_probe, 125 .probe = lis302dl_spi_probe,
123 .remove = __devexit_p(lis302dl_spi_remove), 126 .remove = __devexit_p(lis302dl_spi_remove),
124 .suspend = lis3lv02d_spi_suspend,
125 .resume = lis3lv02d_spi_resume,
126}; 127};
127 128
128static int __init lis302dl_init(void) 129static int __init lis302dl_init(void)