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>
This commit is contained in:
@@ -2162,22 +2162,27 @@ static void dock_notify(struct ibm_struct *ibm, u32 event)
|
||||
int docked = dock_docked();
|
||||
int pci = ibm->acpi->hid && ibm->acpi->device &&
|
||||
acpi_match_device_ids(ibm->acpi->device, ibm_pci_device_ids);
|
||||
int data;
|
||||
|
||||
if (event == 1 && !pci) /* 570 */
|
||||
acpi_bus_generate_event(ibm->acpi->device, event, 1); /* button */
|
||||
data = 1; /* button */
|
||||
else if (event == 1 && pci) /* 570 */
|
||||
acpi_bus_generate_event(ibm->acpi->device, event, 3); /* dock */
|
||||
data = 3; /* dock */
|
||||
else if (event == 3 && docked)
|
||||
acpi_bus_generate_event(ibm->acpi->device, event, 1); /* button */
|
||||
data = 1; /* button */
|
||||
else if (event == 3 && !docked)
|
||||
acpi_bus_generate_event(ibm->acpi->device, event, 2); /* undock */
|
||||
data = 2; /* undock */
|
||||
else if (event == 0 && docked)
|
||||
acpi_bus_generate_event(ibm->acpi->device, event, 3); /* dock */
|
||||
data = 3; /* dock */
|
||||
else {
|
||||
printk(IBM_ERR "unknown dock event %d, status %d\n",
|
||||
event, _sta(dock_handle));
|
||||
acpi_bus_generate_event(ibm->acpi->device, event, 0); /* unknown */
|
||||
data = 0; /* unknown */
|
||||
}
|
||||
acpi_bus_generate_event(ibm->acpi->device, event, data);
|
||||
acpi_bus_generate_netlink_event(ibm->acpi->device->pnp.device_class,
|
||||
ibm->acpi->device->dev.bus_id,
|
||||
event, data);
|
||||
}
|
||||
|
||||
static int dock_read(char *p)
|
||||
@@ -2276,6 +2281,9 @@ static int __init bay_init(struct ibm_init_struct *iibm)
|
||||
static void bay_notify(struct ibm_struct *ibm, u32 event)
|
||||
{
|
||||
acpi_bus_generate_event(ibm->acpi->device, event, 0);
|
||||
acpi_bus_generate_netlink_event(ibm->acpi->device->pnp.device_class,
|
||||
ibm->acpi->device->dev.bus_id,
|
||||
event, 0);
|
||||
}
|
||||
|
||||
#define bay_occupied(b) (_sta(b##_handle) & 1)
|
||||
|
Reference in New Issue
Block a user