hwmon/lm87: Add support for the Analog
Untested, and I'm not an lm-sensors or kernel expert anyway, but here are some comments:
Documentation/hwmon/lm87 Kernel driver lm87 · line 7
Quoted 8 lines · Jean Delvare
Documentation/hwmon/lm87 +1
-1@@ -4,8 +4,12 @@ Kernel driver lm87 Supported chips: * National Semiconductor LM87 Prefix: 'lm87' - Addresses scanned: I2C 0x2c - 0x2f + Addresses scanned: I2C 0x2c - 0x2e
Is this intentional? Was the previous value incorrect?
Quoted 5 lines
Documentation/hwmon/lm87 +4
-0Datasheet: http://www.national.com/pf/LM/LM87.html + * Analog Devices ADM1024 + Prefix: 'adm1024' + Addresses scanned: I2C 0x2c - 0x2e + Datasheet: http://www.analog.com/en/prod/0,2877,ADM1024,00.html
[...]
Quoted 4 lines
Documentation/hwmon/lm87 +0
-0@@ -686,11 +692,18 @@ static int lm87_detect(struct i2c_adapte /* Now, we do the remaining detection. */ if (kind < 0) {
Documentation/hwmon/lm87 static int lm87_detect(struct i2c_adapte · line 701
Quoted 10 lines
Documentation/hwmon/lm87 +5
-3+ u8 cid = lm87_read_value(new_client, LM87_REG_COMPANY_ID); u8 rev = lm87_read_value(new_client, LM87_REG_REVISION); - if (rev < 0x01 || rev > 0x08 - || (lm87_read_value(new_client, LM87_REG_CONFIG) & 0x80) - || lm87_read_value(new_client, LM87_REG_COMPANY_ID) != 0x02) { + if (cid == 0x02 /* National Semiconductor */ + && (rev >= 0x01 && rev <= 0x08)) + kind = lm87; + else if (cid == 0x41 /* Analog Devices */
I don't know how this is handled in the rest of the code, but personally I'd make them #defines, e.g. like this:
#define COMPANY_ID_NATSEMI 0x02
#define COMPANY_ID_ANALOG_DEVICES 0x41
(maybe even in some common header file which other drivers can use, too)
A lot more readable IMO, and you don't need any code comment anymore.
HTH, Uwe.
Signature · 2 lines
http://www.hermann-uwe.de | http://www.holsham-traders.de http://www.crazy-hacks.org | http://www.unmaintained-free-software.org
_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors