linux-pm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] PM/CORE: Fix using sizeof without parenthesis in the sysfs.c
@ 2013-01-28  8:31 Lan Tianyu
  2013-01-28  9:03 ` James Courtier-Dutton
  0 siblings, 1 reply; 6+ messages in thread
From: Lan Tianyu @ 2013-01-28  8:31 UTC (permalink / raw)
  To: rjw; +Cc: Lan Tianyu, linux-pm, linux-acpi

Kernel style uses parenthesis around sizeof. Commit 66c80b60
has already added such check in the scripts/checkpatch.pl.

Signed-off-by: Lan Tianyu <tianyu.lan@intel.com>
---
 drivers/base/power/sysfs.c |   16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/base/power/sysfs.c b/drivers/base/power/sysfs.c
index 50d16e3..f089b80 100644
--- a/drivers/base/power/sysfs.c
+++ b/drivers/base/power/sysfs.c
@@ -119,9 +119,9 @@ static ssize_t control_store(struct device * dev, struct device_attribute *attr,
 	if (cp)
 		len = cp - buf;
 	device_lock(dev);
-	if (len == sizeof ctrl_auto - 1 && strncmp(buf, ctrl_auto, len) == 0)
+	if (len == sizeof(ctrl_auto - 1) && strncmp(buf, ctrl_auto, len) == 0)
 		pm_runtime_allow(dev);
-	else if (len == sizeof ctrl_on - 1 && strncmp(buf, ctrl_on, len) == 0)
+	else if (len == sizeof(ctrl_on - 1) && strncmp(buf, ctrl_on, len) == 0)
 		pm_runtime_forbid(dev);
 	else
 		n = -EINVAL;
@@ -321,11 +321,11 @@ wake_store(struct device * dev, struct device_attribute *attr,
 	cp = memchr(buf, '\n', n);
 	if (cp)
 		len = cp - buf;
-	if (len == sizeof enabled - 1
-			&& strncmp(buf, enabled, sizeof enabled - 1) == 0)
+	if (len == sizeof(enabled - 1)
+			&& strncmp(buf, enabled, sizeof(enabled - 1)) == 0)
 		device_set_wakeup_enable(dev, 1);
-	else if (len == sizeof disabled - 1
-			&& strncmp(buf, disabled, sizeof disabled - 1) == 0)
+	else if (len == sizeof(disabled - 1)
+			&& strncmp(buf, disabled, sizeof(disabled - 1)) == 0)
 		device_set_wakeup_enable(dev, 0);
 	else
 		return -EINVAL;
@@ -546,9 +546,9 @@ static ssize_t async_store(struct device *dev, struct device_attribute *attr,
 	cp = memchr(buf, '\n', n);
 	if (cp)
 		len = cp - buf;
-	if (len == sizeof enabled - 1 && strncmp(buf, enabled, len) == 0)
+	if (len == sizeof(enabled - 1) && strncmp(buf, enabled, len) == 0)
 		device_enable_async_suspend(dev);
-	else if (len == sizeof disabled - 1 && strncmp(buf, disabled, len) == 0)
+	else if (len == sizeof(disabled - 1) && strncmp(buf, disabled, len) == 0)
 		device_disable_async_suspend(dev);
 	else
 		return -EINVAL;
-- 
1.7.10.4


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2013-01-28 13:39 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-01-28  8:31 [PATCH] PM/CORE: Fix using sizeof without parenthesis in the sysfs.c Lan Tianyu
2013-01-28  9:03 ` James Courtier-Dutton
2013-01-28 12:18   ` Rafael J. Wysocki
2013-01-28 13:04     ` Lan Tianyu
2013-01-28 13:13       ` Rafael J. Wysocki
2013-01-28 13:39         ` Lan Tianyu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).