Commit 27e7db56 authored by Saravana Kannan's avatar Saravana Kannan Committed by Mark Brown

spi: Don't have controller clean up spi device before driver unbind

When a spi device is unregistered and triggers a driver unbind, the
driver might need to access the spi device. So, don't have the
controller clean up the spi device before the driver is unbound. Clean
up the spi device after the driver is unbound.

Fixes: c7299fea ("spi: Fix spi device unregister flow")
Reported-by: default avatarLukas Wunner <lukas@wunner.de>
Signed-off-by: default avatarSaravana Kannan <saravanak@google.com>
Tested-by: default avatarAndy Shevchenko <andy.shevchenko@gmail.com>
Link: https://lore.kernel.org/r/20210505164734.175546-1-saravanak@google.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent 6b695469
......@@ -714,8 +714,6 @@ void spi_unregister_device(struct spi_device *spi)
if (!spi)
return;
spi_cleanup(spi);
if (spi->dev.of_node) {
of_node_clear_flag(spi->dev.of_node, OF_POPULATED);
of_node_put(spi->dev.of_node);
......@@ -723,7 +721,9 @@ void spi_unregister_device(struct spi_device *spi)
if (ACPI_COMPANION(&spi->dev))
acpi_device_clear_enumerated(ACPI_COMPANION(&spi->dev));
device_remove_software_node(&spi->dev);
device_unregister(&spi->dev);
device_del(&spi->dev);
spi_cleanup(spi);
put_device(&spi->dev);
}
EXPORT_SYMBOL_GPL(spi_unregister_device);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment