diff options
author | Johannes Berg <johannes.berg@intel.com> | 2014-09-08 02:48:00 -0400 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2014-09-08 09:40:18 -0400 |
commit | 2b4f43131da08881423213dace0a514f325fe134 (patch) | |
tree | 465bc5ec27966963816e5f838d72695cea9084ea | |
parent | 2ce7598c9a453e0acd0e07be7be3f5eb39608ebd (diff) |
PM / sysfs: avoid shadowing variables
The global variable "enabled" is shadowed in a number of
functions in this file, rename it to "_enabled" to avoid
that. For consistency, also rename "disabled" and move
them both into the #ifdef where they're needed.
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Acked-by: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
-rw-r--r-- | drivers/base/power/sysfs.c | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/drivers/base/power/sysfs.c b/drivers/base/power/sysfs.c index 95b181d1ca6d..a9d26ed11bf4 100644 --- a/drivers/base/power/sysfs.c +++ b/drivers/base/power/sysfs.c | |||
@@ -92,9 +92,6 @@ | |||
92 | * wakeup_count - Report the number of wakeup events related to the device | 92 | * wakeup_count - Report the number of wakeup events related to the device |
93 | */ | 93 | */ |
94 | 94 | ||
95 | static const char enabled[] = "enabled"; | ||
96 | static const char disabled[] = "disabled"; | ||
97 | |||
98 | const char power_group_name[] = "power"; | 95 | const char power_group_name[] = "power"; |
99 | EXPORT_SYMBOL_GPL(power_group_name); | 96 | EXPORT_SYMBOL_GPL(power_group_name); |
100 | 97 | ||
@@ -336,11 +333,14 @@ static DEVICE_ATTR(pm_qos_remote_wakeup, 0644, | |||
336 | #endif /* CONFIG_PM_RUNTIME */ | 333 | #endif /* CONFIG_PM_RUNTIME */ |
337 | 334 | ||
338 | #ifdef CONFIG_PM_SLEEP | 335 | #ifdef CONFIG_PM_SLEEP |
336 | static const char _enabled[] = "enabled"; | ||
337 | static const char _disabled[] = "disabled"; | ||
338 | |||
339 | static ssize_t | 339 | static ssize_t |
340 | wake_show(struct device * dev, struct device_attribute *attr, char * buf) | 340 | wake_show(struct device * dev, struct device_attribute *attr, char * buf) |
341 | { | 341 | { |
342 | return sprintf(buf, "%s\n", device_can_wakeup(dev) | 342 | return sprintf(buf, "%s\n", device_can_wakeup(dev) |
343 | ? (device_may_wakeup(dev) ? enabled : disabled) | 343 | ? (device_may_wakeup(dev) ? _enabled : _disabled) |
344 | : ""); | 344 | : ""); |
345 | } | 345 | } |
346 | 346 | ||
@@ -357,11 +357,11 @@ wake_store(struct device * dev, struct device_attribute *attr, | |||
357 | cp = memchr(buf, '\n', n); | 357 | cp = memchr(buf, '\n', n); |
358 | if (cp) | 358 | if (cp) |
359 | len = cp - buf; | 359 | len = cp - buf; |
360 | if (len == sizeof enabled - 1 | 360 | if (len == sizeof _enabled - 1 |
361 | && strncmp(buf, enabled, sizeof enabled - 1) == 0) | 361 | && strncmp(buf, _enabled, sizeof _enabled - 1) == 0) |
362 | device_set_wakeup_enable(dev, 1); | 362 | device_set_wakeup_enable(dev, 1); |
363 | else if (len == sizeof disabled - 1 | 363 | else if (len == sizeof _disabled - 1 |
364 | && strncmp(buf, disabled, sizeof disabled - 1) == 0) | 364 | && strncmp(buf, _disabled, sizeof _disabled - 1) == 0) |
365 | device_set_wakeup_enable(dev, 0); | 365 | device_set_wakeup_enable(dev, 0); |
366 | else | 366 | else |
367 | return -EINVAL; | 367 | return -EINVAL; |
@@ -570,7 +570,8 @@ static ssize_t async_show(struct device *dev, struct device_attribute *attr, | |||
570 | char *buf) | 570 | char *buf) |
571 | { | 571 | { |
572 | return sprintf(buf, "%s\n", | 572 | return sprintf(buf, "%s\n", |
573 | device_async_suspend_enabled(dev) ? enabled : disabled); | 573 | device_async_suspend_enabled(dev) ? |
574 | _enabled : _disabled); | ||
574 | } | 575 | } |
575 | 576 | ||
576 | static ssize_t async_store(struct device *dev, struct device_attribute *attr, | 577 | static ssize_t async_store(struct device *dev, struct device_attribute *attr, |
@@ -582,9 +583,10 @@ static ssize_t async_store(struct device *dev, struct device_attribute *attr, | |||
582 | cp = memchr(buf, '\n', n); | 583 | cp = memchr(buf, '\n', n); |
583 | if (cp) | 584 | if (cp) |
584 | len = cp - buf; | 585 | len = cp - buf; |
585 | if (len == sizeof enabled - 1 && strncmp(buf, enabled, len) == 0) | 586 | if (len == sizeof _enabled - 1 && strncmp(buf, _enabled, len) == 0) |
586 | device_enable_async_suspend(dev); | 587 | device_enable_async_suspend(dev); |
587 | else if (len == sizeof disabled - 1 && strncmp(buf, disabled, len) == 0) | 588 | else if (len == sizeof _disabled - 1 && |
589 | strncmp(buf, _disabled, len) == 0) | ||
588 | device_disable_async_suspend(dev); | 590 | device_disable_async_suspend(dev); |
589 | else | 591 | else |
590 | return -EINVAL; | 592 | return -EINVAL; |