summaryrefslogtreecommitdiffstats
path: root/drivers/atm/iphase.c
diff options
context:
space:
mode:
authorLukas Wunner <lukas@wunner.de>2020-05-25 14:25:01 +0200
committerMark Brown <broonie@kernel.org>2020-05-26 15:40:29 +0100
commitca8b19d61e3fce5d2d7790cde27a0b57bcb3f341 (patch)
treeaf812e58156dcf79e60910d84394d5b7f1870a53 /drivers/atm/iphase.c
parenta2b02e4623fb127fa65a13e4ac5aa56e4ae16291 (diff)
downloadlinux-ca8b19d61e3fce5d2d7790cde27a0b57bcb3f341.tar.bz2
spi: dw: Fix controller unregister order
The Designware SPI driver uses devm_spi_register_controller() on bind. As a consequence, on unbind, __device_release_driver() first invokes dw_spi_remove_host() before unregistering the SPI controller via devres_release_all(). This order is incorrect: dw_spi_remove_host() shuts down the chip, rendering the SPI bus inaccessible even though the SPI controller is still registered. When the SPI controller is subsequently unregistered, it unbinds all its slave devices. Because their drivers cannot access the SPI bus, e.g. to quiesce interrupts, the slave devices may be left in an improper state. As a rule, devm_spi_register_controller() must not be used if the ->remove() hook performs teardown steps which shall be performed after unregistering the controller and specifically after unbinding of slaves. Fix by reverting to the non-devm variant of spi_register_controller(). An alternative approach would be to use device-managed functions for all steps in dw_spi_remove_host(), e.g. by calling devm_add_action_or_reset() on probe. However that approach would add more LoC to the driver and it wouldn't lend itself as well to backporting to stable. Fixes: 04f421e7b0b1 ("spi: dw: use managed resources") Signed-off-by: Lukas Wunner <lukas@wunner.de> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Cc: stable@vger.kernel.org # v3.14+ Cc: Baruch Siach <baruch@tkos.co.il> Link: https://lore.kernel.org/r/3fff8cb8ae44a9893840d0688be15bb88c090a14.1590408496.git.lukas@wunner.de Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'drivers/atm/iphase.c')
0 files changed, 0 insertions, 0 deletions