Skip to content

Commit 365eac5

Browse files
committed
ACPI: bus: Simplify installation and removal of notify callback
Because the only drivers that cared about button fixed events take care of those events by themselves now, eliminate the code related to them from acpi_device_install_notify_handler() and acpi_device_remove_notify_handler(). Signed-off-by: Rafael J. Wysocki <[email protected]>
1 parent ff1d7ae commit 365eac5

File tree

1 file changed

+9
-44
lines changed

1 file changed

+9
-44
lines changed

drivers/acpi/bus.c

Lines changed: 9 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -530,65 +530,30 @@ static void acpi_notify_device(acpi_handle handle, u32 event, void *data)
530530
acpi_drv->ops.notify(device, event);
531531
}
532532

533-
static void acpi_notify_device_fixed(void *data)
534-
{
535-
struct acpi_device *device = data;
536-
537-
/* Fixed hardware devices have no handles */
538-
acpi_notify_device(NULL, ACPI_FIXED_HARDWARE_EVENT, device);
539-
}
540-
541-
static u32 acpi_device_fixed_event(void *data)
542-
{
543-
acpi_os_execute(OSL_NOTIFY_HANDLER, acpi_notify_device_fixed, data);
544-
return ACPI_INTERRUPT_HANDLED;
545-
}
546-
547533
static int acpi_device_install_notify_handler(struct acpi_device *device,
548534
struct acpi_driver *acpi_drv)
549535
{
550-
acpi_status status;
551-
552-
if (device->device_type == ACPI_BUS_TYPE_POWER_BUTTON) {
553-
status =
554-
acpi_install_fixed_event_handler(ACPI_EVENT_POWER_BUTTON,
555-
acpi_device_fixed_event,
556-
device);
557-
} else if (device->device_type == ACPI_BUS_TYPE_SLEEP_BUTTON) {
558-
status =
559-
acpi_install_fixed_event_handler(ACPI_EVENT_SLEEP_BUTTON,
560-
acpi_device_fixed_event,
561-
device);
562-
} else {
563-
u32 type = acpi_drv->flags & ACPI_DRIVER_ALL_NOTIFY_EVENTS ?
536+
u32 type = acpi_drv->flags & ACPI_DRIVER_ALL_NOTIFY_EVENTS ?
564537
ACPI_ALL_NOTIFY : ACPI_DEVICE_NOTIFY;
538+
acpi_status status;
565539

566-
status = acpi_install_notify_handler(device->handle, type,
567-
acpi_notify_device,
568-
device);
569-
}
570-
540+
status = acpi_install_notify_handler(device->handle, type,
541+
acpi_notify_device, device);
571542
if (ACPI_FAILURE(status))
572543
return -EINVAL;
544+
573545
return 0;
574546
}
575547

576548
static void acpi_device_remove_notify_handler(struct acpi_device *device,
577549
struct acpi_driver *acpi_drv)
578550
{
579-
if (device->device_type == ACPI_BUS_TYPE_POWER_BUTTON) {
580-
acpi_remove_fixed_event_handler(ACPI_EVENT_POWER_BUTTON,
581-
acpi_device_fixed_event);
582-
} else if (device->device_type == ACPI_BUS_TYPE_SLEEP_BUTTON) {
583-
acpi_remove_fixed_event_handler(ACPI_EVENT_SLEEP_BUTTON,
584-
acpi_device_fixed_event);
585-
} else {
586-
u32 type = acpi_drv->flags & ACPI_DRIVER_ALL_NOTIFY_EVENTS ?
551+
u32 type = acpi_drv->flags & ACPI_DRIVER_ALL_NOTIFY_EVENTS ?
587552
ACPI_ALL_NOTIFY : ACPI_DEVICE_NOTIFY;
588553

589-
acpi_remove_notify_handler(device->handle, type,
590-
acpi_notify_device);
591-
}
554+
acpi_remove_notify_handler(device->handle, type,
555+
acpi_notify_device);
556+
592557
acpi_os_wait_events_complete();
593558
}
594559

0 commit comments

Comments
 (0)