diff options
author | Zhang Rui <rui.zhang@intel.com> | 2007-08-22 13:24:31 -0400 |
---|---|---|
committer | Len Brown <len.brown@intel.com> | 2007-08-23 14:27:23 -0400 |
commit | 962ce8ca0604af0c3c5609f7613d4ec5fcfac623 (patch) | |
tree | 8a9fcb67251129a382e202759389d2b72de4b621 /drivers/misc/thinkpad_acpi.c | |
parent | b377fd3982ad957c796758a90e2988401a884241 (diff) |
ACPI: don't duplicate input events on netlink
The previous events patch added a netlink event for every
user of the legacy /proc/acpi/event interface.
However, some users of /proc/acpi/event are really input events,
and they already report their events via the input layer.
Introduce a new interface, acpi_bus_generate_netlink_event(),
which is explicitly called by devices that want to repoprt
events via netlink. This allows the input-like events
to opt-out of generating netlink events. In summary:
events that are sent via netlink:
ac/battery/sbs
thermal
processor
thinkpad_acpi dock/bay
events that are sent via input layer:
button
video hotkey
thinkpad_acpi hotkey
asus_acpi/asus-laptop hotkey
sonypi/sonylaptop
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/misc/thinkpad_acpi.c')
-rw-r--r-- | drivers/misc/thinkpad_acpi.c | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/drivers/misc/thinkpad_acpi.c b/drivers/misc/thinkpad_acpi.c index f6cd34a3dbac..d0825a34a7b0 100644 --- a/drivers/misc/thinkpad_acpi.c +++ b/drivers/misc/thinkpad_acpi.c | |||
@@ -2162,22 +2162,27 @@ static void dock_notify(struct ibm_struct *ibm, u32 event) | |||
2162 | int docked = dock_docked(); | 2162 | int docked = dock_docked(); |
2163 | int pci = ibm->acpi->hid && ibm->acpi->device && | 2163 | int pci = ibm->acpi->hid && ibm->acpi->device && |
2164 | acpi_match_device_ids(ibm->acpi->device, ibm_pci_device_ids); | 2164 | acpi_match_device_ids(ibm->acpi->device, ibm_pci_device_ids); |
2165 | int data; | ||
2165 | 2166 | ||
2166 | if (event == 1 && !pci) /* 570 */ | 2167 | if (event == 1 && !pci) /* 570 */ |
2167 | acpi_bus_generate_event(ibm->acpi->device, event, 1); /* button */ | 2168 | data = 1; /* button */ |
2168 | else if (event == 1 && pci) /* 570 */ | 2169 | else if (event == 1 && pci) /* 570 */ |
2169 | acpi_bus_generate_event(ibm->acpi->device, event, 3); /* dock */ | 2170 | data = 3; /* dock */ |
2170 | else if (event == 3 && docked) | 2171 | else if (event == 3 && docked) |
2171 | acpi_bus_generate_event(ibm->acpi->device, event, 1); /* button */ | 2172 | data = 1; /* button */ |
2172 | else if (event == 3 && !docked) | 2173 | else if (event == 3 && !docked) |
2173 | acpi_bus_generate_event(ibm->acpi->device, event, 2); /* undock */ | 2174 | data = 2; /* undock */ |
2174 | else if (event == 0 && docked) | 2175 | else if (event == 0 && docked) |
2175 | acpi_bus_generate_event(ibm->acpi->device, event, 3); /* dock */ | 2176 | data = 3; /* dock */ |
2176 | else { | 2177 | else { |
2177 | printk(IBM_ERR "unknown dock event %d, status %d\n", | 2178 | printk(IBM_ERR "unknown dock event %d, status %d\n", |
2178 | event, _sta(dock_handle)); | 2179 | event, _sta(dock_handle)); |
2179 | acpi_bus_generate_event(ibm->acpi->device, event, 0); /* unknown */ | 2180 | data = 0; /* unknown */ |
2180 | } | 2181 | } |
2182 | acpi_bus_generate_event(ibm->acpi->device, event, data); | ||
2183 | acpi_bus_generate_netlink_event(ibm->acpi->device->pnp.device_class, | ||
2184 | ibm->acpi->device->dev.bus_id, | ||
2185 | event, data); | ||
2181 | } | 2186 | } |
2182 | 2187 | ||
2183 | static int dock_read(char *p) | 2188 | static int dock_read(char *p) |
@@ -2276,6 +2281,9 @@ static int __init bay_init(struct ibm_init_struct *iibm) | |||
2276 | static void bay_notify(struct ibm_struct *ibm, u32 event) | 2281 | static void bay_notify(struct ibm_struct *ibm, u32 event) |
2277 | { | 2282 | { |
2278 | acpi_bus_generate_event(ibm->acpi->device, event, 0); | 2283 | acpi_bus_generate_event(ibm->acpi->device, event, 0); |
2284 | acpi_bus_generate_netlink_event(ibm->acpi->device->pnp.device_class, | ||
2285 | ibm->acpi->device->dev.bus_id, | ||
2286 | event, 0); | ||
2279 | } | 2287 | } |
2280 | 2288 | ||
2281 | #define bay_occupied(b) (_sta(b##_handle) & 1) | 2289 | #define bay_occupied(b) (_sta(b##_handle) & 1) |