FAILED: patch "[PATCH] spi: Fix controller unregister order" failed to apply to 4.4-stable tree
Subsystems (2)
[email protected]
maintainerThe patch below does not apply to the 4.4-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From 84855678add8aba927faf76bc2f130a40f94b6f7 Mon Sep 17 00:00:00 2001
From: Lukas Wunner <[email protected]>
Date: Fri, 15 May 2020 17:58:01 +0200
Subject: [PATCH] spi: Fix controller unregister order
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().
drivers/spi/spi.c +2 -1
@@ -2763,6 +2763,8 @@ void spi_unregister_controller(struct spi_controller *ctlr)struct spi_controller *found;int id = ctlr->bus_num; +device_for_each_child (&ctlr->dev,NULL , __unregister); +/* First make sure that this controller was ever added */ mutex_lock (&board_lock); found =idr_find (&spi_master_idr, id);
@@ -2775,7 +2777,6 @@ void spi_unregister_controller(struct spi_controller *ctlr)list_del (&ctlr->list);mutex_unlock (&board_lock); -device_for_each_child (&ctlr->dev,NULL , __unregister);device_unregister (&ctlr->dev);/* free bus id */ mutex_lock (&board_lock);