ACPI: thinkpad-acpi: minor refactor on radio switch init

Change the code of hotkey_init, wan_init and bluetooth_init a bit to make it
much easier to add some Kconfig-selected debugging code later.
Signed-off-by: default avatarHenrique de Moraes Holschuh <hmh@hmh.eng.br>
parent 14b395e3
...@@ -2167,9 +2167,10 @@ static int __init hotkey_init(struct ibm_init_struct *iibm) ...@@ -2167,9 +2167,10 @@ static int __init hotkey_init(struct ibm_init_struct *iibm)
printk(TPACPI_INFO printk(TPACPI_INFO
"radio switch found; radios are %s\n", "radio switch found; radios are %s\n",
enabled(status, 0)); enabled(status, 0));
}
if (tp_features.hotkey_wlsw)
res = add_to_attr_set(hotkey_dev_attributes, res = add_to_attr_set(hotkey_dev_attributes,
&dev_attr_hotkey_radio_sw.attr); &dev_attr_hotkey_radio_sw.attr);
}
/* For X41t, X60t, X61t Tablets... */ /* For X41t, X60t, X61t Tablets... */
if (!res && acpi_evalf(hkey_handle, &status, "MHKG", "qd")) { if (!res && acpi_evalf(hkey_handle, &status, "MHKG", "qd")) {
...@@ -2646,19 +2647,20 @@ static int __init bluetooth_init(struct ibm_init_struct *iibm) ...@@ -2646,19 +2647,20 @@ static int __init bluetooth_init(struct ibm_init_struct *iibm)
str_supported(tp_features.bluetooth), str_supported(tp_features.bluetooth),
status); status);
if (tp_features.bluetooth) { if (tp_features.bluetooth &&
if (!(status & TP_ACPI_BLUETOOTH_HWPRESENT)) { !(status & TP_ACPI_BLUETOOTH_HWPRESENT)) {
/* no bluetooth hardware present in system */ /* no bluetooth hardware present in system */
tp_features.bluetooth = 0; tp_features.bluetooth = 0;
dbg_printk(TPACPI_DBG_INIT, dbg_printk(TPACPI_DBG_INIT,
"bluetooth hardware not installed\n"); "bluetooth hardware not installed\n");
} else { }
if (tp_features.bluetooth) {
res = sysfs_create_group(&tpacpi_pdev->dev.kobj, res = sysfs_create_group(&tpacpi_pdev->dev.kobj,
&bluetooth_attr_group); &bluetooth_attr_group);
if (res) if (res)
return res; return res;
} }
}
return (tp_features.bluetooth)? 0 : 1; return (tp_features.bluetooth)? 0 : 1;
} }
...@@ -2818,19 +2820,20 @@ static int __init wan_init(struct ibm_init_struct *iibm) ...@@ -2818,19 +2820,20 @@ static int __init wan_init(struct ibm_init_struct *iibm)
str_supported(tp_features.wan), str_supported(tp_features.wan),
status); status);
if (tp_features.wan) { if (tp_features.wan &&
if (!(status & TP_ACPI_WANCARD_HWPRESENT)) { !(status & TP_ACPI_WANCARD_HWPRESENT)) {
/* no wan hardware present in system */ /* no wan hardware present in system */
tp_features.wan = 0; tp_features.wan = 0;
dbg_printk(TPACPI_DBG_INIT, dbg_printk(TPACPI_DBG_INIT,
"wan hardware not installed\n"); "wan hardware not installed\n");
} else { }
if (tp_features.wan) {
res = sysfs_create_group(&tpacpi_pdev->dev.kobj, res = sysfs_create_group(&tpacpi_pdev->dev.kobj,
&wan_attr_group); &wan_attr_group);
if (res) if (res)
return res; return res;
} }
}
return (tp_features.wan)? 0 : 1; return (tp_features.wan)? 0 : 1;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment