lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Yapp4vakFxH7JV5B@smile.fi.intel.com>
Date:   Fri, 3 Dec 2021 21:02:58 +0200
From:   Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
To:     Bartosz Golaszewski <brgl@...ev.pl>
Cc:     Kent Gibson <warthog618@...il.com>,
        Linus Walleij <linus.walleij@...aro.org>,
        Shuah Khan <shuah@...nel.org>,
        Geert Uytterhoeven <geert@...ux-m68k.org>,
        Viresh Kumar <viresh.kumar@...aro.org>,
        linux-gpio@...r.kernel.org, linux-kernel@...r.kernel.org,
        linux-kselftest@...r.kernel.org
Subject: Re: [PATCH v12 3/7] gpiolib: of: make fwnode take precedence in
 struct gpio_chip

On Fri, Dec 03, 2021 at 08:56:27PM +0200, Andy Shevchenko wrote:
> On Fri, Dec 03, 2021 at 08:51:56PM +0200, Andy Shevchenko wrote:
> > On Fri, Dec 03, 2021 at 02:29:59PM +0100, Bartosz Golaszewski wrote:
> 
> ...
> 
> > >  	if (gc->parent)
> > >  		gdev->dev.of_node = gc->parent->of_node;
> > >  
> > > +	if (gc->fwnode)
> > > +		gc->of_node = to_of_node(gc->fwnode);
> > > +
> > >  	/* If the gpiochip has an assigned OF node this takes precedence */
> > >  	if (gc->of_node)
> > >  		gdev->dev.of_node = gc->of_node;
> > 
> > Similar should be done in acpi_gpio_dev_init():
> > 
> > 	if (gc->fwnode)
> > 		device_set_node(&gdev->dev, gc->fwnode);
> 
> Hmm... On the second though this should be rather
> 
> 	if (gc->fwnode)
> 		set_secondary_fwnode(&gdev->dev, gc->fwnode);
> 
> So the logic will be that:
>  - if we have parent, set primary fwnode to it
>  - if we have fwnode, set secondary one to it
>  - otherwise do nothing

Heck, it's Friday...

If we have parent device for several GPIO devices, this won't work right now
due to limitations of fwnode regarding to the sturct device.

So, it means we may not have shared primary with different secondary fwnodes.

So, come back to the initial suggestion (overwrite it for now):

	/*
	 * If custom fwnode provided, use it. Currently we may not
	 * handle the case where shared primary node has different
	 * secondary ones. Ideally we have to use
	 * set_secondary_fwnode() here.
	 */
	if (gc->fwnode)
		device_set_node(&gdev->dev, gc->fwnode);

-- 
With Best Regards,
Andy Shevchenko


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ