Re: [PATCH] spi/acpi: fix incorrect ACPI parent check

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 6/19/19 1:16 PM, Mika Westerberg wrote:
On Wed, Jun 19, 2019 at 11:52:54AM +0200, Ard Biesheuvel wrote:
The ACPI device object parsing code for SPI slaves enumerates the
entire ACPI namespace to look for devices that refer to the master
in question via the 'resource_source' field in the 'SPISerialBus'
resource. If that field does not refer to a valid ACPI device or
if it refers to the wrong SPI master, we should disregard the
device.

Current, the valid device check is wrong, since it gets the
polarity of 'status' wrong. This could cause issues if the
'resource_source' field is bogus but parent_handle happens to
refer to the correct master (which is not entirely imaginary
since this code runs in a loop)

So test for ACPI_FAILURE() instead, to make the code more
self explanatory.

Fixes: 4c3c59544f33 ("spi/acpi: enumerate all SPI slaves in the namespace")
Reported-by: kbuild test robot <lkp@xxxxxxxxx>
Reported-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx>
Cc: Mika Westerberg <mika.westerberg@xxxxxxxxxxxxxxx>

Acked-by: Mika Westerberg <mika.westerberg@xxxxxxxxxxxxxxx>

I hit yesterday a regression caused by 4c3c59544f33. I've a custom ACPI tables defining I2C gpio expanders (gpio-pca953x.c as INT3491) and a spidev test device (SPT0001).

Both stopped enumerating after 4c3c59544f33. With this fix spidev device enumerates but still get confused with I2C GPIO expanders (INT3491):

[    5.629874][    T1] pxa2xx-spi pxa2xx-spi.3: registered master spi3
[    5.644447][    T1] pxa2xx-spi pxa2xx-spi.5: registered master spi5
[    5.653930][    T1] spi spi-SPT0001:00: in setup: DMA burst size set to 8
[ 5.661300][ T1] spi spi-SPT0001:00: setup mode 0, 8 bits/w, 1000000 Hz max --> 0 [ 5.671360][ T1] spidev spi-SPT0001:00: do not use this driver in production systems! [ 5.682325][ T1] pxa2xx-spi pxa2xx-spi.5: registered child spi-SPT0001:00
[    5.690240][    T1] spi spi-PRP0001:00: in setup: DMA burst size set to 8
[ 5.697492][ T1] spi spi-PRP0001:00: setup mode 0, 8 bits/w, 20000000 Hz max --> 0 [ 5.706928][ T1] pxa2xx-spi pxa2xx-spi.5: registered child spi-PRP0001:00
[    5.715754][    T1] pxa2xx-spi pxa2xx-spi.5: cs104 >= max 4
[ 5.721688][ T1] spi_master spi5: failed to add SPI device INT3491:00 from ACPI
[    5.730648][    T1] pxa2xx-spi pxa2xx-spi.5: cs104 >= max 4
[ 5.736657][ T1] spi_master spi5: failed to add SPI device INT3491:01 from ACPI
[    5.745617][    T1] pxa2xx-spi pxa2xx-spi.5: cs104 >= max 4
[ 5.751546][ T1] spi_master spi5: failed to add SPI device INT3491:02 from ACPI
[    5.760628][    T1] pxa2xx-spi pxa2xx-spi.5: cs104 >= max 4
[ 5.766549][ T1] spi_master spi5: failed to add SPI device INT3491:03 from ACPI
[    5.777160][    T1] pxa2xx-spi pxa2xx-spi.5: cs104 >= max 4
[ 5.783087][ T1] spi_master spi5: failed to add SPI device BCM2E95:00 from ACPI
[    5.797008][    T1] pxa2xx-spi pxa2xx-spi.6: registered master spi6

Ok log with commit 4c3c59544f33 reverted:

[    5.633116][    T1] pxa2xx-spi pxa2xx-spi.3: registered master spi3
[    5.647701][    T1] pxa2xx-spi pxa2xx-spi.5: registered master spi5
[    5.655668][    T1] spi spi-SPT0001:00: in setup: DMA burst size set to 8
[ 5.663066][ T1] spi spi-SPT0001:00: setup mode 0, 8 bits/w, 1000000 Hz max --> 0 [ 5.672758][ T1] pxa2xx-spi pxa2xx-spi.5: registered child spi-SPT0001:00
[    5.680602][    T1] spi spi-PRP0001:00: in setup: DMA burst size set to 8
[ 5.687820][ T1] spi spi-PRP0001:00: setup mode 0, 8 bits/w, 20000000 Hz max --> 0 [ 5.697366][ T1] pxa2xx-spi pxa2xx-spi.5: registered child spi-PRP0001:00
[    5.709064][    T1] pxa2xx-spi pxa2xx-spi.6: registered master spi6
[ 11.021760][ T84] spidev spi-SPT0001:00: do not use this driver in production systems!

--
Jarkko



[Index of Archives]     [Linux Kernel]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]

  Powered by Linux