gpiolib: Add GPIOCHIP_NAME definition
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@glider.be> Link: https://lore.kernel.org/r/20191127084253.16356-2-geert+renesas@glider.be Reviewed-by: Ulrich Hecht <uli+renesas@fpond.eu> Reviewed-by: Eugeniu Rosca <erosca@de.adit-jv.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
This commit is contained in:
parent
e42617b825
commit
ddd8891e01
@ -762,10 +762,9 @@ int gpiochip_sysfs_register(struct gpio_device *gdev)
|
|||||||
parent = &gdev->dev;
|
parent = &gdev->dev;
|
||||||
|
|
||||||
/* use chip->base for the ID; it's already known to be unique */
|
/* use chip->base for the ID; it's already known to be unique */
|
||||||
dev = device_create_with_groups(&gpio_class, parent,
|
dev = device_create_with_groups(&gpio_class, parent, MKDEV(0, 0), chip,
|
||||||
MKDEV(0, 0),
|
gpiochip_groups, GPIOCHIP_NAME "%d",
|
||||||
chip, gpiochip_groups,
|
chip->base);
|
||||||
"gpiochip%d", chip->base);
|
|
||||||
if (IS_ERR(dev))
|
if (IS_ERR(dev))
|
||||||
return PTR_ERR(dev);
|
return PTR_ERR(dev);
|
||||||
|
|
||||||
|
@ -1419,7 +1419,7 @@ int gpiochip_add_data_with_key(struct gpio_chip *chip, void *data,
|
|||||||
ret = gdev->id;
|
ret = gdev->id;
|
||||||
goto err_free_gdev;
|
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);
|
device_initialize(&gdev->dev);
|
||||||
dev_set_drvdata(&gdev->dev, gdev);
|
dev_set_drvdata(&gdev->dev, gdev);
|
||||||
if (chip->parent && chip->parent->driver)
|
if (chip->parent && chip->parent->driver)
|
||||||
@ -5104,7 +5104,7 @@ static int __init gpiolib_dev_init(void)
|
|||||||
return ret;
|
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) {
|
if (ret < 0) {
|
||||||
pr_err("gpiolib: failed to allocate char dev region\n");
|
pr_err("gpiolib: failed to allocate char dev region\n");
|
||||||
bus_unregister(&gpio_bus_type);
|
bus_unregister(&gpio_bus_type);
|
||||||
|
@ -16,6 +16,8 @@
|
|||||||
#include <linux/module.h>
|
#include <linux/module.h>
|
||||||
#include <linux/cdev.h>
|
#include <linux/cdev.h>
|
||||||
|
|
||||||
|
#define GPIOCHIP_NAME "gpiochip"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* struct gpio_device - internal state container for GPIO devices
|
* struct gpio_device - internal state container for GPIO devices
|
||||||
* @id: numerical ID number for the GPIO chip
|
* @id: numerical ID number for the GPIO chip
|
||||||
|
Loading…
Reference in New Issue
Block a user