1 From 3eea123df1637a88d0899626a67b83dca959efff Mon Sep 17 00:00:00 2001
2 From: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
3 Date: Sun, 23 Sep 2007 11:39:04 -0300
4 Subject: [PATCH 09/23] ACPI: thinkpad-acpi: dequeue all pending hot key events at once (v2.2)
6 Receive all pending HKEY events at once from a single notification, and don't
7 complain if the queue is empty.
9 Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
10 Signed-off-by: Len Brown <len.brown@intel.com>
12 drivers/misc/thinkpad_acpi.c | 51 ++++++++++++++++++++++++++++--------------
13 1 files changed, 34 insertions(+), 17 deletions(-)
15 diff --git a/drivers/misc/thinkpad_acpi.c b/drivers/misc/thinkpad_acpi.c
16 index 9a61140..3efe81b 100644
17 --- a/drivers/misc/thinkpad_acpi.c
18 +++ b/drivers/misc/thinkpad_acpi.c
19 @@ -1196,9 +1196,30 @@ static void hotkey_notify(struct ibm_struct *ibm, u32 event)
22 unsigned int keycode, scancode;
23 - int send_acpi_ev = 0;
26 + if (event != 0x80) {
27 + printk(IBM_ERR "unknown HKEY notification event %d\n", event);
28 + /* forward it to userspace, maybe it knows how to handle it */
29 + acpi_bus_generate_netlink_event(ibm->acpi->device->pnp.device_class,
30 + ibm->acpi->device->dev.bus_id,
36 + if (!acpi_evalf(hkey_handle, &hkey, "MHKP", "d")) {
37 + printk(IBM_ERR "failed to retrieve HKEY event\n");
48 - if (event == 0x80 && acpi_evalf(hkey_handle, &hkey, "MHKP", "d")) {
51 /* 0x1000-0x1FFF: key presses */
52 @@ -1220,8 +1241,8 @@ static void hotkey_notify(struct ibm_struct *ibm, u32 event)
53 * eat up known LID events */
54 if (hkey != 0x5001 && hkey != 0x5002) {
56 - "unknown LID-related hotkey event: 0x%04x\n",
58 + "unknown LID-related HKEY event: 0x%04x\n",
63 @@ -1240,21 +1261,17 @@ static void hotkey_notify(struct ibm_struct *ibm, u32 event)
64 printk(IBM_NOTICE "unhandled HKEY event 0x%04x\n", hkey);
68 - printk(IBM_ERR "unknown hotkey notification event %d\n", event);
74 - if (send_acpi_ev || hotkey_report_mode < 2)
75 - acpi_bus_generate_proc_event(ibm->acpi->device, event, hkey);
77 + if (send_acpi_ev || hotkey_report_mode < 2)
78 + acpi_bus_generate_proc_event(ibm->acpi->device, event, hkey);
80 - /* netlink events */
82 - acpi_bus_generate_netlink_event(ibm->acpi->device->pnp.device_class,
83 - ibm->acpi->device->dev.bus_id,
85 + /* netlink events */
87 + acpi_bus_generate_netlink_event(ibm->acpi->device->pnp.device_class,
88 + ibm->acpi->device->dev.bus_id,