From: Charles Keepax <ckeepax@opensource.cirrus.com>
To: <broonie@kernel.org>, <linus.walleij@linaro.org>, <brgl@bgdev.pl>
Cc: <linux-gpio@vger.kernel.org>, <linux-spi@vger.kernel.org>,
<patches@opensource.cirrus.com>
Subject: [PATCH v4 2/3] spi: Add a mechanism to use the fwnode name for the SPI device
Date: Tue, 9 Apr 2024 14:21:25 +0100 [thread overview]
Message-ID: <20240409132126.1117916-3-ckeepax@opensource.cirrus.com> (raw)
In-Reply-To: <20240409132126.1117916-1-ckeepax@opensource.cirrus.com>
Add a mechanism to force the use of the fwnode name for the name of the
SPI device itself. This is useful when devices need to be manually added
within the kernel.
Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
---
Changes since v3:
- Always name swnode SPI devices after the node name
Thanks,
Charles
drivers/spi/spi.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
index a2f01116ba09..52c70705d179 100644
--- a/drivers/spi/spi.c
+++ b/drivers/spi/spi.c
@@ -598,12 +598,18 @@ EXPORT_SYMBOL_GPL(spi_alloc_device);
static void spi_dev_set_name(struct spi_device *spi)
{
struct acpi_device *adev = ACPI_COMPANION(&spi->dev);
+ struct fwnode_handle *fwnode = dev_fwnode(&spi->dev);
if (adev) {
dev_set_name(&spi->dev, "spi-%s", acpi_dev_name(adev));
return;
}
+ if (is_software_node(fwnode)) {
+ dev_set_name(&spi->dev, "spi-%s", fwnode_get_name(fwnode));
+ return;
+ }
+
dev_set_name(&spi->dev, "%s.%u", dev_name(&spi->controller->dev),
spi_get_chipselect(spi, 0));
}
--
2.39.2
next prev parent reply other threads:[~2024-04-09 13:21 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-09 13:21 [PATCH 0/3] Add bridged amplifiers to cs42l43 Charles Keepax
2024-04-09 13:21 ` [PATCH v4 1/3] gpio: swnode: Add ability to specify native chip selects for SPI Charles Keepax
2024-04-09 13:50 ` Linus Walleij
2024-04-09 18:03 ` Andy Shevchenko
2024-04-10 8:44 ` Charles Keepax
2024-04-09 13:21 ` Charles Keepax [this message]
2024-04-09 14:46 ` [PATCH v4 2/3] spi: Add a mechanism to use the fwnode name for the SPI device Charles Keepax
2024-04-09 18:06 ` Andy Shevchenko
2024-04-10 8:42 ` Charles Keepax
2024-04-09 13:21 ` [PATCH v4 3/3] spi: cs42l43: Add bridged cs35l56 amplifiers Charles Keepax
2024-04-09 18:26 ` Andy Shevchenko
2024-04-10 9:11 ` Charles Keepax
2024-04-10 7:42 ` kernel test robot
2024-04-10 8:01 ` Andy Shevchenko
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=20240409132126.1117916-3-ckeepax@opensource.cirrus.com \
--to=ckeepax@opensource.cirrus.com \
--cc=brgl@bgdev.pl \
--cc=broonie@kernel.org \
--cc=linus.walleij@linaro.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-spi@vger.kernel.org \
--cc=patches@opensource.cirrus.com \
/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).