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: <CAMRc=MctEsMiRgaV5UTiaxjoFDa2izX9wnLAU07=G8gBEcSKoQ@mail.gmail.com>
Date: Sun, 19 May 2024 19:27:51 +0200
From: Bartosz Golaszewski <brgl@...ev.pl>
To: egyszeregy@...email.hu
Cc: linus.walleij@...aro.org, linux-gpio@...r.kernel.org, 
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH] gpiolib: Introduce "linux,gpiochip-name" property for
 device tree of GPIO controller.

On Sun, May 19, 2024 at 4:49 PM <egyszeregy@...email.hu> wrote:
>
> From: Benjamin Szőke <egyszeregy@...email.hu>
>
> Optionally, a GPIO controller may have a "linux,gpiochip-name" property.

Oh, may it really?

$ git grep "linux,gpiochip-name" Documentation/devicetree/bindings/
$

Doesn't look like it.

> This is a string which is defining a custom suffix name for gpiochip in
> /dev/gpiochip-<name> format. It helps to improve software portability
> between various SoCs and reduce complexities of hardware related codes
> in SWs.
>
> Signed-off-by: Benjamin Szőke <egyszeregy@...email.hu>
> ---
>  drivers/gpio/gpiolib.c | 12 +++++++++++-
>  1 file changed, 11 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
> index ce94e37bcbee..e24d8db1d054 100644
> --- a/drivers/gpio/gpiolib.c
> +++ b/drivers/gpio/gpiolib.c
> @@ -860,6 +860,7 @@ int gpiochip_add_data_with_key(struct gpio_chip *gc, void *data,
>                                struct lock_class_key *lock_key,
>                                struct lock_class_key *request_key)
>  {
> +       const char *name;
>         struct gpio_device *gdev;
>         unsigned int desc_index;
>         int base = 0;
> @@ -896,7 +897,16 @@ int gpiochip_add_data_with_key(struct gpio_chip *gc, void *data,
>                 goto err_free_gdev;
>         }
>
> -       ret = dev_set_name(&gdev->dev, GPIOCHIP_NAME "%d", gdev->id);
> +       /*
> +        * If "linux,gpiochip-name" is specified in device tree, use /dev/gpiochip-<name>
> +        * in Linux userspace, otherwise use /dev/gpiochip<id>.
> +        */
> +       ret = device_property_read_string(gc->parent, "linux,gpiochip-name", &name);
> +       if (ret < 0)
> +               ret = dev_set_name(&gdev->dev, GPIOCHIP_NAME "%d", gdev->id);
> +       else
> +               ret = dev_set_name(&gdev->dev, GPIOCHIP_NAME "-%s", name);
> +
>         if (ret)
>                 goto err_free_ida;
>
> --
> 2.39.3
>

NAK, this is udev's task in user-space if you need this.

Bart

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ