From: Lan Tianyu <tianyu.lan@intel.com>
To: rjw@sisk.pl
Cc: Lan Tianyu <tianyu.lan@intel.com>,
linux-pm@vger.kernel.org, linux-acpi@vger.kernel.org
Subject: [PATCH] PM/CORE: Fix using sizeof without parenthesis in the sysfs.c
Date: Mon, 28 Jan 2013 16:31:49 +0800 [thread overview]
Message-ID: <1359361909-28793-1-git-send-email-tianyu.lan@intel.com> (raw)
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
next reply other threads:[~2013-01-28 8:31 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-01-28 8:31 Lan Tianyu [this message]
2013-01-28 9:03 ` [PATCH] PM/CORE: Fix using sizeof without parenthesis in the sysfs.c 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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1359361909-28793-1-git-send-email-tianyu.lan@intel.com \
--to=tianyu.lan@intel.com \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=rjw@sisk.pl \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).