hwmon: (abituguru3) update driver detection

It has been reported that the abituguru3 driver fails to load after a BIOS
update. This patch fixes this by loosening the detection routine so that it
will work after the BIOS update too. To compensate for the now very loose
detection an additional check is added on the DMI Base Board vendor string to
make sure we only load on Abit motherboards, this is the same as the check in
the abituguru (1 / 2) driver.

Signed-of-by: Hans de Goede <j.w.r.degoede@hhs.nl>
Signed-off-by: Alistair John Strachan <alistair@devzero.co.uk>
Signed-off-by: Mark M. Hoffman <mhoffman@lightlink.com>

authored by Hans de Goede and committed by Mark M. Hoffman b3aeab0c 25845c22

+13 -2
+13 -2
drivers/hwmon/abituguru3.c
··· 30 30 #include <linux/platform_device.h> 31 31 #include <linux/hwmon.h> 32 32 #include <linux/hwmon-sysfs.h> 33 + #include <linux/dmi.h> 33 34 #include <asm/io.h> 34 35 35 36 /* uGuru3 bank addresses */ ··· 1113 1112 { 1114 1113 /* See if there is an uguru3 there. An idle uGuru3 will hold 0x00 or 1115 1114 0x08 at DATA and 0xAC at CMD. Sometimes the uGuru3 will hold 0x05 1116 - at CMD instead, why is unknown. So we test for 0x05 too. */ 1115 + or 0x55 at CMD instead, why is unknown. */ 1117 1116 u8 data_val = inb_p(ABIT_UGURU3_BASE + ABIT_UGURU3_DATA); 1118 1117 u8 cmd_val = inb_p(ABIT_UGURU3_BASE + ABIT_UGURU3_CMD); 1119 1118 if (((data_val == 0x00) || (data_val == 0x08)) && 1120 - ((cmd_val == 0xAC) || (cmd_val == 0x05))) 1119 + ((cmd_val == 0xAC) || (cmd_val == 0x05) || 1120 + (cmd_val == 0x55))) 1121 1121 return ABIT_UGURU3_BASE; 1122 1122 1123 1123 ABIT_UGURU3_DEBUG("no Abit uGuru3 found, data = 0x%02X, cmd = " ··· 1140 1138 { 1141 1139 int address, err; 1142 1140 struct resource res = { .flags = IORESOURCE_IO }; 1141 + 1142 + #ifdef CONFIG_DMI 1143 + const char *board_vendor = dmi_get_system_info(DMI_BOARD_VENDOR); 1144 + 1145 + /* safety check, refuse to load on non Abit motherboards */ 1146 + if (!force && (!board_vendor || 1147 + strcmp(board_vendor, "http://www.abit.com.tw/"))) 1148 + return -ENODEV; 1149 + #endif 1143 1150 1144 1151 address = abituguru3_detect(); 1145 1152 if (address < 0)