diff options
author | Grygorii Strashko <Grygorii.Strashko@linaro.org> | 2015-02-03 10:01:58 -0500 |
---|---|---|
committer | Guenter Roeck <linux@roeck-us.net> | 2015-02-03 15:17:12 -0500 |
commit | dd378b1bcaa0ef5b14cca1e52b58ef9a3279fd8b (patch) | |
tree | 2fe042e39cac88aac18ca67c062673f1c4acae4c /drivers/hwmon | |
parent | 7f444bf0a28c030d40925c5d0073d3e5ed8ca1e3 (diff) |
hwmon: (tmp102) add hibernation callbacks
Setting a dev_pm_ops suspend/resume pair but not a set of
hibernation functions means those pm functions will not be
called upon hibernation.
Fix this by using SIMPLE_DEV_PM_OPS, which appropriately
assigns the suspend and hibernation handlers and move
mp102_suspend/tmp102_resume under CONFIG_PM_SLEEP to avoid
build warnings.
Signed-off-by: Grygorii Strashko <Grygorii.Strashko@linaro.org>
[groeck: Declare tmp102_dev_pm_ops as static variable]
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Diffstat (limited to 'drivers/hwmon')
-rw-r--r-- | drivers/hwmon/tmp102.c | 15 |
1 files changed, 4 insertions, 11 deletions
diff --git a/drivers/hwmon/tmp102.c b/drivers/hwmon/tmp102.c index ba9f478f64ee..9da2735f1424 100644 --- a/drivers/hwmon/tmp102.c +++ b/drivers/hwmon/tmp102.c | |||
@@ -253,7 +253,7 @@ static int tmp102_remove(struct i2c_client *client) | |||
253 | return 0; | 253 | return 0; |
254 | } | 254 | } |
255 | 255 | ||
256 | #ifdef CONFIG_PM | 256 | #ifdef CONFIG_PM_SLEEP |
257 | static int tmp102_suspend(struct device *dev) | 257 | static int tmp102_suspend(struct device *dev) |
258 | { | 258 | { |
259 | struct i2c_client *client = to_i2c_client(dev); | 259 | struct i2c_client *client = to_i2c_client(dev); |
@@ -279,17 +279,10 @@ static int tmp102_resume(struct device *dev) | |||
279 | config &= ~TMP102_CONF_SD; | 279 | config &= ~TMP102_CONF_SD; |
280 | return i2c_smbus_write_word_swapped(client, TMP102_CONF_REG, config); | 280 | return i2c_smbus_write_word_swapped(client, TMP102_CONF_REG, config); |
281 | } | 281 | } |
282 | |||
283 | static const struct dev_pm_ops tmp102_dev_pm_ops = { | ||
284 | .suspend = tmp102_suspend, | ||
285 | .resume = tmp102_resume, | ||
286 | }; | ||
287 | |||
288 | #define TMP102_DEV_PM_OPS (&tmp102_dev_pm_ops) | ||
289 | #else | ||
290 | #define TMP102_DEV_PM_OPS NULL | ||
291 | #endif /* CONFIG_PM */ | 282 | #endif /* CONFIG_PM */ |
292 | 283 | ||
284 | static SIMPLE_DEV_PM_OPS(tmp102_dev_pm_ops, tmp102_suspend, tmp102_resume); | ||
285 | |||
293 | static const struct i2c_device_id tmp102_id[] = { | 286 | static const struct i2c_device_id tmp102_id[] = { |
294 | { "tmp102", 0 }, | 287 | { "tmp102", 0 }, |
295 | { } | 288 | { } |
@@ -298,7 +291,7 @@ MODULE_DEVICE_TABLE(i2c, tmp102_id); | |||
298 | 291 | ||
299 | static struct i2c_driver tmp102_driver = { | 292 | static struct i2c_driver tmp102_driver = { |
300 | .driver.name = DRIVER_NAME, | 293 | .driver.name = DRIVER_NAME, |
301 | .driver.pm = TMP102_DEV_PM_OPS, | 294 | .driver.pm = &tmp102_dev_pm_ops, |
302 | .probe = tmp102_probe, | 295 | .probe = tmp102_probe, |
303 | .remove = tmp102_remove, | 296 | .remove = tmp102_remove, |
304 | .id_table = tmp102_id, | 297 | .id_table = tmp102_id, |