Skip to contentSkip to conversation

sensors/w83781d.c creates useless sysfs entries

PATCH In review Jindrich Makovicka 3 participants 3 messages Oct 11, 2003 – Oct 13, 2003

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 sensors/w83781d.c creates useless sysfs entries

Hello,

here is a trivial fix for Winbond sensor driver, which currently creates useless entries in sys/bus/i2c due to missing braces after if statements - author probably forgot about the macro expansion.

Regards,

Signature · 1 line
Jindrich Makovicka
w83781d.c renamed from w83781d.c.orig +17 -10
@@ -1347,8 +1347,10 @@
 	}
 
 	device_create_file_in(new_client, 0);
-	if (kind != w83783s && kind != w83697hf)
+	if (kind != w83783s && kind != w83697hf) {
 		device_create_file_in(new_client, 1);
+	}
+	
 	device_create_file_in(new_client, 2);
 	device_create_file_in(new_client, 3);
 	device_create_file_in(new_client, 4);
@@ -1361,25 +1363,30 @@
 
 	device_create_file_fan(new_client, 1);
 	device_create_file_fan(new_client, 2);
-	if (kind != w83697hf)
+	if (kind != w83697hf) {
 		device_create_file_fan(new_client, 3);
+	}
 
 	device_create_file_temp(new_client, 1);
 	device_create_file_temp(new_client, 2);
-	if (kind != w83783s && kind != w83697hf)
+	if (kind != w83783s && kind != w83697hf) {
 		device_create_file_temp(new_client, 3);
-
-	if (kind != w83697hf)
+	}
+	
+	if (kind != w83697hf) {
 		device_create_file_vid(new_client);
-
-	if (kind != w83697hf)
+	}
+	
+	if (kind != w83697hf) {
 		device_create_file_vrm(new_client);
-
+	}
+	
 	device_create_file_fan_div(new_client, 1);
 	device_create_file_fan_div(new_client, 2);
-	if (kind != w83697hf)
+	if (kind != w83697hf) {
 		device_create_file_fan_div(new_client, 3);
-
+	}
+	
 	device_create_file_alarms(new_client);
 
 	device_create_file_beep(new_client);
#1 lore raw

Jindrich Makovicka <[email protected]> ha scritto:

Quoted 5 lines

Hello,

here is a trivial fix for Winbond sensor driver, which currently creates useless entries in sys/bus/i2c due to missing braces after if statements
- author probably forgot about the macro expansion.

IMHO it's better to fix the macro:

drivers/i2c/chips/w83781d.c +3 -1
@@ -422,9 +422,11 @@
 sysfs_in_offsets(8);
 
 #define device_create_file_in(client, offset) \
+do { \
 device_create_file(&client->dev, &dev_attr_in_input##offset); \
 device_create_file(&client->dev, &dev_attr_in_min##offset); \
-device_create_file(&client->dev, &dev_attr_in_max##offset);
+device_create_file(&client->dev, &dev_attr_in_max##offset); \
+} while (0);
 
 #define show_fan_reg(reg) \
 static ssize_t show_##reg (struct device *dev, char *buf, int nr) \

Luca

Signature · 3 lines
Reply-To: [email protected]
Home: http://kronoz.cjb.net
Windows NT: Designed for the Internet. The Internet: Designed for Unix.
#2 lore raw
Quoted 8 lines · Kronos

Jindrich Makovicka <[email protected]> ha scritto:

Quoted 5 lines

Hello,

here is a trivial fix for Winbond sensor driver, which currently creates useless entries in sys/bus/i2c due to missing braces after if statements
- author probably forgot about the macro expansion.

IMHO it's better to fix the macro:

Thanks, I've applied this version.

greg k-h