summaryrefslogtreecommitdiff
path: root/drivers/spi
diff options
context:
space:
mode:
authorUwe Kleine-König <u.kleine-koenig@pengutronix.de>2021-10-07 15:14:12 +0300
committerMark Brown <broonie@kernel.org>2021-10-07 17:45:56 +0300
commit6bfb15f34dd8c8a073e03a31c485ef5774b127df (patch)
tree6922ec403e1962e300c7ca6847994c7b4dff45f1 /drivers/spi
parent9e1ff307c779ce1f0f810c7ecce3d95bbae40896 (diff)
downloadlinux-6bfb15f34dd8c8a073e03a31c485ef5774b127df.tar.xz
spi: Move comment about chipselect check to the right place
The part of the comment about locking isn't that relevant compared to the chip select check. So drop the sentence about locking. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Link: https://lore.kernel.org/r/20211007121415.2401638-2-u.kleine-koenig@pengutronix.de Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'drivers/spi')
-rw-r--r--drivers/spi/spi.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
index aea037c65985..ff4254dc64af 100644
--- a/drivers/spi/spi.c
+++ b/drivers/spi/spi.c
@@ -564,6 +564,11 @@ static int __spi_add_device(struct spi_device *spi)
struct device *dev = ctlr->dev.parent;
int status;
+ /*
+ * We need to make sure there's no other device with this
+ * chipselect **BEFORE** we call setup(), else we'll trash
+ * its configuration.
+ */
status = bus_for_each_dev(&spi_bus_type, NULL, spi, spi_dev_check);
if (status) {
dev_err(dev, "chipselect %d already in use\n",
@@ -632,10 +637,6 @@ int spi_add_device(struct spi_device *spi)
/* Set the bus ID string */
spi_dev_set_name(spi);
- /* We need to make sure there's no other device with this
- * chipselect **BEFORE** we call setup(), else we'll trash
- * its configuration. Lock against concurrent add() calls.
- */
mutex_lock(&spi_add_lock);
status = __spi_add_device(spi);
mutex_unlock(&spi_add_lock);