Re: [PATCH] platform/x86: barco-p50-gpio: use software nodes for gpio-leds/keys

Hans de Goede
2025-08-11T14:20:37Z

Hi Andy, Dmitry,

On 11-Aug-25 2:44 PM, Andy Shevchenko wrote:
> On Sun, Aug 10, 2025 at 09:31:37PM -0700, Dmitry Torokhov wrote:
>> In preparation of dropping support for legacy GPIO API from gpio-keys
>> switch the driver to use software nodes/properties to describe
>> GPIO-connected LED and button.
>
> ...
>
>> #include <linux/delay.h>
>> +#include <linux/dev_printk.h>
>> #include <linux/dmi.h>
>> #include <linux/err.h>
>> #include <linux/io.h>
>
>> #include <linux/leds.h>
>> #include <linux/module.h>
>> #include <linux/platform_device.h>
>> -#include <linux/gpio_keys.h>
>> #include <linux/gpio/driver.h>
>> #include <linux/gpio/machine.h>
>> -#include <linux/input.h>
>
>> +#include <linux/gpio/property.h>
>> +#include <linux/input-event-codes.h>
>> +#include <linux/property.h>
>
> The idea of sorting here is to have more generic first and then more specific
> (per subsystem in use) groups of headers. So with your change it should look
> like
>
> #include <linux/delay.h>
> #include <linux/dev_printk.h>
> #include <linux/dmi.h>
> #include <linux/err.h>
> #include <linux/io.h>
> ...
> #include <linux/leds.h>
> #include <linux/module.h>
> #include <linux/platform_device.h>
> #include <linux/property.h>
>
> #include <linux/gpio/driver.h>
> #include <linux/gpio/machine.h>
> #include <linux/gpio/property.h>
>
> #include <linux/input-event-codes.h>
>
> (I also added blank lines to make it more explicit)
>
> ...
>
> Otherwise LGTM as here it looks like we establish platform device ourselves and
> hence no need some additional magic Hans mentioned in the other series.

Not entirely like with the x86-android-tablets patches this
declares a software-node for the gpiochip:

static const struct software_node gpiochip_node = {
.name = DRIVER_NAME,
};

and registers that node, but nowhere does it actually
get assigned to the gpiochip.

This is going to need a line like this added to probe():

p50->gc.fwnode = software_node_fwnode(&gpiochip_node);

note the software_node_fwnode() call MUST be made after
registering the software-nodes (group).

Other then needing this single line things are indeed
much easier when the code containing the software
properties / nodes is the same code as which is
registering the gpiochip.

Regards,

Hans