From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: "Frank Wunderlich (linux)" <linux@fw-web.de>
Cc: Linus Walleij <linusw@kernel.org>,
Bartosz Golaszewski <brgl@kernel.org>,
Frank Wunderlich <frank-w@public-files.de>,
Mika Westerberg <mika.westerberg@linux.intel.com>,
linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org,
frank.wunderlich@linux.dev
Subject: Re: [PATCH] gpiolib: use of_node_name if line-name is missing
Date: Thu, 17 Sep 2026 16:37:52 +0300 [thread overview]
Message-ID: <aqvtMDiqCzsxUDKw@ashevche-desk.local> (raw)
In-Reply-To: <85b0d147af3b63a6b2419b7daaf81332@fw-web.de>
On Thu, Sep 17, 2026 at 03:20:49PM +0200, Frank Wunderlich (linux) wrote:
> Am 2026-09-17 15:00, schrieb Andy Shevchenko:
> > On Thu, Sep 17, 2026 at 02:28:13PM +0200, Frank Wunderlich wrote:
...
> > > int gpiochip_add_hog(struct gpio_chip *gc, struct fwnode_handle
> > > *fwnode)
> >
> > > fwnode_property_read_string(fwnode, "line-name", &name);
> > >
> > > + if (!name && is_of_node(fwnode))
> > > + name = to_of_node(fwnode)->name;
> >
> > Can we move it inside the loop? Yes, I understand that it will be
> > unnecessarily
> > called more times than required, but gpiod_hog() is called anyway in the
> > loop,
> > so I don't think it will be a big deal. With that it will allow to group
> > OF-specific code in one location.
> >
> > > for (unsigned int i = 0; i < num_hogs; i++) {
> > > if (is_of_node(fwnode)) {
> >
> > ...somewhere inside this conditional...
> >
> > > /*
>
> I'm not sure what you want to achieve here (maybe only to have the
> is_of_node-condition once?, as the loop imho is only for enumerating
> multiple gpio (like "gpios = <3 0>, <4 0>;") inside one hog of_node.
The primary goal is stop spreading OF-specific code. If you have noticed the
function was also rewritten (during the move) to be fwnode agnostic, but that
was not feasible by 100%, the leftover is collected inside the mentioned loop.
That's why I really prefer to keep all OF code there.
> Here the node-name will never change (like the line-name above) and read-once
> is correct.
> But while looking at the code i also thought about these multi-gpio-hogs
> (label and output-X). Imho here something like the gpio-controllers
> "line-names" would make sense as well as something similar for the output
> (or just handling this with the GPIO_ACTIVE_HIGH/LOW param).
>
> But if you think the part should be moved into the loop, that's no big deal.
Yes, I think that way.
--
With Best Regards,
Andy Shevchenko
next prev parent reply other threads:[~2026-09-17 13:38 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-17 12:28 [PATCH] gpiolib: use of_node_name if line-name is missing Frank Wunderlich
2026-09-17 13:00 ` Andy Shevchenko
2026-09-17 13:20 ` Frank Wunderlich (linux)
2026-09-17 13:37 ` Andy Shevchenko [this message]
2026-09-17 13:39 ` 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=aqvtMDiqCzsxUDKw@ashevche-desk.local \
--to=andriy.shevchenko@linux.intel.com \
--cc=brgl@kernel.org \
--cc=frank-w@public-files.de \
--cc=frank.wunderlich@linux.dev \
--cc=linusw@kernel.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@fw-web.de \
--cc=mika.westerberg@linux.intel.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