From: Charles Keepax <ckeepax@opensource.cirrus.com>
To: Andy Shevchenko <andy.shevchenko@gmail.com>
Cc: <broonie@kernel.org>, <linus.walleij@linaro.org>, <brgl@bgdev.pl>,
<linux-gpio@vger.kernel.org>, <linux-spi@vger.kernel.org>,
<patches@opensource.cirrus.com>
Subject: Re: [PATCH v3 2/3] spi: Add a mechanism to use the fwnode name for the SPI device
Date: Mon, 8 Apr 2024 13:51:56 +0000 [thread overview]
Message-ID: <ZhP2fPYd28sXw7EZ@ediswmail9.ad.cirrus.com> (raw)
In-Reply-To: <Zg28J59MRvk3B-_J@surfacebook.localdomain>
On Wed, Apr 03, 2024 at 11:29:27PM +0300, Andy Shevchenko wrote:
> Fri, Mar 29, 2024 at 11:47:29AM +0000, Charles Keepax kirjoitti:
> > struct acpi_device *adev = ACPI_COMPANION(&spi->dev);
> > + struct fwnode_handle *fwnode = dev_fwnode(&spi->dev);
> > +
> > + if (spi->use_fwnode_name && fwnode) {
> > + dev_set_name(&spi->dev, "spi-%s", fwnode_get_name(fwnode));
> > + return;
> > + }
> >
> > if (adev) {
> > dev_set_name(&spi->dev, "spi-%s", acpi_dev_name(adev));
>
> This should be something like this
>
> struct device *dev = &spi->dev;
> struct fwnode_handle *fwnode = dev_fwnode(dev);
>
> if (is_acpi_device_node(fwnode)) {
> dev_set_name(dev, "spi-%s", acpi_dev_name(to_acpi_device_node(fwnode)));
> return;
> }
>
> if (is_software_node(fwnode)) {
> dev_set_name(dev, "spi-%s", fwnode_get_name(fwnode));
> return;
> }
>
> i.o.w. we don't need to have two ways of checking fwnode type and you may get
> rid of unneeded variable, and always use fwnode name for swnode.
>
> ...
>
> > + proxy->use_fwnode_name = chip->use_fwnode_name;
>
> Unneeded variable. See above.
>
Hmm... I guess I was viewing this feature more as something that
users would opt into. So other firmware mechanisms could use it
if required, and so most swnode based controllers would still get
caught by the standard naming at the bottom of the function.
From my perspective it will do what I need either way, so happy
to update it to always use this for software nodes if consensus
goes that way.
Thanks,
Charles
next prev parent reply other threads:[~2024-04-08 13:52 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-29 11:47 [PATCH 0/3] Add bridged amplifiers to cs42l43 Charles Keepax
2024-03-29 11:47 ` [PATCH v3 1/3] gpio: swnode: Add ability to specify native chip selects for SPI Charles Keepax
2024-04-03 20:21 ` Andy Shevchenko
2024-03-29 11:47 ` [PATCH v3 2/3] spi: Add a mechanism to use the fwnode name for the SPI device Charles Keepax
2024-04-03 20:29 ` Andy Shevchenko
2024-04-08 13:51 ` Charles Keepax [this message]
2024-04-08 16:11 ` Andy Shevchenko
2024-03-29 11:47 ` [PATCH v3 3/3] spi: cs42l43: Add bridged cs35l56 amplifiers Charles Keepax
2024-04-03 20:47 ` Andy Shevchenko
2024-04-08 15:35 ` Charles Keepax
2024-04-08 16:07 ` Andy Shevchenko
2024-04-08 19:50 ` Andy Shevchenko
2024-04-08 20:07 ` Andy Shevchenko
2024-04-09 9:24 ` Charles Keepax
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=ZhP2fPYd28sXw7EZ@ediswmail9.ad.cirrus.com \
--to=ckeepax@opensource.cirrus.com \
--cc=andy.shevchenko@gmail.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).