Re: [PATCH v2 1/2] ACPI: EC: Install address space handler at the namespace root

From: Rafael J. Wysocki
Date: Thu May 16 2024 - 06:27:04 EST


On Thu, May 16, 2024 at 12:22 PM Andy Shevchenko
<andriy.shevchenko@xxxxxxxxxxxxxxx> wrote:
>
> On Wed, May 15, 2024 at 09:40:54PM +0200, Rafael J. Wysocki wrote:
> > From: Rafael J. Wysocki <rafael.j.wysocki@xxxxxxxxx>
> >
> > It is reported that _DSM evaluation fails in ucsi_acpi_dsm() on Lenovo
> > IdeaPad Pro 5 due to a missing address space handler for the EC address
> > space:
> >
> > ACPI Error: No handler for Region [ECSI] (000000007b8176ee) [EmbeddedControl] (20230628/evregion-130)
> >
> > This happens because if there is no ECDT, the EC driver only registers
> > the EC address space handler for operation regions defined in the EC
> > device scope of the ACPI namespace while the operation region being
> > accessed by the _DSM in question is located beyond that scope.
> >
> > To address this, modify the ACPI EC driver to install the EC address
> > space handler at the root of the ACPI namespace for the first EC that
> > can be found regardless of whether or not an ECDT is present.
> >
> > Note that this change is consistent with some examples in the ACPI
> > specification in which EC operation regions located outside the EC
> > device scope are used (for example, see Section 9.17.15 in ACPI 6.5),
> > so the current behavior of the EC driver is arguably questionable.
>
> ...
>
> > - status = acpi_install_address_space_handler_no_reg(ec->handle,
> > + status = acpi_install_address_space_handler_no_reg(scope_handle,
> > ACPI_ADR_SPACE_EC,
> > &acpi_ec_space_handler,
> > NULL, ec);
>
> Looking at this...
>
> > if (ACPI_FAILURE(acpi_remove_address_space_handler(
> > + scope_handle,
> > + ACPI_ADR_SPACE_EC,
> > + &acpi_ec_space_handler)))
>
> ...and this, I believe you can move scope_handle to the previous line and align
> the rest for the sake of consistency and slightly better readability.

Well, I prefer to cut a separate cleanup patch to make this more consistent.