PATCH: hwmon-fscher-bugfix-read-control.patch
Mark,
Here is a small fscher bugfix for 2.6.23 merging, lifted from my other fscher work, as requested by Jean. The current driver has a control sysfs attribute, which shows the contents of the control register, but the underlying global_control value in the data structure currently never gets filled with the actual contents of this register.
Regards,
Hans
Mark,
Here is a small fscher bugfix for 2.6.23 merging, lifted from my other fscher work, as requested by Jean. The current driver has a control sysfs attribute, which shows the contents of the control register, but the underlying global_control value in the data structure currently never gets filled with the actual contents of this register.
drivers/hwmon/fscher.c renamed from drivers/hwmon/fscher.c.orig +2 -0
@@ -441,6 +441,8 @@ static struct fscher_data *fscher_update data->watchdog[2 ] =fscher_read_value (client,FSCHER_REG_WDOG_CONTROL ); data->global_event =fscher_read_value (client,FSCHER_REG_EVENT_STATE ); + data->global_control =fscher_read_value (client, +FSCHER_REG_CONTROL ); data->last_updated = jiffies; data->valid =1 ;
_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
Jean Delvare
Acked-byHi Hans,
Quoted 7 lines · Hans de Goede
Here is a small fscher bugfix for 2.6.23 merging, lifted from my other fscher work, as requested by Jean. The current driver has a control sysfs attribute, which shows the contents of the control register, but the underlying
global_controlvalue in the data structure currently never gets filled with the actual contents of this register.Signed-off-by Hans de Goede <[email protected]>
Note that the Linux 2.4 driver in the lm-sensors SVN repository has the same bug, so it should be fixed there too.
While we're here...
static ssize_t set_control(struct i2c_client *client, struct fscher_data *data,
const char *buf, size_t count, int nr, int reg)
{
/* bits 1..7 reserved => mask with 0x01 */
unsigned long v = simple_strtoul(buf, NULL, 10) & 0x01;
mutex_lock(&data->update_lock);
data->global_control &= ~v;
fscher_write_value(client, reg, v);
mutex_unlock(&data->update_lock);
return count;
}Is the code above correct? It behaves as if bit 0 was "write 1 to clear" while the datasheet says this bit is regular read-write, and the Linux 2.4 driver treats it as such.
Signature · 6 lines
Jean Delvare _______________________________________________ lm-sensors mailing list [email protected] http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
Quoted 31 lines · Jean Delvare
Hi Hans,
Quoted 7 lines · Hans de Goede
Here is a small fscher bugfix for 2.6.23 merging, lifted from my other fscher work, as requested by Jean. The current driver has a control sysfs attribute, which shows the contents of the control register, but the underlying
global_controlvalue in the data structure currently never gets filled with the actual contents of this register.Signed-off-by Hans de Goede <[email protected]>Acked-by Jean Delvare <[email protected]>Note that the Linux 2.4 driver in the lm-sensors SVN repository has the same bug, so it should be fixed there too.
While we're here...
static
ssize_tset_control(structi2c_client*client, structfscher_data*data,
const char *buf,size_tcount, int nr, int reg){ /* bits 1..7 reserved => mask with 0x01 */ unsigned long v = simple_strtoul(buf, NULL, 10) & 0x01; mutex_lock(&data->update_lock); data->global_control &= ~v; fscher_write_value(client, reg, v); mutex_unlock(&data->update_lock); return count; }
Quoted 4 lines
Is the code above correct? It behaves as if bit 0 was "write 1 to clear" while the datasheet says this bit is regular read-write, and the Linux 2.4 driver treats it as such.
You are right, good catch. I'll send a patch fixing this right after this mail.
Regards,
Hans
_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
Hi:
Quoted 11 lines · Hans de Goede
Here is a small fscher bugfix for 2.6.23 merging, lifted from my other fscher work, as requested by Jean. The current driver has a control sysfs attribute, which shows the contents of the control register, but the underlying
global_controlvalue in the data structure currently never gets filled with the actual contents of this register.Signed-off-by Hans de Goede <[email protected]>diff -up linux-2.6.22-rc4/drivers/hwmon/fscher.c.orig
linux-2.6.22-rc4/drivers/hwmon/fscher.c
drivers/hwmon/fscher.c static struct fscher_data *fscher_update · line 448
Quoted 8 lines
drivers/hwmon/fscher.c renamed from drivers/hwmon/fscher.c.orig +2
-0@@ -441,6 +441,8 @@ static struct fscher_data *fscher_update data->watchdog[2 ] =fscher_read_value (client,FSCHER_REG_WDOG_CONTROL ); data->global_event =fscher_read_value (client,FSCHER_REG_EVENT_STATE ); + data->global_control =fscher_read_value (client, +FSCHER_REG_CONTROL ); data->last_updated = jiffies; data->valid =1 ;
Applied to hwmon-2.6.git/testing, thanks.
Signature · 8 lines
Mark M. Hoffman [email protected] _______________________________________________ lm-sensors mailing list [email protected] http://lists.lm-sensors.org/mailman/listinfo/lm-sensors