[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1936168849.1467696.1574912319589@webmail.strato.com>
Date: Thu, 28 Nov 2019 04:38:39 +0100 (CET)
From: Ulrich Hecht <uli@...nd.eu>
To: Geert Uytterhoeven <geert+renesas@...der.be>,
Linus Walleij <linus.walleij@...aro.org>,
Bartosz Golaszewski <bgolaszewski@...libre.com>,
Jonathan Corbet <corbet@....net>,
Rob Herring <robh+dt@...nel.org>,
Mark Rutland <mark.rutland@....com>,
Harish Jenny K N <harish_kandiga@...tor.com>,
Eugeniu Rosca <erosca@...adit-jv.com>
Cc: Alexander Graf <graf@...zon.com>,
Peter Maydell <peter.maydell@...aro.org>,
Paolo Bonzini <pbonzini@...hat.com>,
Phil Reid <preid@...ctromag.com.au>,
Marc Zyngier <marc.zyngier@....com>,
Christoffer Dall <christoffer.dall@....com>,
Magnus Damm <magnus.damm@...il.com>,
linux-gpio@...r.kernel.org, linux-doc@...r.kernel.org,
devicetree@...r.kernel.org, linux-renesas-soc@...r.kernel.org,
linux-kernel@...r.kernel.org, qemu-devel@...gnu.org
Subject: Re: [PATCH v3 1/7] gpiolib: Add GPIOCHIP_NAME definition
> On November 27, 2019 at 9:42 AM Geert Uytterhoeven <geert+renesas@...der.be> 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@...der.be>
> ---
> 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-sysfs.c b/drivers/gpio/gpiolib-sysfs.c
> index fbf6b1a0a4fae6ce..23e3d335cd543d53 100644
> --- a/drivers/gpio/gpiolib-sysfs.c
> +++ b/drivers/gpio/gpiolib-sysfs.c
> @@ -762,10 +762,9 @@ int gpiochip_sysfs_register(struct gpio_device *gdev)
> parent = &gdev->dev;
>
> /* use chip->base for the ID; it's already known to be unique */
> - dev = device_create_with_groups(&gpio_class, parent,
> - MKDEV(0, 0),
> - chip, gpiochip_groups,
> - "gpiochip%d", chip->base);
> + dev = device_create_with_groups(&gpio_class, parent, MKDEV(0, 0), chip,
> + gpiochip_groups, GPIOCHIP_NAME "%d",
> + chip->base);
> if (IS_ERR(dev))
> return PTR_ERR(dev);
>
> diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
> index dce0b31f4125a6b3..c9e47620d2434983 100644
> --- a/drivers/gpio/gpiolib.c
> +++ b/drivers/gpio/gpiolib.c
> @@ -1419,7 +1419,7 @@ int gpiochip_add_data_with_key(struct gpio_chip *chip, void *data,
> ret = gdev->id;
> goto err_free_gdev;
> }
> - dev_set_name(&gdev->dev, "gpiochip%d", gdev->id);
> + dev_set_name(&gdev->dev, GPIOCHIP_NAME "%d", gdev->id);
> device_initialize(&gdev->dev);
> dev_set_drvdata(&gdev->dev, gdev);
> if (chip->parent && chip->parent->driver)
> @@ -5105,7 +5105,7 @@ static int __init gpiolib_dev_init(void)
> return ret;
> }
>
> - ret = alloc_chrdev_region(&gpio_devt, 0, GPIO_DEV_MAX, "gpiochip");
> + ret = alloc_chrdev_region(&gpio_devt, 0, GPIO_DEV_MAX, GPIOCHIP_NAME);
> if (ret < 0) {
> pr_err("gpiolib: failed to allocate char dev region\n");
> bus_unregister(&gpio_bus_type);
> 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"
> +
> /**
> * struct gpio_device - internal state container for GPIO devices
> * @id: numerical ID number for the GPIO chip
> --
> 2.17.1
>
Reviewed-by: Ulrich Hecht <uli+renesas@...nd.eu>
CU
Uli
Powered by blists - more mailing lists