spi: sync up initial chipselect state
authorDavid Bauer <mail@david-bauer.net>
Fri, 16 Apr 2021 19:59:56 +0000 (21:59 +0200)
committerMark Brown <broonie@kernel.org>
Mon, 19 Apr 2021 13:18:45 +0000 (14:18 +0100)
commitd347b4aaa1a042ea528e385d9070b74c77a14321
tree8af2fcc68fc238cafa45a31b364ad41eb33a7456
parent126bdb606fd2802454e6048caef1be3e25dd121e
spi: sync up initial chipselect state

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>
drivers/spi/spi.c