aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/misc/thinkpad_acpi.c
diff options
context:
space:
mode:
authorHenrique de Moraes Holschuh <hmh@hmh.eng.br>2008-07-21 08:15:49 -0400
committerHenrique de Moraes Holschuh <hmh@hmh.eng.br>2008-07-21 08:15:49 -0400
commit733e27c1cc86afae2d9481838693661b3d839950 (patch)
tree994bb4aa970cad674f34feb8d833fcedb87c7eda /drivers/misc/thinkpad_acpi.c
parent3a87208028ef59215a88a143c723ac0b83c11df0 (diff)
ACPI: thinkpad-acpi: consolidate wlsw notification function
Rename tpacpi_input_send_radiosw() to tpacpi_send_radiosw_update(), and make it a central point to issue "radio switch changed state" notifications by consolidating also the poll() notification in the same function. 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.c39
1 files changed, 19 insertions, 20 deletions
diff --git a/drivers/misc/thinkpad_acpi.c b/drivers/misc/thinkpad_acpi.c
index c800855be27f..9179f2367d42 100644
--- a/drivers/misc/thinkpad_acpi.c
+++ b/drivers/misc/thinkpad_acpi.c
@@ -1285,21 +1285,6 @@ static int hotkey_status_set(int status)
1285 return 0; 1285 return 0;
1286} 1286}
1287 1287
1288static void tpacpi_input_send_radiosw(void)
1289{
1290 int wlsw;
1291
1292 if (tp_features.hotkey_wlsw && !hotkey_get_wlsw(&wlsw)) {
1293 mutex_lock(&tpacpi_inputdev_send_mutex);
1294
1295 input_report_switch(tpacpi_inputdev,
1296 SW_RFKILL_ALL, !!wlsw);
1297 input_sync(tpacpi_inputdev);
1298
1299 mutex_unlock(&tpacpi_inputdev_send_mutex);
1300 }
1301}
1302
1303static void tpacpi_input_send_tabletsw(void) 1288static void tpacpi_input_send_tabletsw(void)
1304{ 1289{
1305 int state; 1290 int state;
@@ -1921,6 +1906,22 @@ static struct attribute *hotkey_mask_attributes[] __initdata = {
1921 &dev_attr_hotkey_wakeup_hotunplug_complete.attr, 1906 &dev_attr_hotkey_wakeup_hotunplug_complete.attr,
1922}; 1907};
1923 1908
1909static void tpacpi_send_radiosw_update(void)
1910{
1911 int wlsw;
1912
1913 if (tp_features.hotkey_wlsw && !hotkey_get_wlsw(&wlsw)) {
1914 mutex_lock(&tpacpi_inputdev_send_mutex);
1915
1916 input_report_switch(tpacpi_inputdev,
1917 SW_RFKILL_ALL, !!wlsw);
1918 input_sync(tpacpi_inputdev);
1919
1920 mutex_unlock(&tpacpi_inputdev_send_mutex);
1921 }
1922 hotkey_radio_sw_notify_change();
1923}
1924
1924static void hotkey_exit(void) 1925static void hotkey_exit(void)
1925{ 1926{
1926#ifdef CONFIG_THINKPAD_ACPI_HOTKEY_POLL 1927#ifdef CONFIG_THINKPAD_ACPI_HOTKEY_POLL
@@ -2288,7 +2289,7 @@ static int __init hotkey_init(struct ibm_init_struct *iibm)
2288 tpacpi_inputdev->close = &hotkey_inputdev_close; 2289 tpacpi_inputdev->close = &hotkey_inputdev_close;
2289 2290
2290 hotkey_poll_setup_safe(1); 2291 hotkey_poll_setup_safe(1);
2291 tpacpi_input_send_radiosw(); 2292 tpacpi_send_radiosw_update();
2292 tpacpi_input_send_tabletsw(); 2293 tpacpi_input_send_tabletsw();
2293 2294
2294 return 0; 2295 return 0;
@@ -2420,8 +2421,7 @@ static void hotkey_notify(struct ibm_struct *ibm, u32 event)
2420 case 7: 2421 case 7:
2421 /* 0x7000-0x7FFF: misc */ 2422 /* 0x7000-0x7FFF: misc */
2422 if (tp_features.hotkey_wlsw && hkey == 0x7000) { 2423 if (tp_features.hotkey_wlsw && hkey == 0x7000) {
2423 tpacpi_input_send_radiosw(); 2424 tpacpi_send_radiosw_update();
2424 hotkey_radio_sw_notify_change();
2425 send_acpi_ev = 0; 2425 send_acpi_ev = 0;
2426 break; 2426 break;
2427 } 2427 }
@@ -2464,8 +2464,7 @@ static void hotkey_resume(void)
2464 printk(TPACPI_ERR 2464 printk(TPACPI_ERR
2465 "error while trying to read hot key mask " 2465 "error while trying to read hot key mask "
2466 "from firmware\n"); 2466 "from firmware\n");
2467 tpacpi_input_send_radiosw(); 2467 tpacpi_send_radiosw_update();
2468 hotkey_radio_sw_notify_change();
2469 hotkey_tablet_mode_notify_change(); 2468 hotkey_tablet_mode_notify_change();
2470 hotkey_wakeup_reason_notify_change(); 2469 hotkey_wakeup_reason_notify_change();
2471 hotkey_wakeup_hotunplug_complete_notify_change(); 2470 hotkey_wakeup_hotunplug_complete_notify_change();