Re: [PATCH v2] spi/acpi: enumerate all SPI slaves in the namespace
From: Life is hard, and then you die <hidden>
Date: 2019-06-09 23:44:49
Also in:
linux-acpi, linux-spi
On Thu, May 30, 2019 at 01:16:34PM +0200, Ard Biesheuvel wrote:
Currently, the ACPI enumeration that takes place when registering a SPI master only considers immediate child devices in the ACPI namespace, rather than checking the ResourceSource field in the SpiSerialBus() resource descriptor. This is incorrect: SPI slaves could reside anywhere in the ACPI namespace, and so we should enumerate the entire namespace and look for any device that refers to the newly registered SPI master in its resource descriptor. So refactor the existing code and use a lookup structure so that allocating the SPI device structure is deferred until we have identified the device as an actual child of the controller. This approach is loosely based on the way the I2C subsystem handles ACPI enumeration. Note that Apple x86 hardware does not rely on SpiSerialBus() resources in _CRS but uses nested devices below the controller's device node in the ACPI namespace, with a special set of device properties. This means we have to take care to only parse those properties for device nodes that are direct children of the controller node. Cc: Mika Westerberg <mika.westerberg@linux.intel.com> Cc: linux-spi@vger.kernel.org Cc: broonie@kernel.org Cc: andy.shevchenko@gmail.com Cc: masahisa.kojima@linaro.org Cc: "Rafael J. Wysocki" <redacted> Cc: Jarkko Nikula <redacted> Cc: linux-acpi@vger.kernel.org Cc: Lukas Wunner <lukas@wunner.de> Signed-off-by: Ard Biesheuvel <redacted> --- drivers/spi/spi.c | 103 ++++++++++++++------ 1 file changed, 72 insertions(+), 31 deletions(-)
[snip] FYI, I tested this on a MacBook Pro where the (SPI) keyboard driver depends on those special device properties, and verified this patch doesn't break anything there. Cheers, Ronald _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel