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 | |
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')
-rw-r--r-- | drivers/acpi/ac.c | 3 | ||||
-rw-r--r-- | drivers/acpi/battery.c | 3 | ||||
-rw-r--r-- | drivers/acpi/bus.c | 4 | ||||
-rw-r--r-- | drivers/acpi/event.c | 13 | ||||
-rw-r--r-- | drivers/acpi/processor_core.c | 7 | ||||
-rw-r--r-- | drivers/acpi/sbs.c | 1 | ||||
-rw-r--r-- | drivers/acpi/thermal.c | 12 | ||||
-rw-r--r-- | drivers/misc/thinkpad_acpi.c | 20 | ||||
-rw-r--r-- | drivers/pci/hotplug/acpiphp_ibm.c | 3 |
9 files changed, 52 insertions, 14 deletions
diff --git a/drivers/acpi/ac.c b/drivers/acpi/ac.c index d8b35093527a..b53c2cfcafd3 100644 --- a/drivers/acpi/ac.c +++ b/drivers/acpi/ac.c | |||
@@ -205,6 +205,9 @@ static void acpi_ac_notify(acpi_handle handle, u32 event, void *data) | |||
205 | case ACPI_NOTIFY_DEVICE_CHECK: | 205 | case ACPI_NOTIFY_DEVICE_CHECK: |
206 | acpi_ac_get_state(ac); | 206 | acpi_ac_get_state(ac); |
207 | acpi_bus_generate_event(device, event, (u32) ac->state); | 207 | acpi_bus_generate_event(device, event, (u32) ac->state); |
208 | acpi_bus_generate_netlink_event(device->pnp.device_class, | ||
209 | device->dev.bus_id, event, | ||
210 | (u32) ac->state); | ||
208 | break; | 211 | break; |
209 | default: | 212 | default: |
210 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | 213 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, |
diff --git a/drivers/acpi/battery.c b/drivers/acpi/battery.c index d7b499fe0cd9..9f0bf90afdab 100644 --- a/drivers/acpi/battery.c +++ b/drivers/acpi/battery.c | |||
@@ -869,6 +869,9 @@ static void acpi_battery_notify(acpi_handle handle, u32 event, void *data) | |||
869 | acpi_battery_notify_update(battery); | 869 | acpi_battery_notify_update(battery); |
870 | acpi_bus_generate_event(device, event, | 870 | acpi_bus_generate_event(device, event, |
871 | acpi_battery_present(battery)); | 871 | acpi_battery_present(battery)); |
872 | acpi_bus_generate_netlink_event(device->pnp.device_class, | ||
873 | device->dev.bus_id, event, | ||
874 | acpi_battery_present(battery)); | ||
872 | break; | 875 | break; |
873 | default: | 876 | default: |
874 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | 877 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, |
diff --git a/drivers/acpi/bus.c b/drivers/acpi/bus.c index 6b2658c96242..e5084ececb6f 100644 --- a/drivers/acpi/bus.c +++ b/drivers/acpi/bus.c | |||
@@ -292,10 +292,6 @@ int acpi_bus_generate_event(struct acpi_device *device, u8 type, int data) | |||
292 | if (!device) | 292 | if (!device) |
293 | return -EINVAL; | 293 | return -EINVAL; |
294 | 294 | ||
295 | if (acpi_bus_generate_genetlink_event(device, type, data)) | ||
296 | printk(KERN_WARNING PREFIX | ||
297 | "Failed to generate an ACPI event via genetlink!\n"); | ||
298 | |||
299 | /* drop event on the floor if no one's listening */ | 295 | /* drop event on the floor if no one's listening */ |
300 | if (!event_is_open) | 296 | if (!event_is_open) |
301 | return 0; | 297 | return 0; |
diff --git a/drivers/acpi/event.c b/drivers/acpi/event.c index 95637a4ff782..b7b143288c22 100644 --- a/drivers/acpi/event.c +++ b/drivers/acpi/event.c | |||
@@ -147,7 +147,8 @@ static struct genl_multicast_group acpi_event_mcgrp = { | |||
147 | .name = ACPI_GENL_MCAST_GROUP_NAME, | 147 | .name = ACPI_GENL_MCAST_GROUP_NAME, |
148 | }; | 148 | }; |
149 | 149 | ||
150 | int acpi_bus_generate_genetlink_event(struct acpi_device *device, | 150 | int acpi_bus_generate_netlink_event(const char *device_class, |
151 | const char *bus_id, | ||
151 | u8 type, int data) | 152 | u8 type, int data) |
152 | { | 153 | { |
153 | struct sk_buff *skb; | 154 | struct sk_buff *skb; |
@@ -191,8 +192,8 @@ int acpi_bus_generate_genetlink_event(struct acpi_device *device, | |||
191 | 192 | ||
192 | memset(event, 0, sizeof(struct acpi_genl_event)); | 193 | memset(event, 0, sizeof(struct acpi_genl_event)); |
193 | 194 | ||
194 | strcpy(event->device_class, device->pnp.device_class); | 195 | strcpy(event->device_class, device_class); |
195 | strcpy(event->bus_id, device->dev.bus_id); | 196 | strcpy(event->bus_id, bus_id); |
196 | event->type = type; | 197 | event->type = type; |
197 | event->data = data; | 198 | event->data = data; |
198 | 199 | ||
@@ -211,6 +212,8 @@ int acpi_bus_generate_genetlink_event(struct acpi_device *device, | |||
211 | return 0; | 212 | return 0; |
212 | } | 213 | } |
213 | 214 | ||
215 | EXPORT_SYMBOL(acpi_bus_generate_netlink_event); | ||
216 | |||
214 | static int acpi_event_genetlink_init(void) | 217 | static int acpi_event_genetlink_init(void) |
215 | { | 218 | { |
216 | int result; | 219 | int result; |
@@ -228,12 +231,14 @@ static int acpi_event_genetlink_init(void) | |||
228 | } | 231 | } |
229 | 232 | ||
230 | #else | 233 | #else |
231 | int acpi_bus_generate_genetlink_event(struct acpi_device *device, u8 type, | 234 | int acpi_bus_generate_netlink_event(struct acpi_device *device, u8 type, |
232 | int data) | 235 | int data) |
233 | { | 236 | { |
234 | return 0; | 237 | return 0; |
235 | } | 238 | } |
236 | 239 | ||
240 | EXPORT_SYMBOL(acpi_generate_netlink_event); | ||
241 | |||
237 | static int acpi_event_genetlink_init(void) | 242 | static int acpi_event_genetlink_init(void) |
238 | { | 243 | { |
239 | return -ENODEV; | 244 | return -ENODEV; |
diff --git a/drivers/acpi/processor_core.c b/drivers/acpi/processor_core.c index 498422343f38..dbc2e5d9d6a7 100644 --- a/drivers/acpi/processor_core.c +++ b/drivers/acpi/processor_core.c | |||
@@ -700,14 +700,21 @@ static void acpi_processor_notify(acpi_handle handle, u32 event, void *data) | |||
700 | acpi_processor_ppc_has_changed(pr); | 700 | acpi_processor_ppc_has_changed(pr); |
701 | acpi_bus_generate_event(device, event, | 701 | acpi_bus_generate_event(device, event, |
702 | pr->performance_platform_limit); | 702 | pr->performance_platform_limit); |
703 | acpi_bus_generate_netlink_event(device->pnp.device_class, | ||
704 | device->dev.bus_id, event, | ||
705 | pr->performance_platform_limit); | ||
703 | break; | 706 | break; |
704 | case ACPI_PROCESSOR_NOTIFY_POWER: | 707 | case ACPI_PROCESSOR_NOTIFY_POWER: |
705 | acpi_processor_cst_has_changed(pr); | 708 | acpi_processor_cst_has_changed(pr); |
706 | acpi_bus_generate_event(device, event, 0); | 709 | acpi_bus_generate_event(device, event, 0); |
710 | acpi_bus_generate_netlink_event(device->pnp.device_class, | ||
711 | device->dev.bus_id, event, 0); | ||
707 | break; | 712 | break; |
708 | case ACPI_PROCESSOR_NOTIFY_THROTTLING: | 713 | case ACPI_PROCESSOR_NOTIFY_THROTTLING: |
709 | acpi_processor_tstate_has_changed(pr); | 714 | acpi_processor_tstate_has_changed(pr); |
710 | acpi_bus_generate_event(device, event, 0); | 715 | acpi_bus_generate_event(device, event, 0); |
716 | acpi_bus_generate_netlink_event(device->pnp.device_class, | ||
717 | device->dev.bus_id, event, 0); | ||
711 | default: | 718 | default: |
712 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | 719 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, |
713 | "Unsupported event [0x%x]\n", event)); | 720 | "Unsupported event [0x%x]\n", event)); |
diff --git a/drivers/acpi/sbs.c b/drivers/acpi/sbs.c index 82c3a550016d..2d67e92c8ff7 100644 --- a/drivers/acpi/sbs.c +++ b/drivers/acpi/sbs.c | |||
@@ -445,6 +445,7 @@ static int acpi_sbs_generate_event(struct acpi_device *device, | |||
445 | strcpy(acpi_device_bid(device), bid_saved); | 445 | strcpy(acpi_device_bid(device), bid_saved); |
446 | strcpy(acpi_device_class(device), class_saved); | 446 | strcpy(acpi_device_class(device), class_saved); |
447 | 447 | ||
448 | acpi_bus_generate_netlink_event(class, bid, event, state); | ||
448 | return result; | 449 | return result; |
449 | } | 450 | } |
450 | 451 | ||
diff --git a/drivers/acpi/thermal.c b/drivers/acpi/thermal.c index 1e06159fd9c4..291758c9a4d6 100644 --- a/drivers/acpi/thermal.c +++ b/drivers/acpi/thermal.c | |||
@@ -487,6 +487,10 @@ static int acpi_thermal_critical(struct acpi_thermal *tz) | |||
487 | KELVIN_TO_CELSIUS(tz->temperature)); | 487 | KELVIN_TO_CELSIUS(tz->temperature)); |
488 | acpi_bus_generate_event(tz->device, ACPI_THERMAL_NOTIFY_CRITICAL, | 488 | acpi_bus_generate_event(tz->device, ACPI_THERMAL_NOTIFY_CRITICAL, |
489 | tz->trips.critical.flags.enabled); | 489 | tz->trips.critical.flags.enabled); |
490 | acpi_bus_generate_netlink_event(tz->device->pnp.device_class, | ||
491 | tz->device->dev.bus_id, | ||
492 | ACPI_THERMAL_NOTIFY_CRITICAL, | ||
493 | tz->trips.critical.flags.enabled); | ||
490 | 494 | ||
491 | orderly_poweroff(true); | 495 | orderly_poweroff(true); |
492 | 496 | ||
@@ -506,6 +510,10 @@ static int acpi_thermal_hot(struct acpi_thermal *tz) | |||
506 | 510 | ||
507 | acpi_bus_generate_event(tz->device, ACPI_THERMAL_NOTIFY_HOT, | 511 | acpi_bus_generate_event(tz->device, ACPI_THERMAL_NOTIFY_HOT, |
508 | tz->trips.hot.flags.enabled); | 512 | tz->trips.hot.flags.enabled); |
513 | acpi_bus_generate_netlink_event(tz->device->pnp.device_class, | ||
514 | tz->device->dev.bus_id, | ||
515 | ACPI_THERMAL_NOTIFY_HOT, | ||
516 | tz->trips.hot.flags.enabled); | ||
509 | 517 | ||
510 | /* TBD: Call user-mode "sleep(S4)" function */ | 518 | /* TBD: Call user-mode "sleep(S4)" function */ |
511 | 519 | ||
@@ -1150,11 +1158,15 @@ static void acpi_thermal_notify(acpi_handle handle, u32 event, void *data) | |||
1150 | acpi_thermal_get_trip_points(tz); | 1158 | acpi_thermal_get_trip_points(tz); |
1151 | acpi_thermal_check(tz); | 1159 | acpi_thermal_check(tz); |
1152 | acpi_bus_generate_event(device, event, 0); | 1160 | acpi_bus_generate_event(device, event, 0); |
1161 | acpi_bus_generate_netlink_event(device->pnp.device_class, | ||
1162 | device->dev.bus_id, event, 0); | ||
1153 | break; | 1163 | break; |
1154 | case ACPI_THERMAL_NOTIFY_DEVICES: | 1164 | case ACPI_THERMAL_NOTIFY_DEVICES: |
1155 | if (tz->flags.devices) | 1165 | if (tz->flags.devices) |
1156 | acpi_thermal_get_devices(tz); | 1166 | acpi_thermal_get_devices(tz); |
1157 | acpi_bus_generate_event(device, event, 0); | 1167 | acpi_bus_generate_event(device, event, 0); |
1168 | acpi_bus_generate_netlink_event(device->pnp.device_class, | ||
1169 | device->dev.bus_id, event, 0); | ||
1158 | break; | 1170 | break; |
1159 | default: | 1171 | default: |
1160 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | 1172 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, |
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) |
diff --git a/drivers/pci/hotplug/acpiphp_ibm.c b/drivers/pci/hotplug/acpiphp_ibm.c index 70db38c0ced9..360902476bad 100644 --- a/drivers/pci/hotplug/acpiphp_ibm.c +++ b/drivers/pci/hotplug/acpiphp_ibm.c | |||
@@ -268,6 +268,9 @@ static void ibm_handle_events(acpi_handle handle, u32 event, void *context) | |||
268 | if (subevent == 0x80) { | 268 | if (subevent == 0x80) { |
269 | dbg("%s: generationg bus event\n", __FUNCTION__); | 269 | dbg("%s: generationg bus event\n", __FUNCTION__); |
270 | acpi_bus_generate_event(note->device, note->event, detail); | 270 | acpi_bus_generate_event(note->device, note->event, detail); |
271 | acpi_bus_generate_netlink_event(note->device->pnp.device_class, | ||
272 | note->device->dev.bus_id, | ||
273 | note->event, detail); | ||
271 | } else | 274 | } else |
272 | note->event = event; | 275 | note->event = event; |
273 | } | 276 | } |