Re: [PATCH v3 1/7] gpiolib: Add GPIOCHIP_NAME definition

From: Eugeniu Rosca
Date: Mon Dec 02 2019 - 16:17:52 EST


Hi Geert,

On Wed, Nov 27, 2019 at 09:42:47AM +0100, Geert Uytterhoeven wrote:
> The string literal "gpiochip" is used in several places.
> Add a definition for it, and use it everywhere, to make sure everything
> stays in sync.
>
> Signed-off-by: Geert Uytterhoeven <geert+renesas@xxxxxxxxx>
> ---
> v3:
> - New.
> ---
> drivers/gpio/gpiolib-sysfs.c | 7 +++----
> drivers/gpio/gpiolib.c | 4 ++--
> drivers/gpio/gpiolib.h | 2 ++
> 3 files changed, 7 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/gpio/gpiolib.h b/drivers/gpio/gpiolib.h
> index ca9bc1e4803c2979..a4a759920faa48ab 100644
> --- a/drivers/gpio/gpiolib.h
> +++ b/drivers/gpio/gpiolib.h
> @@ -16,6 +16,8 @@
> #include <linux/module.h>
> #include <linux/cdev.h>
>
> +#define GPIOCHIP_NAME "gpiochip"

[.02$/nit] I wonder if GPIOCHIP_NAME is actually an essential
part of kernel-user contract [1-2], in which case it could
probably be moved to include/uapi/linux/gpio.h ?

Regardless:
Reviewed-by: Eugeniu Rosca <erosca@xxxxxxxxxxxxxx>

[1] linux (v5.4) git grep '"gpiochip' -- tools/
tools/gpio/lsgpio.c: if (check_prefix(ent->d_name, "gpiochip")) {
tools/testing/selftests/gpio/gpio-mockup-chardev.c: if (check_prefix(ent->d_name, "gpiochip")) {

[2] libgpiod (v1.4-76-g00418dfdfc8b) git grep '"gpiochip'
lib/iter.c: return !strncmp(dir->d_name, "gpiochip", 8);
tests/mockup/gpio-mockup.c: rv = sscanf(sysname, "gpiochip%u", &chip->num);
tools/gpioget.c: die("gpiochip must be specified");
tools/gpiomon.c: die("gpiochip must be specified");
tools/gpioset.c: die("gpiochip must be specified");

--
Best Regards,
Eugeniu