From: Peter Zijlstra <peterz@infradead.org>
To: Greg KH <greg@kroah.com>
Cc: linux-kernel <linux-kernel@vger.kernel.org>
Subject: [PATCH] sysfs: Remove CPP abuse
Date: Tue, 14 Feb 2012 17:36:07 +0100 [thread overview]
Message-ID: <1329237367.2293.17.camel@twins> (raw)
There's absolutely no reason to abuse CPP to shorten a common sub
expression, C has variables for this.
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
---
fs/sysfs/dir.c | 6 ++++--
1 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/fs/sysfs/dir.c b/fs/sysfs/dir.c
index 7fdf6a7..80fb6e6 100644
--- a/fs/sysfs/dir.c
+++ b/fs/sysfs/dir.c
@@ -576,8 +576,11 @@ struct sysfs_dirent *sysfs_find_dirent(struct sysfs_dirent *parent_sd,
}
while (p) {
+ struct sysfs_dirent *node;
int c;
-#define node rb_entry(p, struct sysfs_dirent, name_node)
+
+ node = rb_entry(p, struct sysfs_dirent, name_node);
+
c = strcmp(name, node->s_name);
if (c < 0) {
p = node->name_node.rb_left;
@@ -587,7 +590,6 @@ struct sysfs_dirent *sysfs_find_dirent(struct sysfs_dirent *parent_sd,
found = node;
p = node->name_node.rb_left;
}
-#undef node
}
if (found) {
next reply other threads:[~2012-02-14 16:36 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-02-14 16:36 Peter Zijlstra [this message]
2012-02-14 17:14 ` Greg KH
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=1329237367.2293.17.camel@twins \
--to=peterz@infradead.org \
--cc=greg@kroah.com \
--cc=linux-kernel@vger.kernel.org \
/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
Powered by JetHome