diff options
author | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2015-10-17 14:39:40 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2015-10-18 00:45:05 -0400 |
commit | 36fccce0e82a5ccd1c7f3861398f3303bff4669a (patch) | |
tree | fad1cae3137197d167f11752f258ca0ddce1a874 /drivers/w1 | |
parent | a2a47d00c08e2306185945dabaafd11447641077 (diff) |
W1: w1-gpio - switch to using dev_pm_ops
Let's stop using legacy platform driver hooks for power management and
switch to using the standard dev_pm_ops-based hooks.
Also, instead of guarding PM methods with #ifdef CONFIG_PM annotate them
as __maybe_unused as it provides better compile coverage.
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/w1')
-rw-r--r-- | drivers/w1/masters/w1-gpio.c | 20 |
1 files changed, 7 insertions, 13 deletions
diff --git a/drivers/w1/masters/w1-gpio.c b/drivers/w1/masters/w1-gpio.c index 8f7848c62811..a373ae69d9f6 100644 --- a/drivers/w1/masters/w1-gpio.c +++ b/drivers/w1/masters/w1-gpio.c | |||
@@ -198,11 +198,9 @@ static int w1_gpio_remove(struct platform_device *pdev) | |||
198 | return 0; | 198 | return 0; |
199 | } | 199 | } |
200 | 200 | ||
201 | #ifdef CONFIG_PM | 201 | static int __maybe_unused w1_gpio_suspend(struct device *dev) |
202 | |||
203 | static int w1_gpio_suspend(struct platform_device *pdev, pm_message_t state) | ||
204 | { | 202 | { |
205 | struct w1_gpio_platform_data *pdata = dev_get_platdata(&pdev->dev); | 203 | struct w1_gpio_platform_data *pdata = dev_get_platdata(dev); |
206 | 204 | ||
207 | if (pdata->enable_external_pullup) | 205 | if (pdata->enable_external_pullup) |
208 | pdata->enable_external_pullup(0); | 206 | pdata->enable_external_pullup(0); |
@@ -210,9 +208,9 @@ static int w1_gpio_suspend(struct platform_device *pdev, pm_message_t state) | |||
210 | return 0; | 208 | return 0; |
211 | } | 209 | } |
212 | 210 | ||
213 | static int w1_gpio_resume(struct platform_device *pdev) | 211 | static int __maybe_unused w1_gpio_resume(struct device *dev) |
214 | { | 212 | { |
215 | struct w1_gpio_platform_data *pdata = dev_get_platdata(&pdev->dev); | 213 | struct w1_gpio_platform_data *pdata = dev_get_platdata(dev); |
216 | 214 | ||
217 | if (pdata->enable_external_pullup) | 215 | if (pdata->enable_external_pullup) |
218 | pdata->enable_external_pullup(1); | 216 | pdata->enable_external_pullup(1); |
@@ -220,20 +218,16 @@ static int w1_gpio_resume(struct platform_device *pdev) | |||
220 | return 0; | 218 | return 0; |
221 | } | 219 | } |
222 | 220 | ||
223 | #else | 221 | static SIMPLE_DEV_PM_OPS(w1_gpio_pm_ops, w1_gpio_suspend, w1_gpio_resume); |
224 | #define w1_gpio_suspend NULL | ||
225 | #define w1_gpio_resume NULL | ||
226 | #endif | ||
227 | 222 | ||
228 | static struct platform_driver w1_gpio_driver = { | 223 | static struct platform_driver w1_gpio_driver = { |
229 | .driver = { | 224 | .driver = { |
230 | .name = "w1-gpio", | 225 | .name = "w1-gpio", |
226 | .pm = &w1_gpio_pm_ops, | ||
231 | .of_match_table = of_match_ptr(w1_gpio_dt_ids), | 227 | .of_match_table = of_match_ptr(w1_gpio_dt_ids), |
232 | }, | 228 | }, |
233 | .probe = w1_gpio_probe, | 229 | .probe = w1_gpio_probe, |
234 | .remove = w1_gpio_remove, | 230 | .remove = w1_gpio_remove, |
235 | .suspend = w1_gpio_suspend, | ||
236 | .resume = w1_gpio_resume, | ||
237 | }; | 231 | }; |
238 | 232 | ||
239 | module_platform_driver(w1_gpio_driver); | 233 | module_platform_driver(w1_gpio_driver); |