diff options
author | Mark Brown <broonie@kernel.org> | 2021-04-15 21:29:40 +0300 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2021-04-15 21:29:40 +0300 |
commit | c7ed5fd5fbb279a75a58cf641b873f57ef906ac7 (patch) | |
tree | 4aac1ad717ce4a757b872463bbfd75f0a182a75e /drivers/spi/spi.c | |
parent | 58eaa7b2d07d3c25e1068b0bf42ca7e7464f4bca (diff) | |
parent | 8c4ffe4d023d7a3153c1d3d1084d98d17bf684b9 (diff) | |
download | linux-c7ed5fd5fbb279a75a58cf641b873f57ef906ac7.tar.xz |
Merge branch 'for-5.12' of https://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi into spi-5.13
Diffstat (limited to 'drivers/spi/spi.c')
-rw-r--r-- | drivers/spi/spi.c | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c index b1419a3576e4..5e9d636777a2 100644 --- a/drivers/spi/spi.c +++ b/drivers/spi/spi.c @@ -2487,6 +2487,7 @@ struct spi_controller *__devm_spi_alloc_controller(struct device *dev, ctlr = __spi_alloc_controller(dev, size, slave); if (ctlr) { + ctlr->devm_allocated = true; *ptr = ctlr; devres_add(dev, ptr); } else { @@ -2824,11 +2825,6 @@ int devm_spi_register_controller(struct device *dev, } EXPORT_SYMBOL_GPL(devm_spi_register_controller); -static int devm_spi_match_controller(struct device *dev, void *res, void *ctlr) -{ - return *(struct spi_controller **)res == ctlr; -} - static int __unregister(struct device *dev, void *null) { spi_unregister_device(to_spi_device(dev)); @@ -2875,8 +2871,7 @@ void spi_unregister_controller(struct spi_controller *ctlr) /* Release the last reference on the controller if its driver * has not yet been converted to devm_spi_alloc_master/slave(). */ - if (!devres_find(ctlr->dev.parent, devm_spi_release_controller, - devm_spi_match_controller, ctlr)) + if (!ctlr->devm_allocated) put_device(&ctlr->dev); /* free bus id */ |