PATCH: hwmon-fschmd-new-driver-v2.patch
Hi All,
This patch adds a new merged driver for FSC sensor chips, it merges the fscher and fscpos drivers and adds support for the FSC Scylla, Heracles and Heimdall chips.
This version of the patch has had all issues found during the review by Jean Delvare addressed:
http://lists.lm-sensors.org/pipermail/lm-sensors/2007-October/021396.html
Jean, can you please ack this one?
Mark, can you please apply this before the opening of the 2.6.24 merge window?
Thanks & Regards,
Hans
This patch adds a new merged driver for FSC sensor chips, it merges the fscher and fscpos drivers and adds support for the FSC Scylla, Heracles and Heimdall chips.
This version of the patch has had all issues found during the review by Jean Delvare addressed:
http://lists.lm-sensors.org/pipermail/lm-sensors/2007-October/021396.html
drivers/hwmon/Kconfig renamed from drivers/hwmon/Kconfig.fschmd +14 -0
@@ -236,6 +236,20 @@ config SENSORS_FSCPOS This driver can also be built as a module. If so, the module will be called fscpos. +config SENSORS_FSCHMD + tristate "FSC Poseidon, Scylla, Hermes, Heimdall and Heracles" + depends on X86 && I2C && EXPERIMENTAL + help + If you say yes here you get support for various Fujitsu Siemens + Computers sensor chips. + + This is a new merged driver for FSC sensor chips which is intended + as a replacment for the fscpos, fscscy and fscher drivers and adds + support for several other FCS sensor chips. + + This driver can also be built as a module. If so, the module + will be called fschmd. + config SENSORS_GL518SM tristate "Genesys Logic GL518SM" depends on I2C
drivers/hwmon/fschmd.c new file +778 -0
778 lines not on this page · raw message
drivers/hwmon/Makefile renamed from drivers/hwmon/Makefile.fschmd +1 -0
@@ -30,6 +30,7 @@ obj-$(CONFIG_SENSORS_DME1737) += dme1737 obj-$(CONFIG_SENSORS_DS1621) += ds1621.o obj-$(CONFIG_SENSORS_F71805F) += f71805f.o obj-$(CONFIG_SENSORS_FSCHER) += fscher.o +obj-$(CONFIG_SENSORS_FSCHMD) += fschmd.o obj-$(CONFIG_SENSORS_FSCPOS) += fscpos.o obj-$(CONFIG_SENSORS_GL518SM) += gl518sm.o obj-$(CONFIG_SENSORS_GL520SM) += gl520sm.o
_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
Hi Hans,
Quoted 11 lines · Hans de Goede
This patch adds a new merged driver for FSC sensor chips, it merges the fscher and fscpos drivers and adds support for the FSC Scylla, Heracles and Heimdall chips.
This version of the patch has had all issues found during the review by Jean Delvare addressed:
http://lists.lm-sensors.org/pipermail/lm-sensors/2007-October/021396.htmlSigned-off-by Hans de Goede <[email protected]>Jean, can you please ack this one?
Can't ack it as there's one bug remaining :/ And I have a few suggestions for improvements as well.
Quoted 7 lines
drivers/hwmon/fschmd.c new file +7
-0+static ssize_t store_alert_led (struct device *dev, +struct device_attribute *devattr,const char *buf,size_t count) +{ +u8 reg; +struct fschmd_data *data =dev_get_drvdata (dev); +unsigned long v =simple_strtoul (buf,NULL ,10 ); +
drivers/hwmon/fschmd.c line 445
Quoted 10 lines
drivers/hwmon/fschmd.c new file +10
-0+mutex_lock (&data->update_lock); + + reg =i2c_smbus_read_byte_data (&data->client,FSCHMD_REG_CONTROL ); + +if (v) + reg |=FSCHMD_CONTROL_ALERT_LED_MASK ; +else + reg &= ~FSCHMD_CONTROL_ALERT_LED_MASK ; + +i2c_smbus_write_byte_data (&data->client,FSCHMD_REG_CONTROL , v);
You want to write "reg" here, not "v".
drivers/hwmon/fschmd.c line 453
Quoted 8 lines
drivers/hwmon/fschmd.c new file +8
-0+ + data->global_control = reg; + +mutex_unlock (&data->update_lock); + +return count; +} +
You could also use FSCHMD_CONTROL_ALERT_LED_MASK instead of 0x01 in show_alert_led().
drivers/hwmon/fschmd.c line 604
Quoted 11 lines
drivers/hwmon/fschmd.c new file +10
-0+static int fschmd_detect (struct i2c_adapter *adapter,int address,int kind) +{ +for (i =0 ; i <ARRAY_SIZE (fschmd_attr); i++) { + err =device_create_file (&client->dev, + &fschmd_attr[i].dev_attr); +if (err) + goto exit_detach; + } + +for (i =0 ; i < (FSCHMD_NO_TEMP_SENSORS [data->kind] *4 ); i++) {
Why don't you just use ARRAY_SIZE()? Less likely to break with future changes.
drivers/hwmon/fschmd.c line 616
Quoted 12 lines
drivers/hwmon/fschmd.c new file +12
-0+/* Poseidon doesn't have TEMP_LIMIT registers */ +if (kind = fscpos && fschmd_temp_attr[i].dev_attr.show = + show_temp_max) +continue ; + + err =device_create_file (&client->dev, + &fschmd_temp_attr[i].dev_attr); +if (err) + goto exit_detach; + } + +for (i =0 ; i < (FSCHMD_NO_FAN_SENSORS [data->kind] *5 ); i++) {
Same here. And same in fschmd_detach_client().
The rest looks all OK now. Please post a last update and I'll ack it tomorrow.
One more note: there's a lot of trailing whitespace in your driver. I think Mark will strip it before committing your patch but it would be easier for everyone if you could avoid trailing whitespace in future patches.
Signature · 6 lines
Jean Delvare _______________________________________________ lm-sensors mailing list [email protected] http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
Quoted 29 lines · Jean Delvare
Hi Hans,
Quoted 11 lines · Hans de Goede
This patch adds a new merged driver for FSC sensor chips, it merges the fscher and fscpos drivers and adds support for the FSC Scylla, Heracles and Heimdall chips.
This version of the patch has had all issues found during the review by Jean Delvare addressed:
http://lists.lm-sensors.org/pipermail/lm-sensors/2007-October/021396.htmlSigned-off-by Hans de Goede <[email protected]>Jean, can you please ack this one?
Can't ack it as there's one bug remaining :/ And I have a few suggestions for improvements as well.
Quoted 11 lines
drivers/hwmon/fschmd.c new file +11
-0+static ssize_t store_alert_led (struct device *dev, +struct device_attribute *devattr,const char *buf,size_t count) +{ +u8 reg; +struct fschmd_data *data =dev_get_drvdata (dev); +unsigned long v =simple_strtoul (buf,NULL ,10 ); + +mutex_lock (&data->update_lock); + + reg =i2c_smbus_read_byte_data (&data->client,FSCHMD_REG_CONTROL ); +
Quoted 9 lines
drivers/hwmon/fschmd.c line 445
Quoted 6 lines
drivers/hwmon/fschmd.c new file +6
-0+if (v) + reg |=FSCHMD_CONTROL_ALERT_LED_MASK ; +else + reg &= ~FSCHMD_CONTROL_ALERT_LED_MASK ; + +i2c_smbus_write_byte_data (&data->client,FSCHMD_REG_CONTROL , v);You want to write "reg" here, not "v".
Good catch (caused by the do not use update_device changes).
Quoted 12 lines
drivers/hwmon/fschmd.c line 453
Quoted 8 lines
drivers/hwmon/fschmd.c new file +8
-0+ + data->global_control = reg; + +mutex_unlock (&data->update_lock); + +return count; +} +You could also use
FSCHMD_CONTROL_ALERT_LED_MASKinstead of0x01inshow_alert_led().
Will fix.
Quoted 6 lines
Quoted 6 lines
drivers/hwmon/fschmd.c new file +5
-0+static int fschmd_detect (struct i2c_adapter *adapter,int address,int kind) +{ +for (i =0 ; i <ARRAY_SIZE (fschmd_attr); i++) { + err =device_create_file (&client->dev, + &fschmd_attr[i].dev_attr);
Quoted 9 lines
drivers/hwmon/fschmd.c line 604
Quoted 5 lines
drivers/hwmon/fschmd.c new file +5
-0+if (err) + goto exit_detach; + } + +for (i =0 ; i < (FSCHMD_NO_TEMP_SENSORS [data->kind] *4 ); i++) {Why don't you just use
ARRAY_SIZE()? Less likely to break with future changes.
Because the array contains attributes for the maximum number of temp sensors and not all models have the maximum number, hence FSCHMD_NO_TEMP_SENSORS[data->kind] gets used, I agree this isn't ideal.
Quoted 6 lines
Quoted 6 lines
drivers/hwmon/fschmd.c new file +6
-0+/* Poseidon doesn't have TEMP_LIMIT registers */ +if (kind = fscpos && fschmd_temp_attr[i].dev_attr.show = + show_temp_max) +continue ; + + err = device_create_file(&client->dev,
Quoted 9 lines
drivers/hwmon/fschmd.c line 616
Quoted 6 lines
drivers/hwmon/fschmd.c new file +6
-0+ &fschmd_temp_attr[i].dev_attr); +if (err) + goto exit_detach; + } + +for (i =0 ; i < (FSCHMD_NO_FAN_SENSORS [data->kind] *5 ); i++) {Same here. And same in
fschmd_detach_client().
See above.
Quoted 3 lines
The rest looks all OK now. Please post a last update and I'll ack it tomorrow.
I'll do a new version somewhere today.
Quoted 5 lines
One more note: there's a lot of trailing whitespace in your driver. I think Mark will strip it before committing your patch but it would be easier for everyone if you could avoid trailing whitespace in future patches.
Are there any tools for this? You've mentioned this before and I have tried to avoid adding trailing whitespace while editing, but I guess that doesn't help much.
Regards,
Hans
_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
Hi Hans,
Quoted 39 lines · Hans de Goede
Quoted 29 lines · Jean Delvare
Hi Hans,
Quoted 11 lines · Hans de Goede
This patch adds a new merged driver for FSC sensor chips, it merges the fscher and fscpos drivers and adds support for the FSC Scylla, Heracles and Heimdall chips.
This version of the patch has had all issues found during the review by Jean Delvare addressed:
http://lists.lm-sensors.org/pipermail/lm-sensors/2007-October/021396.htmlSigned-off-by Hans de Goede <[email protected]>Jean, can you please ack this one?
Can't ack it as there's one bug remaining :/ And I have a few suggestions for improvements as well.
Quoted 11 lines
drivers/hwmon/fschmd.c new file +11
-0+static ssize_t store_alert_led (struct device *dev, +struct device_attribute *devattr,const char *buf,size_t count) +{ +u8 reg; +struct fschmd_data *data =dev_get_drvdata (dev); +unsigned long v =simple_strtoul (buf,NULL ,10 ); + +mutex_lock (&data->update_lock); + + reg =i2c_smbus_read_byte_data (&data->client,FSCHMD_REG_CONTROL ); +Quoted 8 lines
drivers/hwmon/fschmd.c line 445
Quoted 6 lines
drivers/hwmon/fschmd.c new file +6
-0+if (v) + reg |=FSCHMD_CONTROL_ALERT_LED_MASK ; +else + reg &= ~FSCHMD_CONTROL_ALERT_LED_MASK ; + +i2c_smbus_write_byte_data (&data->client,FSCHMD_REG_CONTROL , v);You want to write "reg" here, not "v".
Quoted 1 line
Good catch (caused by the do not use
update_devicechanges).
Actually not, the first version of the driver had the same bug, but I didn't see it during my review.
Quoted 15 lines
Quoted 6 lines
Quoted 6 lines
drivers/hwmon/fschmd.c new file +5
-0+static int fschmd_detect (struct i2c_adapter *adapter,int address,int kind) +{ +for (i =0 ; i <ARRAY_SIZE (fschmd_attr); i++) { + err =device_create_file (&client->dev, + &fschmd_attr[i].dev_attr);Quoted 8 lines
drivers/hwmon/fschmd.c line 604
Quoted 5 lines
drivers/hwmon/fschmd.c new file +5
-0+if (err) + goto exit_detach; + } + +for (i =0 ; i < (FSCHMD_NO_TEMP_SENSORS [data->kind] *4 ); i++) {Why don't you just use
ARRAY_SIZE()? Less likely to break with future changes.
Quoted 3 lines
Because the array contains attributes for the maximum number of temp sensors and not all models have the maximum number, hence FSCHMD_NO_TEMP_SENSORS[data->kind] gets used, I agree this isn't ideal.
Oops, completely right of course, sorry for the noise.
Quoted 7 lines
Quoted 4 lines
One more note: there's a lot of trailing whitespace in your driver. I think Mark will strip it before committing your patch but it would be easier for everyone if you could avoid trailing whitespace in future patches.
Are there any tools for this? You've mentioned this before and I have tried to avoid adding trailing whitespace while editing, but I guess that doesn't help much.
When using quilt, the refresh command as a --strip-trailing-whitespace options which comes in handy. I have it enabled by default.
Other than that, if your text editor supports regexp-based file-wide replacement, you can ask it to replace '\s+$' (or '[\t ]*$' if it doesn't support perl-like syntax) with nothing.
Signature · 6 lines
Jean Delvare _______________________________________________ lm-sensors mailing list [email protected] http://lists.lm-sensors.org/mailman/listinfo/lm-sensors