]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commit
spi: bcm2835aux: fix driver to not allow 65535 (=-1) cs-gpios
authorMartin Sperl <kernel@martin.sperl.org>
Sat, 30 Mar 2019 09:31:02 +0000 (09:31 +0000)
committerKhalid Elmously <khalid.elmously@canonical.com>
Fri, 14 Feb 2020 05:29:37 +0000 (00:29 -0500)
commitae8fde8bc513f724c8ef2bfc4192f7b83e443b85
treea4e3563fa46f6521581b11467b88ab13336a52ee
parent9622c0369696c10f5539624350a70ac40ec5d7b4
spi: bcm2835aux: fix driver to not allow 65535 (=-1) cs-gpios

BugLink: https://bugs.launchpad.net/bugs/1863019
[ Upstream commit 509c583620e9053e43d611bf1614fc3d3abafa96 ]

The original driver by default defines num_chipselects as -1.
This actually allicates an array of 65535 entries in
of_spi_register_master.

There is a side-effect for buggy device trees that (contrary to
dt-binding documentation) have no cs-gpio defined.

This mode was never supported by the driver due to limitations
of native cs and additional code complexity and is explicitly
not stated to be implemented.

To keep backwards compatibility with such buggy DTs we limit
the number of chip_selects to 1, as for all practical purposes
it is only ever realistic to use a single chip select in
native cs mode without negative side-effects.

Fixes: 1ea29b39f4c812ec ("spi: bcm2835aux: add bcm2835 auxiliary spi device...")
Signed-off-by: Martin Sperl <kernel@martin.sperl.org>
Acked-by: Stefan Wahren <stefan.wahren@i2se.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Khalid Elmously <khalid.elmously@canonical.com>
drivers/spi/spi-bcm2835aux.c