• Rafael J. Wysocki's avatar
    ACPI: EC: Consolidate event handler installation code · 03e9a0e0
    Rafael J. Wysocki authored
    Commit 406857f7 ("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: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
    Tested-by: default avatarJian-Hong Pan <jian-hong@endlessm.com>
    03e9a0e0
ec.c 58.2 KB