]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
spi: sync up initial chipselect state
authorDavid Bauer <mail@david-bauer.net>
Fri, 16 Apr 2021 19:59:56 +0000 (21:59 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 12 May 2021 06:37:18 +0000 (08:37 +0200)
commitcdc26c2bb3fd6cf6e81f08f60778a365c26e10dc
tree6346f6b144c4ea2779085adc05c58074fb34a4f3
parent2bec84bc51f2d854b0374b8606d07aac8d7ad21e
spi: sync up initial chipselect state

[ Upstream commit d347b4aaa1a042ea528e385d9070b74c77a14321 ]

When initially probing the SPI slave device, the call for disabling an
SPI device without the SPI_CS_HIGH flag is not applied, as the
condition for checking whether or not the state to be applied equals the
one currently set evaluates to true.

This however might not necessarily be the case, as the chipselect might
be active.

Add a force flag to spi_set_cs which allows to override this
early exit condition. Set it to false everywhere except when called
from spi_setup to sync up the initial CS state.

Fixes commit d40f0b6f2e21 ("spi: Avoid setting the chip select if we don't
need to")

Signed-off-by: David Bauer <mail@david-bauer.net>
Link: https://lore.kernel.org/r/20210416195956.121811-1-mail@david-bauer.net
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/spi/spi.c