Patches are removed from the already-upstream queue only by rebase,
[linux-2.6/linux-acpi-2.6/ibm-acpi-2.6.git] / releases / upstream / 2.6.20-rc2 / 0016-ACPI-ibm-acpi-store-embedded-controller-firmware-version-for-matching.txt
blobb134053e7bd308194eeee8af1ac748434de76d65
1 From 49a13cd6a2acd284ee106eaea7eeea8f2cc6796a Mon Sep 17 00:00:00 2001
2 From: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
3 Date: Fri, 24 Nov 2006 11:47:13 -0200
4 Subject: [PATCH 16/28] ACPI: ibm-acpi: store embedded controller firmware version for matching
6 This patch changes the ThinkPad Embedded Controller DMI matching
7 code to store the firmware version of the EC for later usage, e.g.
8 for quirks.
10 It also prints the firmware version when starting up.
12 Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
13 ---
14  drivers/acpi/ibm_acpi.c |   23 ++++++++++++++++++-----
15  1 files changed, 18 insertions(+), 5 deletions(-)
17 diff --git a/drivers/acpi/ibm_acpi.c b/drivers/acpi/ibm_acpi.c
18 index 4001ad1..3c091c4 100644
19 --- a/drivers/acpi/ibm_acpi.c
20 +++ b/drivers/acpi/ibm_acpi.c
21 @@ -77,6 +77,7 @@
22  #include <linux/module.h>
23  #include <linux/init.h>
24  #include <linux/types.h>
25 +#include <linux/string.h>
26  #include <linux/proc_fs.h>
27  #include <linux/backlight.h>
28  #include <asm/uaccess.h>
29 @@ -361,7 +362,7 @@ enum {                                      /* Fan control constants */
30                                                  * control */
31  };
33 -static int ibm_thinkpad_ec_found;
34 +static char* ibm_thinkpad_ec_found = NULL;
36  struct ibm_struct {
37         char *name;
38 @@ -2540,11 +2541,15 @@ static void acpi_ibm_exit(void)
39                 ibm_exit(&ibms[i]);
41         remove_proc_entry(IBM_DIR, acpi_root_dir);
43 +       if (ibm_thinkpad_ec_found)
44 +               kfree(ibm_thinkpad_ec_found);
45  }
47 -static int __init check_dmi_for_ec(void)
48 +static char* __init check_dmi_for_ec(void)
49  {
50         struct dmi_device *dev = NULL;
51 +       char ec_fw_string[18];
53         /*
54          * ThinkPad T23 or newer, A31 or newer, R50e or newer,
55 @@ -2554,10 +2559,15 @@ static int __init check_dmi_for_ec(void)
56          * See http://thinkwiki.org/wiki/List_of_DMI_IDs
57          */
58         while ((dev = dmi_find_device(DMI_DEV_TYPE_OEM_STRING, NULL, dev))) {
59 -               if (strstr(dev->name, "IBM ThinkPad Embedded Controller"))
60 -                       return 1;
61 +               if (sscanf(dev->name,
62 +                          "IBM ThinkPad Embedded Controller -[%17c",
63 +                          ec_fw_string) == 1) {
64 +                       ec_fw_string[sizeof(ec_fw_string) - 1] = 0;
65 +                       ec_fw_string[strcspn(ec_fw_string, " ]")] = 0;
66 +                       return kstrdup(ec_fw_string, GFP_KERNEL);
67 +               }
68         }
69 -       return 0;
70 +       return NULL;
71  }
73  static int __init acpi_ibm_init(void)
74 @@ -2581,6 +2591,9 @@ static int __init acpi_ibm_init(void)
76         /* Models with newer firmware report the EC in DMI */
77         ibm_thinkpad_ec_found = check_dmi_for_ec();
78 +       if (ibm_thinkpad_ec_found)
79 +               printk(IBM_INFO "ThinkPad EC firmware %s\n",
80 +                      ibm_thinkpad_ec_found);
82         /* these handles are not required */
83         IBM_HANDLE_INIT(vid);
84 -- 
85 1.4.4.2