Linux driver-core infrastructure
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Bartosz Golaszewski <brgl@kernel.org>
Cc: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>,
	Daniel Scally <djrscally@gmail.com>,
	Heikki Krogerus <heikki.krogerus@linux.intel.com>,
	Sakari Ailus <sakari.ailus@linux.intel.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	"Rafael J. Wysocki" <rafael@kernel.org>,
	Danilo Krummrich <dakr@kernel.org>,
	Johan Hovold <johan@kernel.org>,
	Hans Verkuil <hverkuil@kernel.org>,
	Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
	Kees Cook <kees@kernel.org>, Andy Shevchenko <andy@kernel.org>,
	Len Brown <lenb@kernel.org>, Rob Herring <robh@kernel.org>,
	Saravana Kannan <saravanak@kernel.org>,
	Linus Walleij <linusw@kernel.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	"Gustavo A. R. Silva" <gustavoars@kernel.org>,
	linux-acpi@vger.kernel.org, driver-core@lists.linux.dev,
	linux-kernel@vger.kernel.org, linux-hardening@vger.kernel.org,
	devicetree@vger.kernel.org, linux-gpio@vger.kernel.org
Subject: Re: [PATCH v2 10/10] gpio: shared: generalize most code to firmware nodes
Date: Tue, 17 Nov 2026 16:05:31 +0200	[thread overview]
Message-ID: <avxfK3z6bvWmiWoq@ashevche-desk.local> (raw)
In-Reply-To: <ofjnhfxx32khew77khya2whrfg336qvfsxwq25gz2psckhducv@cnfhpk2uobg4>

On Tue, Nov 17, 2026 at 11:46:35AM +0100, Bartosz Golaszewski wrote:
> On Tue, Nov 17, 2026 at 12:23:38PM +0200, Andy Shevchenko wrote:
> > On Tue, Nov 17, 2026 at 10:50:38AM +0100, Bartosz Golaszewski wrote:
> > > On Fri, Nov 13, 2026 at 06:19:15PM +0200, Andy Shevchenko wrote:
> > > > On Fri, Nov 13, 2026 at 04:47:10PM +0100, Bartosz Golaszewski wrote:

...

> > > > > -static int gpio_shared_of_scan(void)
> > > > > +static __maybe_unused int gpio_shared_fwnode_traverse(struct fwnode_handle *curr)
> > > > >  {
> > > > > -	if (of_root)
> > > > > -		return gpio_shared_of_traverse(of_root);
> > > > > +	int ret;
> > > > > +
> > > > > +	if (gpio_shared_fwnode_ignore(curr))
> > > > > +		return 0;
> > > > > +
> > > > > +	ret = gpio_shared_fwnode_scan_properties(curr);
> > > > > +	if (ret)
> > > > > +		return ret;
> > > > > +
> > > > > +	fwnode_for_each_child_node_scoped(curr, child) {
> > > > > +		ret = gpio_shared_fwnode_traverse(child);
> > > > > +		if (ret)
> > > > > +			return ret;
> > > > > +	}
> > > > >  
> > > > >  	return 0;
> > > > >  }
> > > > > -#else
> > > > > +
> > > > >  static int gpio_shared_of_scan(void)
> > > > >  {
> > > > > +#if IS_ENABLED(CONFIG_OF)
> > > > > +	if (of_root)
> > > > > +		return gpio_shared_fwnode_traverse(of_fwnode_handle(of_root));
> > > > > +#endif
> > > > > +
> > > > >  	return 0;
> > > > >  }
> > > > > -#endif /* CONFIG_OF */
> > > > 
> > > > Hmm... What do you exactly get from the compiler without this uglyfication?
> > > 
> > > The alternative is an empty stub for gpio_shared_of_scan() and keeping
> > > CONFIG_OF around most of the code in that file. I think it looks better
> > > this way.
> > 
> > My question basically was what will go wrong if you drop that #if completely?
> 
> Kernel will not link with !CONFIG_OF as of_root is defined and exported in
> drivers/of/base.c.

Wouldn't

	if (IS_ENABLED(CONFIG_OF) && of_root)

be sufficient instead of ugly #if?

-- 
With Best Regards,
Andy Shevchenko



      reply	other threads:[~2026-11-17 14:05 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-13 15:47 [PATCH v2 00/10] gpio: make gpiolib-shared more fwnode-centric Bartosz Golaszewski
2026-11-13 15:47 ` [PATCH v2 01/10] lib: string_helpers: export and rename struct strarray Bartosz Golaszewski
2026-11-13 16:09   ` Andy Shevchenko
2026-11-13 15:47 ` [PATCH v2 02/10] lib: string_helpers: implement a CLASS() for string arrays Bartosz Golaszewski
2026-11-13 16:09   ` Andy Shevchenko
2026-11-13 15:47 ` [PATCH v2 03/10] fwnode: define the property_get_names() operation Bartosz Golaszewski
2026-11-13 15:47 ` [PATCH v2 04/10] device property: provide fwnode_property_get_names() Bartosz Golaszewski
2026-11-13 16:13   ` Andy Shevchenko
2026-11-17  9:47     ` Bartosz Golaszewski
2026-11-13 15:47 ` [PATCH v2 05/10] of: property: implement the .property_get_names() fwnode operation Bartosz Golaszewski
2026-11-13 15:47 ` [PATCH v2 06/10] fwnode: define the count_references() " Bartosz Golaszewski
2026-11-13 15:47 ` [PATCH v2 07/10] device property: provide fwnode_property_count_references() Bartosz Golaszewski
2026-11-13 16:13   ` Andy Shevchenko
2026-11-13 15:47 ` [PATCH v2 08/10] of: property: implement the count_references() fwnode operation Bartosz Golaszewski
2026-11-13 15:47 ` [PATCH v2 09/10] gpio: shared: removed unused field from struct gpio_shared_entry Bartosz Golaszewski
2026-11-13 16:14   ` Andy Shevchenko
2026-11-13 15:47 ` [PATCH v2 10/10] gpio: shared: generalize most code to firmware nodes Bartosz Golaszewski
2026-11-13 16:19   ` Andy Shevchenko
2026-11-17  9:50     ` Bartosz Golaszewski
2026-11-17 10:23       ` Andy Shevchenko
2026-11-17 10:46         ` Bartosz Golaszewski
2026-11-17 14:05           ` Andy Shevchenko [this message]

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=avxfK3z6bvWmiWoq@ashevche-desk.local \
    --to=andriy.shevchenko@linux.intel.com \
    --cc=akpm@linux-foundation.org \
    --cc=andy@kernel.org \
    --cc=bartosz.golaszewski@oss.qualcomm.com \
    --cc=brgl@kernel.org \
    --cc=dakr@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=djrscally@gmail.com \
    --cc=driver-core@lists.linux.dev \
    --cc=gregkh@linuxfoundation.org \
    --cc=gustavoars@kernel.org \
    --cc=heikki.krogerus@linux.intel.com \
    --cc=hverkuil@kernel.org \
    --cc=johan@kernel.org \
    --cc=kees@kernel.org \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=lenb@kernel.org \
    --cc=linusw@kernel.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-hardening@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rafael@kernel.org \
    --cc=robh@kernel.org \
    --cc=sakari.ailus@linux.intel.com \
    --cc=saravanak@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