diff options
-rw-r--r-- | drivers/acpi/ibm_acpi.c | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/drivers/acpi/ibm_acpi.c b/drivers/acpi/ibm_acpi.c index 4001ad193ddc..3c091c4b461f 100644 --- a/drivers/acpi/ibm_acpi.c +++ b/drivers/acpi/ibm_acpi.c | |||
@@ -77,6 +77,7 @@ | |||
77 | #include <linux/module.h> | 77 | #include <linux/module.h> |
78 | #include <linux/init.h> | 78 | #include <linux/init.h> |
79 | #include <linux/types.h> | 79 | #include <linux/types.h> |
80 | #include <linux/string.h> | ||
80 | #include <linux/proc_fs.h> | 81 | #include <linux/proc_fs.h> |
81 | #include <linux/backlight.h> | 82 | #include <linux/backlight.h> |
82 | #include <asm/uaccess.h> | 83 | #include <asm/uaccess.h> |
@@ -361,7 +362,7 @@ enum { /* Fan control constants */ | |||
361 | * control */ | 362 | * control */ |
362 | }; | 363 | }; |
363 | 364 | ||
364 | static int ibm_thinkpad_ec_found; | 365 | static char* ibm_thinkpad_ec_found = NULL; |
365 | 366 | ||
366 | struct ibm_struct { | 367 | struct ibm_struct { |
367 | char *name; | 368 | char *name; |
@@ -2540,11 +2541,15 @@ static void acpi_ibm_exit(void) | |||
2540 | ibm_exit(&ibms[i]); | 2541 | ibm_exit(&ibms[i]); |
2541 | 2542 | ||
2542 | remove_proc_entry(IBM_DIR, acpi_root_dir); | 2543 | remove_proc_entry(IBM_DIR, acpi_root_dir); |
2544 | |||
2545 | if (ibm_thinkpad_ec_found) | ||
2546 | kfree(ibm_thinkpad_ec_found); | ||
2543 | } | 2547 | } |
2544 | 2548 | ||
2545 | static int __init check_dmi_for_ec(void) | 2549 | static char* __init check_dmi_for_ec(void) |
2546 | { | 2550 | { |
2547 | struct dmi_device *dev = NULL; | 2551 | struct dmi_device *dev = NULL; |
2552 | char ec_fw_string[18]; | ||
2548 | 2553 | ||
2549 | /* | 2554 | /* |
2550 | * ThinkPad T23 or newer, A31 or newer, R50e or newer, | 2555 | * ThinkPad T23 or newer, A31 or newer, R50e or newer, |
@@ -2554,10 +2559,15 @@ static int __init check_dmi_for_ec(void) | |||
2554 | * See http://thinkwiki.org/wiki/List_of_DMI_IDs | 2559 | * See http://thinkwiki.org/wiki/List_of_DMI_IDs |
2555 | */ | 2560 | */ |
2556 | while ((dev = dmi_find_device(DMI_DEV_TYPE_OEM_STRING, NULL, dev))) { | 2561 | while ((dev = dmi_find_device(DMI_DEV_TYPE_OEM_STRING, NULL, dev))) { |
2557 | if (strstr(dev->name, "IBM ThinkPad Embedded Controller")) | 2562 | if (sscanf(dev->name, |
2558 | return 1; | 2563 | "IBM ThinkPad Embedded Controller -[%17c", |
2564 | ec_fw_string) == 1) { | ||
2565 | ec_fw_string[sizeof(ec_fw_string) - 1] = 0; | ||
2566 | ec_fw_string[strcspn(ec_fw_string, " ]")] = 0; | ||
2567 | return kstrdup(ec_fw_string, GFP_KERNEL); | ||
2568 | } | ||
2559 | } | 2569 | } |
2560 | return 0; | 2570 | return NULL; |
2561 | } | 2571 | } |
2562 | 2572 | ||
2563 | static int __init acpi_ibm_init(void) | 2573 | static int __init acpi_ibm_init(void) |
@@ -2581,6 +2591,9 @@ static int __init acpi_ibm_init(void) | |||
2581 | 2591 | ||
2582 | /* Models with newer firmware report the EC in DMI */ | 2592 | /* Models with newer firmware report the EC in DMI */ |
2583 | ibm_thinkpad_ec_found = check_dmi_for_ec(); | 2593 | ibm_thinkpad_ec_found = check_dmi_for_ec(); |
2594 | if (ibm_thinkpad_ec_found) | ||
2595 | printk(IBM_INFO "ThinkPad EC firmware %s\n", | ||
2596 | ibm_thinkpad_ec_found); | ||
2584 | 2597 | ||
2585 | /* these handles are not required */ | 2598 | /* these handles are not required */ |
2586 | IBM_HANDLE_INIT(vid); | 2599 | IBM_HANDLE_INIT(vid); |