Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 105676
b: refs/heads/master
c: bf20e74
h: refs/heads/master
v: v3
  • Loading branch information
Henrique de Moraes Holschuh committed Jul 21, 2008
1 parent 413c9a6 commit 4d597a1
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 15 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 490673dc98adfc7de1703cc88508902bd10f446b
refs/heads/master: bf20e740a4bcc686de02e2fd1c1810a58872f46e
47 changes: 33 additions & 14 deletions trunk/drivers/misc/thinkpad_acpi.c
Original file line number Diff line number Diff line change
Expand Up @@ -6340,13 +6340,18 @@ static int __init ibm_init(struct ibm_init_struct *iibm)

/* Probing */

static void __init get_thinkpad_model_data(struct thinkpad_id_data *tp)
/* returns 0 - probe ok, or < 0 - probe error.
* Probe ok doesn't mean thinkpad found.
* On error, kfree() cleanup on tp->* is not performed, caller must do it */
static int __must_check __init get_thinkpad_model_data(
struct thinkpad_id_data *tp)
{
const struct dmi_device *dev = NULL;
char ec_fw_string[18];
char const *s;

if (!tp)
return;
return -EINVAL;

memset(tp, 0, sizeof(*tp));

Expand All @@ -6355,12 +6360,14 @@ static void __init get_thinkpad_model_data(struct thinkpad_id_data *tp)
else if (dmi_name_in_vendors("LENOVO"))
tp->vendor = PCI_VENDOR_ID_LENOVO;
else
return;
return 0;

tp->bios_version_str = kstrdup(dmi_get_system_info(DMI_BIOS_VERSION),
GFP_KERNEL);
s = dmi_get_system_info(DMI_BIOS_VERSION);
tp->bios_version_str = kstrdup(s, GFP_KERNEL);
if (s && !tp->bios_version_str)
return -ENOMEM;
if (!tp->bios_version_str)
return;
return 0;
tp->bios_model = tp->bios_version_str[0]
| (tp->bios_version_str[1] << 8);

Expand All @@ -6379,21 +6386,27 @@ static void __init get_thinkpad_model_data(struct thinkpad_id_data *tp)
ec_fw_string[strcspn(ec_fw_string, " ]")] = 0;

tp->ec_version_str = kstrdup(ec_fw_string, GFP_KERNEL);
if (!tp->ec_version_str)
return -ENOMEM;
tp->ec_model = ec_fw_string[0]
| (ec_fw_string[1] << 8);
break;
}
}

tp->model_str = kstrdup(dmi_get_system_info(DMI_PRODUCT_VERSION),
GFP_KERNEL);
if (tp->model_str && strnicmp(tp->model_str, "ThinkPad", 8) != 0) {
kfree(tp->model_str);
tp->model_str = NULL;
s = dmi_get_system_info(DMI_PRODUCT_VERSION);
if (s && !strnicmp(s, "ThinkPad", 8)) {
tp->model_str = kstrdup(s, GFP_KERNEL);
if (!tp->model_str)
return -ENOMEM;
}

tp->nummodel_str = kstrdup(dmi_get_system_info(DMI_PRODUCT_NAME),
GFP_KERNEL);
s = dmi_get_system_info(DMI_PRODUCT_NAME);
tp->nummodel_str = kstrdup(s, GFP_KERNEL);
if (s && !tp->nummodel_str)
return -ENOMEM;

return 0;
}

static int __init probe_for_thinkpad(void)
Expand Down Expand Up @@ -6656,7 +6669,13 @@ static int __init thinkpad_acpi_module_init(void)

/* Driver-level probe */

get_thinkpad_model_data(&thinkpad_id);
ret = get_thinkpad_model_data(&thinkpad_id);
if (ret) {
printk(TPACPI_ERR
"unable to get DMI data: %d\n", ret);
thinkpad_acpi_module_exit();
return ret;
}
ret = probe_for_thinkpad();
if (ret) {
thinkpad_acpi_module_exit();
Expand Down

0 comments on commit 4d597a1

Please sign in to comment.