summaryrefslogtreecommitdiff
path: root/drivers/spi
diff options
context:
space:
mode:
authorLukas Wunner <lukas@wunner.de>2020-05-15 17:58:01 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2020-06-20 10:23:17 +0200
commitb4c6230bb0babe04d135d5c2d7343b7fb7ee9e4b (patch)
treee0d4976bb1fdb636c03767d0c6e1d90147d203f0 /drivers/spi
parentfccbb6523d8757d230ed27194906d4e46ae9a7d5 (diff)
spi: Fix controller unregister order
[ Upstream commit 84855678add8aba927faf76bc2f130a40f94b6f7 ] When an SPI controller unregisters, it unbinds all its slave devices. For this, their drivers may need to access the SPI bus, e.g. to quiesce interrupts. However since commit ffbbdd21329f ("spi: create a message queueing infrastructure"), spi_destroy_queue() is executed before unbinding the slaves. It sets ctlr->running = false, thereby preventing SPI bus access and causing unbinding of slave devices to fail. Fix by unbinding slaves before calling spi_destroy_queue(). Fixes: ffbbdd21329f ("spi: create a message queueing infrastructure") Signed-off-by: Lukas Wunner <lukas@wunner.de> Cc: stable@vger.kernel.org # v3.4+ Cc: Linus Walleij <linus.walleij@linaro.org> Link: https://lore.kernel.org/r/8aaf9d44c153fe233b17bc2dec4eb679898d7e7b.1589557526.git.lukas@wunner.de Signed-off-by: Mark Brown <broonie@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'drivers/spi')
-rw-r--r--drivers/spi/spi.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
index e5460d84ed08..57001f8f727a 100644
--- a/drivers/spi/spi.c
+++ b/drivers/spi/spi.c
@@ -1922,11 +1922,12 @@ void spi_unregister_master(struct spi_master *master)
dev_err(&master->dev, "queue remove failed\n");
}
+ device_for_each_child(&master->dev, NULL, __unregister);
+
mutex_lock(&board_lock);
list_del(&master->list);
mutex_unlock(&board_lock);
- device_for_each_child(&master->dev, NULL, __unregister);
device_unregister(&master->dev);
}
EXPORT_SYMBOL_GPL(spi_unregister_master);