aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi
diff options
context:
space:
mode:
authorZhang Rui <rui.zhang@intel.com>2007-08-22 13:24:31 -0400
committerLen Brown <len.brown@intel.com>2007-08-23 14:27:23 -0400
commit962ce8ca0604af0c3c5609f7613d4ec5fcfac623 (patch)
tree8a9fcb67251129a382e202759389d2b72de4b621 /drivers/acpi
parentb377fd3982ad957c796758a90e2988401a884241 (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/acpi')
-rw-r--r--drivers/acpi/ac.c3
-rw-r--r--drivers/acpi/battery.c3
-rw-r--r--drivers/acpi/bus.c4
-rw-r--r--drivers/acpi/event.c13
-rw-r--r--drivers/acpi/processor_core.c7
-rw-r--r--drivers/acpi/sbs.c1
-rw-r--r--drivers/acpi/thermal.c12
7 files changed, 35 insertions, 8 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
150int acpi_bus_generate_genetlink_event(struct acpi_device *device, 150int 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
215EXPORT_SYMBOL(acpi_bus_generate_netlink_event);
216
214static int acpi_event_genetlink_init(void) 217static 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
231int acpi_bus_generate_genetlink_event(struct acpi_device *device, u8 type, 234int 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
240EXPORT_SYMBOL(acpi_generate_netlink_event);
241
237static int acpi_event_genetlink_init(void) 242static 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,