]> err.no Git - linux-2.6/commitdiff
hwmon: refuse to load abituguru driver on non-Abit boards
authorHans de Goede <j.w.r.degoede@hhs.nl>
Tue, 10 Jul 2007 15:09:57 +0000 (17:09 +0200)
committerMark M. Hoffman <mhoffman@lightlink.com>
Thu, 19 Jul 2007 18:25:04 +0000 (14:25 -0400)
With this patch the abituguru refuses to load on non Abit motherboards, as
discussed in lkml CONFIG_BREAK_MY_MACHINE thread.

Signed-off-by: Hans de Goede <j.w.r.degoede@hhs.nl>
Acked-by: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Mark M. Hoffman <mhoffman@lightlink.com>
drivers/hwmon/abituguru.c

index c6186672405ad5da977bf000384823693ad7a388..d575ee958de53e60e52f3ffbfb3d0aa0f7029927 100644 (file)
@@ -31,6 +31,7 @@
 #include <linux/platform_device.h>
 #include <linux/hwmon.h>
 #include <linux/hwmon-sysfs.h>
+#include <linux/dmi.h>
 #include <asm/io.h>
 
 /* Banks */
@@ -1447,6 +1448,15 @@ static int __init abituguru_init(void)
        int address, err;
        struct resource res = { .flags = IORESOURCE_IO };
 
+#ifdef CONFIG_DMI
+       char *board_vendor = dmi_get_system_info(DMI_BOARD_VENDOR);
+
+       /* safety check, refuse to load on non Abit motherboards */
+       if (!force && (!board_vendor ||
+                       strcmp(board_vendor, "http://www.abit.com.tw/")))
+               return -ENODEV;
+#endif
+
        address = abituguru_detect();
        if (address < 0)
                return address;