From: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
To: Mark Brown <broonie@kernel.org>
Cc: linux-spi@vger.kernel.org, kernel@pengutronix.de
Subject: [PATCH 1/4] spi: Move comment about chipselect check to the right place
Date: Thu, 7 Oct 2021 14:14:12 +0200 [thread overview]
Message-ID: <20211007121415.2401638-2-u.kleine-koenig@pengutronix.de> (raw)
In-Reply-To: <20211007121415.2401638-1-u.kleine-koenig@pengutronix.de>
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>
---
drivers/spi/spi.c | 9 +++++----
1 file 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);
--
2.30.2
next prev parent reply other threads:[~2021-10-07 12:14 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-07 12:14 [PATCH 0/4] spi: Various Cleanups Uwe Kleine-König
2021-10-07 12:14 ` Uwe Kleine-König [this message]
2021-10-07 12:14 ` [PATCH 2/4] spi: Remove unused function spi_busnum_to_master() Uwe Kleine-König
2021-10-07 12:14 ` [PATCH 3/4] spi: Reorder functions to simplify the next commit Uwe Kleine-König
2021-10-07 12:14 ` [PATCH 4/4] spi: Make several public functions private to spi.c Uwe Kleine-König
2021-10-07 21:37 ` [PATCH 0/4] spi: Various Cleanups Mark Brown
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20211007121415.2401638-2-u.kleine-koenig@pengutronix.de \
--to=u.kleine-koenig@pengutronix.de \
--cc=broonie@kernel.org \
--cc=kernel@pengutronix.de \
--cc=linux-spi@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).