diff options
author | Henrique de Moraes Holschuh <hmh@hmh.eng.br> | 2008-07-21 08:15:49 -0400 |
---|---|---|
committer | Henrique de Moraes Holschuh <hmh@hmh.eng.br> | 2008-07-21 08:15:49 -0400 |
commit | 3a87208028ef59215a88a143c723ac0b83c11df0 (patch) | |
tree | 74bea1f140b7a7fc68b6a8046f800b967c377e1a /drivers/misc/thinkpad_acpi.c | |
parent | 14b395e35d1afdd8019d11b92e28041fad591b71 (diff) |
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: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Diffstat (limited to 'drivers/misc/thinkpad_acpi.c')
-rw-r--r-- | drivers/misc/thinkpad_acpi.c | 49 |
1 files changed, 26 insertions, 23 deletions
diff --git a/drivers/misc/thinkpad_acpi.c b/drivers/misc/thinkpad_acpi.c index b5969298f3d3..c800855be27f 100644 --- a/drivers/misc/thinkpad_acpi.c +++ b/drivers/misc/thinkpad_acpi.c | |||
@@ -2167,9 +2167,10 @@ static int __init hotkey_init(struct ibm_init_struct *iibm) | |||
2167 | printk(TPACPI_INFO | 2167 | printk(TPACPI_INFO |
2168 | "radio switch found; radios are %s\n", | 2168 | "radio switch found; radios are %s\n", |
2169 | enabled(status, 0)); | 2169 | enabled(status, 0)); |
2170 | } | ||
2171 | if (tp_features.hotkey_wlsw) | ||
2170 | res = add_to_attr_set(hotkey_dev_attributes, | 2172 | res = add_to_attr_set(hotkey_dev_attributes, |
2171 | &dev_attr_hotkey_radio_sw.attr); | 2173 | &dev_attr_hotkey_radio_sw.attr); |
2172 | } | ||
2173 | 2174 | ||
2174 | /* For X41t, X60t, X61t Tablets... */ | 2175 | /* For X41t, X60t, X61t Tablets... */ |
2175 | if (!res && acpi_evalf(hkey_handle, &status, "MHKG", "qd")) { | 2176 | if (!res && acpi_evalf(hkey_handle, &status, "MHKG", "qd")) { |
@@ -2646,18 +2647,19 @@ static int __init bluetooth_init(struct ibm_init_struct *iibm) | |||
2646 | str_supported(tp_features.bluetooth), | 2647 | str_supported(tp_features.bluetooth), |
2647 | status); | 2648 | status); |
2648 | 2649 | ||
2650 | if (tp_features.bluetooth && | ||
2651 | !(status & TP_ACPI_BLUETOOTH_HWPRESENT)) { | ||
2652 | /* no bluetooth hardware present in system */ | ||
2653 | tp_features.bluetooth = 0; | ||
2654 | dbg_printk(TPACPI_DBG_INIT, | ||
2655 | "bluetooth hardware not installed\n"); | ||
2656 | } | ||
2657 | |||
2649 | if (tp_features.bluetooth) { | 2658 | if (tp_features.bluetooth) { |
2650 | if (!(status & TP_ACPI_BLUETOOTH_HWPRESENT)) { | 2659 | res = sysfs_create_group(&tpacpi_pdev->dev.kobj, |
2651 | /* no bluetooth hardware present in system */ | 2660 | &bluetooth_attr_group); |
2652 | tp_features.bluetooth = 0; | 2661 | if (res) |
2653 | dbg_printk(TPACPI_DBG_INIT, | 2662 | return res; |
2654 | "bluetooth hardware not installed\n"); | ||
2655 | } else { | ||
2656 | res = sysfs_create_group(&tpacpi_pdev->dev.kobj, | ||
2657 | &bluetooth_attr_group); | ||
2658 | if (res) | ||
2659 | return res; | ||
2660 | } | ||
2661 | } | 2663 | } |
2662 | 2664 | ||
2663 | return (tp_features.bluetooth)? 0 : 1; | 2665 | return (tp_features.bluetooth)? 0 : 1; |
@@ -2818,18 +2820,19 @@ static int __init wan_init(struct ibm_init_struct *iibm) | |||
2818 | str_supported(tp_features.wan), | 2820 | str_supported(tp_features.wan), |
2819 | status); | 2821 | status); |
2820 | 2822 | ||
2823 | if (tp_features.wan && | ||
2824 | !(status & TP_ACPI_WANCARD_HWPRESENT)) { | ||
2825 | /* no wan hardware present in system */ | ||
2826 | tp_features.wan = 0; | ||
2827 | dbg_printk(TPACPI_DBG_INIT, | ||
2828 | "wan hardware not installed\n"); | ||
2829 | } | ||
2830 | |||
2821 | if (tp_features.wan) { | 2831 | if (tp_features.wan) { |
2822 | if (!(status & TP_ACPI_WANCARD_HWPRESENT)) { | 2832 | res = sysfs_create_group(&tpacpi_pdev->dev.kobj, |
2823 | /* no wan hardware present in system */ | 2833 | &wan_attr_group); |
2824 | tp_features.wan = 0; | 2834 | if (res) |
2825 | dbg_printk(TPACPI_DBG_INIT, | 2835 | return res; |
2826 | "wan hardware not installed\n"); | ||
2827 | } else { | ||
2828 | res = sysfs_create_group(&tpacpi_pdev->dev.kobj, | ||
2829 | &wan_attr_group); | ||
2830 | if (res) | ||
2831 | return res; | ||
2832 | } | ||
2833 | } | 2836 | } |
2834 | 2837 | ||
2835 | return (tp_features.wan)? 0 : 1; | 2838 | return (tp_features.wan)? 0 : 1; |