Skip to contentSkip to conversation

sysfs: Remove CPP abuse

PATCH In review Peter Zijlstra 2 participants 2 messages Feb 14, 2012 Driver core

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 sysfs: Remove CPP abuse

There's absolutely no reason to abuse CPP to shorten a common sub expression, C has variables for this.

---
 fs/sysfs/dir.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)
fs/sysfs/dir.c +4 -2
index 7fdf6a7..80fb6e6 100644
@@ -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) {
#1 lore raw
Quoted 7 lines · Peter Zijlstra

There's absolutely no reason to abuse CPP to shorten a common sub expression, C has variables for this.

---
 fs/sysfs/dir.c |    6 ++++--

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

greg k-h