]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commit
ACPI: EC: Consolidate event handler installation code
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>
Tue, 3 Mar 2020 19:15:04 +0000 (20:15 +0100)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Sat, 14 Mar 2020 09:59:44 +0000 (10:59 +0100)
commit03e9a0e05739cf872fee494b06c75c0469704a21
treea80c6a2284881a982548d7358d6a4ae4f0ecc6a2
parent3d9b8dd8320de69945ea7ccd0d1a76464138ba37
ACPI: EC: Consolidate event handler installation code

Commit 406857f773b0 ("ACPI: EC: add support for hardware-reduced
systems") made ec_install_handlers() return an error on failures
to configure a GPIO IRQ for the EC, but that is inconsistent with
the handling of the GPE event handler installation failures even
though it is exactly the same issue and the driver can respond to
it in the same way in both cases (the EC can be actively polled
for events through its registers if the event handler installation
fails).

Moreover, it requires acpi_ec_add() to take that special case into
account and disagrees with the ec_install_handlers() header comment.

For this reason, rework the event handler installation code in
ec_install_handlers() to explicitly take deferred probing (that
may be needed in the GPIO IRQ case) into account and to avoid
failing the EC initialization in any other case.

Among other things, reduce code duplication between
install_gpe_event_handler() and install_gpio_irq_event_handler() by
moving some code from there into ec_install_handlers() itself and
simplify the error code path in acpi_ec_add().

While at it, turn the ec_install_handlers() header comment into
a proper kerneldoc one and add some general control flow information
to it.

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Tested-by: Jian-Hong Pan <jian-hong@endlessm.com>
drivers/acpi/ec.c