]> git.proxmox.com Git - mirror_ubuntu-focal-kernel.git/commitdiff
gpiolib: Introduce GPIO_LOOKUP_FLAGS_DEFAULT
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Wed, 10 Apr 2019 15:39:17 +0000 (18:39 +0300)
committerLinus Walleij <linus.walleij@linaro.org>
Tue, 23 Apr 2019 08:55:10 +0000 (10:55 +0200)
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>
drivers/gpio/gpiolib-acpi.c
drivers/gpio/gpiolib-of.c
drivers/gpio/gpiolib.c
include/linux/gpio/machine.h

index 962bdd89cd8f7040ec4ed27759c160eaa84f0a8d..6ee929d90a6afeaadf09b3e4de134f4ab966c161 100644 (file)
@@ -819,6 +819,7 @@ int acpi_dev_gpio_irq_get(struct acpi_device *adev, int index)
                        return PTR_ERR(desc);
 
                if (info.gpioint && idx++ == index) {
+                       unsigned long lflags = GPIO_LOOKUP_FLAGS_DEFAULT;
                        char label[32];
                        int irq;
 
@@ -830,7 +831,7 @@ int acpi_dev_gpio_irq_get(struct acpi_device *adev, int index)
                                return irq;
 
                        snprintf(label, sizeof(label), "GpioInt() %d", index);
-                       ret = gpiod_configure_flags(desc, label, 0, info.flags);
+                       ret = gpiod_configure_flags(desc, label, lflags, info.flags);
                        if (ret < 0)
                                return ret;
 
@@ -1007,7 +1008,7 @@ acpi_gpiochip_parse_own_gpio(struct acpi_gpio_chip *achip,
        u32 gpios[2];
        int ret;
 
-       *lflags = 0;
+       *lflags = GPIO_LOOKUP_FLAGS_DEFAULT;
        *dflags = 0;
        *name = NULL;
 
index c5547df4f6cdb874e01f53a95b8d33a519301da8..aec7bd86ae7eaab69d4849f2c862301b7d3d7eb8 100644 (file)
@@ -386,7 +386,7 @@ static struct gpio_desc *of_parse_own_gpio(struct device_node *np,
                return ERR_PTR(-EINVAL);
 
        xlate_flags = 0;
-       *lflags = 0;
+       *lflags = GPIO_LOOKUP_FLAGS_DEFAULT;
        *dflags = 0;
 
        ret = of_property_read_u32(chip_np, "#gpio-cells", &tmp);
index e9909c07517b2de64e4705247cd34fb71245cd38..b8e4c9cd7b9ec1b663836eacbd30372cc9821cfe 100644 (file)
@@ -2515,6 +2515,7 @@ struct gpio_desc *gpiochip_request_own_desc(struct gpio_chip *chip, u16 hwnum,
                                            const char *label,
                                            enum gpiod_flags flags)
 {
+       unsigned long lflags = GPIO_LOOKUP_FLAGS_DEFAULT;
        struct gpio_desc *desc = gpiochip_get_desc(chip, hwnum);
        int err;
 
@@ -2527,7 +2528,7 @@ struct gpio_desc *gpiochip_request_own_desc(struct gpio_chip *chip, u16 hwnum,
        if (err < 0)
                return ERR_PTR(err);
 
-       err = gpiod_configure_flags(desc, label, 0, flags);
+       err = gpiod_configure_flags(desc, label, lflags, flags);
        if (err) {
                chip_err(chip, "setup of own GPIO %s failed\n", label);
                gpiod_free_commit(desc);
@@ -4162,7 +4163,7 @@ struct gpio_desc *__must_check gpiod_get_index(struct device *dev,
                                               unsigned int idx,
                                               enum gpiod_flags flags)
 {
-       unsigned long lookupflags = 0;
+       unsigned long lookupflags = GPIO_LOOKUP_FLAGS_DEFAULT;
        struct gpio_desc *desc = NULL;
        int status;
        /* Maybe we have a device name, maybe not */
@@ -4249,8 +4250,8 @@ struct gpio_desc *gpiod_get_from_of_node(struct device_node *node,
                                         enum gpiod_flags dflags,
                                         const char *label)
 {
+       unsigned long lflags = GPIO_LOOKUP_FLAGS_DEFAULT;
        struct gpio_desc *desc;
-       unsigned long lflags = 0;
        enum of_gpio_flags flags;
        bool active_low = false;
        bool single_ended = false;
@@ -4328,8 +4329,8 @@ struct gpio_desc *fwnode_get_named_gpiod(struct fwnode_handle *fwnode,
                                         enum gpiod_flags dflags,
                                         const char *label)
 {
+       unsigned long lflags = GPIO_LOOKUP_FLAGS_DEFAULT;
        struct gpio_desc *desc = ERR_PTR(-ENODEV);
-       unsigned long lflags = 0;
        int ret;
 
        if (!fwnode)
index dad3921585509cebdcb1ef2f118d62054d5ee556..35f299d1f6a794d0898f276836a345c88a7c14a5 100644 (file)
@@ -14,6 +14,8 @@ enum gpio_lookup_flags {
        GPIO_TRANSITORY                 = (1 << 3),
        GPIO_PULL_UP                    = (1 << 4),
        GPIO_PULL_DOWN                  = (1 << 5),
+
+       GPIO_LOOKUP_FLAGS_DEFAULT       = GPIO_ACTIVE_HIGH | GPIO_PERSISTENT,
 };
 
 /**