]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
spi: fix controller deregistration (part 2/2)
authorMark Brown <broonie@kernel.org>
Fri, 10 Apr 2026 12:22:46 +0000 (13:22 +0100)
committerMark Brown <broonie@kernel.org>
Fri, 10 Apr 2026 12:22:46 +0000 (13:22 +0100)
commit81c9cdb110ef4a2dd653286a06ce0ae9ac05aac1
treec58b504ab6d5a77182a704c802b01f34ac725b8f
parent5b94c94caafcad3c77cc6b1d213a93bf5dc0a98e
parentc9c012706c9fa8ca6d129a9161caf92ab625a3fd
spi: fix controller deregistration (part 2/2)

Johan Hovold <johan@kernel.org> says:

Device managed registration generally only works if all involved
resources are managed as otherwise resources may be disabled or freed
while they are still in use.

This series fixes the SPI controller drivers that get this wrong by
disabling resources such as clocks, DMA and interrupts while the
controller (and its devices) are still registered, which can lead to
issues like system errors due to unclocked accesses, NULL-pointer
dereferences, hangs or just prevent SPI device drivers from doing I/O
during during deregistration (e.g. to power down devices).

I decided to split these fixes in two parts consisting of 20 and 26
patches respectively in order not to spam the lists too much.

I've also prepared a follow-on series to convert the drivers here that
do not yet use device managed controller allocation (which avoids taking
extra references during deregistration).

After that it should be possible to change the SPI API so that it no
longer drops a reference during deregistration without too much effort
(cf. [1]).

Note that this series is based on spi/for-next which specifically has
commit 1f8fd9490e31 ("spi: zynq-qspi: Simplify clock handling with
devm_clk_get_enabled()") (which is not in the for-7.1 branch).

Johan

[1] https://lore.kernel.org/lkml/20260325145319.1132072-1-johan@kernel.org/