* [patch] sensors/w83781d.c creates useless sysfs entries
@ 2003-10-11 13:29 Jindrich Makovicka
2003-10-11 16:32 ` Kronos
0 siblings, 1 reply; 4+ messages in thread
From: Jindrich Makovicka @ 2003-10-11 13:29 UTC (permalink / raw)
To: linux-kernel
[-- Attachment #1: Type: text/plain, Size: 241 bytes --]
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,
--
Jindrich Makovicka
[-- Attachment #2: w83781d.c.patch --]
[-- Type: text/plain, Size: 1333 bytes --]
--- w83781d.c.orig 2003-10-02 08:17:20.000000000 +0200
+++ w83781d.c 2003-10-11 14:45:59.000000000 +0200
@@ -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);
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [patch] sensors/w83781d.c creates useless sysfs entries
2003-10-11 13:29 [patch] sensors/w83781d.c creates useless sysfs entries Jindrich Makovicka
@ 2003-10-11 16:32 ` Kronos
2003-10-13 19:31 ` Greg KH
0 siblings, 1 reply; 4+ messages in thread
From: Kronos @ 2003-10-11 16:32 UTC (permalink / raw)
To: linux-kernel; +Cc: frodol, Jindrich Makovicka
Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz> ha scritto:
> 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:
--- a/drivers/i2c/chips/w83781d.c Sun Sep 28 17:47:38 2003
+++ b/drivers/i2c/chips/w83781d.c Sat Oct 11 18:31:04 2003
@@ -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
--
Reply-To: kronos@kronoz.cjb.net
Home: http://kronoz.cjb.net
Windows NT: Designed for the Internet. The Internet: Designed for Unix.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [patch] sensors/w83781d.c creates useless sysfs entries
2003-10-11 16:32 ` Kronos
@ 2003-10-13 19:31 ` Greg KH
0 siblings, 0 replies; 4+ messages in thread
From: Greg KH @ 2003-10-13 19:31 UTC (permalink / raw)
To: Kronos; +Cc: linux-kernel, frodol, Jindrich Makovicka
On Sat, Oct 11, 2003 at 06:32:44PM +0200, Kronos wrote:
> Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz> ha scritto:
> > 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
^ permalink raw reply [flat|nested] 4+ messages in thread
* [patch] sensors/w83781d.c creates useless sysfs entries
@ 2005-05-19 6:24 Greg KH
0 siblings, 0 replies; 4+ messages in thread
From: Greg KH @ 2005-05-19 6:24 UTC (permalink / raw)
To: lm-sensors
On Tue, Oct 14, 2003 at 05:27:45PM +0200, Kronos wrote:
> Il Mon, Oct 13, 2003 at 12:31:14PM -0700, Greg KH ha scritto:
> > On Sat, Oct 11, 2003 at 06:32:44PM +0200, Kronos wrote:
> > > Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz> ha scritto:
> > > > 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.
>
> I've reviewed the patch, there was a trailing ";" that wasn't supposed
> to be there:
Good catch. Actually there were some other issues with those macros.
I've applied the patch below to the tree.
thanks,
greg k-h
# I2C: fix more define problems in w83781d driver
diff -Nru a/drivers/i2c/chips/w83781d.c b/drivers/i2c/chips/w83781d.c
--- a/drivers/i2c/chips/w83781d.c Tue Oct 14 13:22:22 2003
+++ b/drivers/i2c/chips/w83781d.c Tue Oct 14 13:22:22 2003
@@ -426,7 +426,7 @@
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); \
-} while (0);
+} while (0)
#define show_fan_reg(reg) \
static ssize_t show_##reg (struct device *dev, char *buf, int nr) \
@@ -484,8 +484,10 @@
sysfs_fan_min_offset(3);
#define device_create_file_fan(client, offset) \
+do { \
device_create_file(&client->dev, &dev_attr_fan_input##offset); \
device_create_file(&client->dev, &dev_attr_fan_min##offset); \
+} while (0)
#define show_temp_reg(reg) \
static ssize_t show_##reg (struct device *dev, char *buf, int nr) \
@@ -568,9 +570,11 @@
sysfs_temp_offsets(3);
#define device_create_file_temp(client, offset) \
+do { \
device_create_file(&client->dev, &dev_attr_temp_input##offset); \
device_create_file(&client->dev, &dev_attr_temp_max##offset); \
-device_create_file(&client->dev, &dev_attr_temp_min##offset);
+device_create_file(&client->dev, &dev_attr_temp_min##offset); \
+} while (0)
static ssize_t
show_vid_reg(struct device *dev, char *buf)
@@ -693,8 +697,10 @@
sysfs_beep(MASK, mask);
#define device_create_file_beep(client) \
+do { \
device_create_file(&client->dev, &dev_attr_beep_enable); \
-device_create_file(&client->dev, &dev_attr_beep_mask);
+device_create_file(&client->dev, &dev_attr_beep_mask); \
+} while (0)
/* w83697hf only has two fans */
static ssize_t
@@ -771,7 +777,9 @@
sysfs_fan_div(3);
#define device_create_file_fan_div(client, offset) \
+do { \
device_create_file(&client->dev, &dev_attr_fan_div##offset); \
+} while (0)
/* w83697hf only has two fans */
static ssize_t
@@ -883,10 +891,14 @@
sysfs_pwm(4);
#define device_create_file_pwm(client, offset) \
+do { \
device_create_file(&client->dev, &dev_attr_pwm##offset); \
+} while (0)
#define device_create_file_pwmenable(client, offset) \
+do { \
device_create_file(&client->dev, &dev_attr_pwm_enable##offset); \
+} while (0)
static ssize_t
show_sensor_reg(struct device *dev, char *buf, int nr)
@@ -959,7 +971,9 @@
sysfs_sensor(3);
#define device_create_file_sensor(client, offset) \
+do { \
device_create_file(&client->dev, &dev_attr_sensor##offset); \
+} while (0)
#ifdef W83781D_RT
static ssize_t
@@ -1018,7 +1032,9 @@
sysfs_rt(3);
#define device_create_file_rt(client, offset) \
+do { \
device_create_file(&client->dev, &dev_attr_rt##offset); \
+} while (0)
#endif /* ifdef W83781D_RT */
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2005-05-19 6:24 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-10-11 13:29 [patch] sensors/w83781d.c creates useless sysfs entries Jindrich Makovicka
2003-10-11 16:32 ` Kronos
2003-10-13 19:31 ` Greg KH
2005-05-19 6:24 Greg KH
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.