hwmon: (lm85) Drop generic detection
PATCH 1/1 hwmon: (lm85) Drop generic detection
Generic detection leads to too many false positives, so drop it. FWIW sensors-detect does not have such generic detection. If the user wants to force the driver to bind to a not yet supported chip, he/she can still do so using sysfs attribute new_device.
---
Mike, I can credit you for reporting the issue if you want. That will put your name and e-mail address in the kernel development logs though, so up to you.
drivers/hwmon/lm85.c | 33 ++++++++++----------------------- 1 file changed, 10 insertions(+), 23 deletions(-)
drivers/hwmon/lm85.c +10 -23
@@ -5,7 +5,7 @@* Copyright (c) 2002, 2003 Philip Pokorny <[email protected]> * Copyright (c) 2003 Margit Schubert-While <[email protected]> * Copyright (c) 2004 Justin Thiessen <[email protected]> -* Copyright (C) 2007--2009 Jean Delvare <[email protected]> +* Copyright (C) 2007--2014 Jean Delvare <[email protected]> * * Chip details at <http://www.national.com/ds/LM/LM85.pdf> *
@@ -39,7 +39,7 @@static const unsigned short normal_i2c[] = {0x2c ,0x2d ,0x2e ,I2C_CLIENT_END };enum chips { - any_chip, lm85b, lm85c, + lm85, adm1027, adt7463, adt7468, emc6d100, emc6d102, emc6d103, emc6d103s };
@@ -75,9 +75,6 @@ enum chips {#define LM85_COMPANY_NATIONAL 0x01#define LM85_COMPANY_ANALOG_DEV 0x41#define LM85_COMPANY_SMSC 0x5c -#define LM85_VERSTEP_VMASK 0xf0 -#define LM85_VERSTEP_GENERIC 0x60 -#define LM85_VERSTEP_GENERIC2 0x70#define LM85_VERSTEP_LM85C 0x60#define LM85_VERSTEP_LM85B 0x62#define LM85_VERSTEP_LM96000_1 0x68
@@ -351,9 +348,9 @@ static const struct i2c_device_id lm85_i { "adm1027", adm1027 }, { "adt7463", adt7463 }, { "adt7468", adt7468 }, - { "lm85", any_chip }, - { "lm85b", lm85b }, - { "lm85c", lm85c }, + { "lm85", lm85 }, + { "lm85b", lm85 }, + { "lm85c", lm85 }, { "emc6d100", emc6d100 }, { "emc6d101", emc6d100 }, { "emc6d102", emc6d102 },
@@ -1281,7 +1278,7 @@ static int lm85_detect(struct i2c_client {struct i2c_adapter *adapter = client->adapter;int address = client->addr; -const char *type_name; +const char *type_name =NULL ;int company, verstep;if (!i2c_check_functionality (adapter,I2C_FUNC_SMBUS_BYTE_DATA )) {
@@ -1297,16 +1294,6 @@ static int lm85_detect(struct i2c_client"Detecting device at 0x%02x with COMPANY: 0x%02x and VERSTEP: 0x%02x\n" , address, company, verstep); -/* All supported chips have the version in common */ -if ((verstep &LM85_VERSTEP_VMASK ) !=LM85_VERSTEP_GENERIC && - (verstep &LM85_VERSTEP_VMASK ) !=LM85_VERSTEP_GENERIC2 ) { -dev_dbg (&adapter->dev, -"Autodetection failed: unsupported version\n" ); -return -ENODEV ; - } - type_name ="lm85" ; - -/* Now, refine the detection */ if (company =LM85_COMPANY_NATIONAL ) {switch (verstep) {case LM85_VERSTEP_LM85C :
@@ -1323,6 +1310,7 @@ static int lm85_detect(struct i2c_client "Found Winbond WPCD377I, ignoring\n");return -ENODEV ; } + type_name ="lm85" ;break ; } }else if (company =LM85_COMPANY_ANALOG_DEV ) {
@@ -1357,12 +1345,11 @@ static int lm85_detect(struct i2c_client type_name ="emc6d103s" ;break ; } - }else { -dev_dbg (&adapter->dev, -"Autodetection failed: unknown vendor\n" ); -return -ENODEV ; } +if (!type_name) +return -ENODEV ; +strlcpy (info->type, type_name,I2C_NAME_SIZE );return 0 ;
Signature · 7 lines
Jean Delvare SUSE L3 Support _______________________________________________ lm-sensors mailing list [email protected] http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
Quoted 6 lines · Jean Delvare
Generic detection leads to too many false positives, so drop it. FWIW sensors-detect does not have such generic detection. If the user wants to force the driver to bind to a not yet supported chip, he/she can still do so using sysfs attribute
new_device.Signed-off-by Jean Delvare <[email protected]>
Good idea. That was way too generic.
Do you want to take it, or should I ? I have another fix pending, so it would not make a difference for me.
Thanks,
Guenter
Quoted 112 lines
---
Mike, I can credit you for reporting the issue if you want. That will put your name and e-mail address in the kernel development logs though, so up to you.drivers/hwmon/lm85.c | 33 ++++++++++----------------------- 1 file changed, 10 insertions(+), 23 deletions(-)drivers/hwmon/lm85.c +10
-23@@ -5,7 +5,7 @@* Copyright (c) 2002, 2003 Philip Pokorny <[email protected]> * Copyright (c) 2003 Margit Schubert-While <[email protected]> * Copyright (c) 2004 Justin Thiessen <[email protected]> -* Copyright (C) 2007--2009 Jean Delvare <[email protected]> +* Copyright (C) 2007--2014 Jean Delvare <[email protected]> * * Chip details at <http://www.national.com/ds/LM/LM85.pdf> * @@ -39,7 +39,7 @@static const unsigned short normal_i2c[] = {0x2c ,0x2d ,0x2e ,I2C_CLIENT_END };enum chips { - any_chip, lm85b, lm85c, + lm85, adm1027, adt7463, adt7468, emc6d100, emc6d102, emc6d103, emc6d103s };@@ -75,9 +75,6 @@ enum chips {#define LM85_COMPANY_NATIONAL 0x01#define LM85_COMPANY_ANALOG_DEV 0x41#define LM85_COMPANY_SMSC 0x5c -#define LM85_VERSTEP_VMASK 0xf0 -#define LM85_VERSTEP_GENERIC 0x60 -#define LM85_VERSTEP_GENERIC2 0x70#define LM85_VERSTEP_LM85C 0x60#define LM85_VERSTEP_LM85B 0x62#define LM85_VERSTEP_LM96000_1 0x68@@ -351,9 +348,9 @@ static const struct i2c_device_id lm85_i { "adm1027", adm1027 }, { "adt7463", adt7463 }, { "adt7468", adt7468 }, - { "lm85", any_chip }, - { "lm85b", lm85b }, - { "lm85c", lm85c }, + { "lm85", lm85 }, + { "lm85b", lm85 }, + { "lm85c", lm85 }, { "emc6d100", emc6d100 }, { "emc6d101", emc6d100 }, { "emc6d102", emc6d102 },@@ -1281,7 +1278,7 @@ static int lm85_detect(struct i2c_client {struct i2c_adapter *adapter = client->adapter;int address = client->addr; -const char *type_name; +const char *type_name =NULL ;int company, verstep;if (!i2c_check_functionality (adapter,I2C_FUNC_SMBUS_BYTE_DATA )) {@@ -1297,16 +1294,6 @@ static int lm85_detect(struct i2c_client"Detecting device at 0x%02x with COMPANY: 0x%02x and VERSTEP: 0x%02x\n" , address, company, verstep); -/* All supported chips have the version in common */ -if ((verstep &LM85_VERSTEP_VMASK ) !=LM85_VERSTEP_GENERIC && - (verstep &LM85_VERSTEP_VMASK ) !=LM85_VERSTEP_GENERIC2 ) { -dev_dbg (&adapter->dev, -"Autodetection failed: unsupported version\n" ); -return -ENODEV ; - } - type_name ="lm85" ; - -/* Now, refine the detection */ if (company =LM85_COMPANY_NATIONAL ) {switch (verstep) {case LM85_VERSTEP_LM85C :@@ -1323,6 +1310,7 @@ static int lm85_detect(struct i2c_client "Found Winbond WPCD377I, ignoring\n");return -ENODEV ; } + type_name ="lm85" ;break ; } }else if (company =LM85_COMPANY_ANALOG_DEV ) {@@ -1357,12 +1345,11 @@ static int lm85_detect(struct i2c_client type_name ="emc6d103s" ;break ; } - }else { -dev_dbg (&adapter->dev, -"Autodetection failed: unknown vendor\n" ); -return -ENODEV ; } +if (!type_name) +return -ENODEV ; +strlcpy (info->type, type_name,I2C_NAME_SIZE );return 0 ;Signature · 8 lines
-- Jean Delvare SUSE L3 Support _______________________________________________ lm-sensors mailing list [email protected] http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
Hi Guenter,
Quoted 6 lines · Guenter Roeck
Quoted 5 lines · Jean Delvare
Generic detection leads to too many false positives, so drop it. FWIW sensors-detect does not have such generic detection. If the user wants to force the driver to bind to a not yet supported chip, he/she can still do so using sysfs attribute
new_device.
Quoted 8 lines
Quoted 1 line
Signed-off-by Jean Delvare <[email protected]>Good idea. That was way too generic.
Reviewed-by Guenter Roeck <[email protected]>Do you want to take it, or should I ? I have another fix pending, so it would not make a difference for me.
Please take it, I don't have anything else to send this time.
Thanks (and for the review, too),
Signature · 7 lines
Jean Delvare SUSE L3 Support _______________________________________________ lm-sensors mailing list [email protected] http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
Guenter Roeck
maintainerQuoted 11 lines · Jean Delvare
Hi Guenter,
Quoted 8 lines · Guenter Roeck
Quoted 6 lines · Jean Delvare
Generic detection leads to too many false positives, so drop it. FWIW sensors-detect does not have such generic detection. If the user wants to force the driver to bind to a not yet supported chip, he/she can still do so using sysfs attribute
new_device.Signed-off-by Jean Delvare <[email protected]>
Quoted 9 lines
Quoted 6 lines
Good idea. That was way too generic.
Reviewed-by Guenter Roeck <[email protected]>Do you want to take it, or should I ? I have another fix pending, so it would not make a difference for me.
Please take it, I don't have anything else to send this time.
Ok, will do.
Guenter
_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors