Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

gpiolib: Introduce GPIO_LOOKUP_FLAGS_DEFAULT

Since GPIO library operates with enumerator when it's subject to handle
the GPIO lookup flags, it will be better to clearly see what default means.

Thus, introduce GPIO_LOOKUP_FLAGS_DEFAULT entry to describe
the default assumptions.

While here, replace 0 by newly introduced constant.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>

authored by

Andy Shevchenko and committed by
Linus Walleij
2d6c06f5 fed7026a

+11 -7
+3 -2
drivers/gpio/gpiolib-acpi.c
··· 819 819 return PTR_ERR(desc); 820 820 821 821 if (info.gpioint && idx++ == index) { 822 + unsigned long lflags = GPIO_LOOKUP_FLAGS_DEFAULT; 822 823 char label[32]; 823 824 int irq; 824 825 ··· 831 830 return irq; 832 831 833 832 snprintf(label, sizeof(label), "GpioInt() %d", index); 834 - ret = gpiod_configure_flags(desc, label, 0, info.flags); 833 + ret = gpiod_configure_flags(desc, label, lflags, info.flags); 835 834 if (ret < 0) 836 835 return ret; 837 836 ··· 1008 1007 u32 gpios[2]; 1009 1008 int ret; 1010 1009 1011 - *lflags = 0; 1010 + *lflags = GPIO_LOOKUP_FLAGS_DEFAULT; 1012 1011 *dflags = 0; 1013 1012 *name = NULL; 1014 1013
+1 -1
drivers/gpio/gpiolib-of.c
··· 386 386 return ERR_PTR(-EINVAL); 387 387 388 388 xlate_flags = 0; 389 - *lflags = 0; 389 + *lflags = GPIO_LOOKUP_FLAGS_DEFAULT; 390 390 *dflags = 0; 391 391 392 392 ret = of_property_read_u32(chip_np, "#gpio-cells", &tmp);
+5 -4
drivers/gpio/gpiolib.c
··· 2515 2515 const char *label, 2516 2516 enum gpiod_flags flags) 2517 2517 { 2518 + unsigned long lflags = GPIO_LOOKUP_FLAGS_DEFAULT; 2518 2519 struct gpio_desc *desc = gpiochip_get_desc(chip, hwnum); 2519 2520 int err; 2520 2521 ··· 2528 2527 if (err < 0) 2529 2528 return ERR_PTR(err); 2530 2529 2531 - err = gpiod_configure_flags(desc, label, 0, flags); 2530 + err = gpiod_configure_flags(desc, label, lflags, flags); 2532 2531 if (err) { 2533 2532 chip_err(chip, "setup of own GPIO %s failed\n", label); 2534 2533 gpiod_free_commit(desc); ··· 4163 4162 unsigned int idx, 4164 4163 enum gpiod_flags flags) 4165 4164 { 4166 - unsigned long lookupflags = 0; 4165 + unsigned long lookupflags = GPIO_LOOKUP_FLAGS_DEFAULT; 4167 4166 struct gpio_desc *desc = NULL; 4168 4167 int status; 4169 4168 /* Maybe we have a device name, maybe not */ ··· 4250 4249 enum gpiod_flags dflags, 4251 4250 const char *label) 4252 4251 { 4252 + unsigned long lflags = GPIO_LOOKUP_FLAGS_DEFAULT; 4253 4253 struct gpio_desc *desc; 4254 - unsigned long lflags = 0; 4255 4254 enum of_gpio_flags flags; 4256 4255 bool active_low = false; 4257 4256 bool single_ended = false; ··· 4329 4328 enum gpiod_flags dflags, 4330 4329 const char *label) 4331 4330 { 4331 + unsigned long lflags = GPIO_LOOKUP_FLAGS_DEFAULT; 4332 4332 struct gpio_desc *desc = ERR_PTR(-ENODEV); 4333 - unsigned long lflags = 0; 4334 4333 int ret; 4335 4334 4336 4335 if (!fwnode)
+2
include/linux/gpio/machine.h
··· 14 14 GPIO_TRANSITORY = (1 << 3), 15 15 GPIO_PULL_UP = (1 << 4), 16 16 GPIO_PULL_DOWN = (1 << 5), 17 + 18 + GPIO_LOOKUP_FLAGS_DEFAULT = GPIO_ACTIVE_HIGH | GPIO_PERSISTENT, 17 19 }; 18 20 19 21 /**