linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] sysfs: Remove CPP abuse
@ 2012-02-14 16:36 Peter Zijlstra
  2012-02-14 17:14 ` Greg KH
  0 siblings, 1 reply; 2+ messages in thread
From: Peter Zijlstra @ 2012-02-14 16:36 UTC (permalink / raw)
  To: Greg KH; +Cc: linux-kernel

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) {


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

* Re: [PATCH] sysfs: Remove CPP abuse
  2012-02-14 16:36 [PATCH] sysfs: Remove CPP abuse Peter Zijlstra
@ 2012-02-14 17:14 ` Greg KH
  0 siblings, 0 replies; 2+ messages in thread
From: Greg KH @ 2012-02-14 17:14 UTC (permalink / raw)
  To: Peter Zijlstra; +Cc: linux-kernel

On Tue, Feb 14, 2012 at 05:36:07PM +0100, Peter Zijlstra wrote:
> 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 ++++--

This is all fixed up already in linux-next, thanks though.

greg k-h

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

end of thread, other threads:[~2012-02-14 17:15 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-02-14 16:36 [PATCH] sysfs: Remove CPP abuse Peter Zijlstra
2012-02-14 17:14 ` Greg KH

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).