The library uses enum gpio_lookup_flags to define the possible characteristics of GPIO pin. Since enumerator listed only individual bits the common use of it is in a form of a bitmask of gpio_lookup_flags GPIO_* values. The more correct type for this is unsigned long. Due to above convert all users to use unsigned long instead of enum gpio_lookup_flags except enumerator definition. While here, make field and parameter descriptions consistent as well.
Unified · Split
| @@ -696,7 +696,7 @@ struct gpio_desc *acpi_find_gpio(struct device *dev, · 695 unmodified lines | ||
| 696 | 696 | const char *con_id, |
| 697 | 697 | unsigned int idx, |
| 698 | 698 | enum gpiod_flags *dflags, |
| 699 | − enum gpio_lookup_flags *lookupflags) | |
| 699 | + unsigned long *lookupflags) | |
| 700 | 700 | { |
| 701 | 701 | struct acpi_device *adev = ACPI_COMPANION(dev); |
| 702 | 702 | struct acpi_gpio_info info; |
| @@ -995,9 +995,12 @@ static void acpi_gpiochip_free_regions(struct acpi_gpio_chip *achip) · 292 unmodified lines | ||
| 995 | 995 | } |
| 996 | 996 | } |
| 997 | 997 | |
| 998 | −static struct gpio_desc *acpi_gpiochip_parse_own_gpio( | |
| 999 | − struct acpi_gpio_chip *achip, struct fwnode_handle *fwnode, | |
| 1000 | − const char **name, unsigned int *lflags, unsigned int *dflags) | |
| 998 | +static struct gpio_desc * | |
| 999 | +acpi_gpiochip_parse_own_gpio(struct acpi_gpio_chip *achip, | |
| 1000 | + struct fwnode_handle *fwnode, | |
| 1001 | + const char **name, | |
| 1002 | + unsigned long *lflags, | |
| 1003 | + unsigned int *dflags) | |
| 1001 | 1004 | { |
| 1002 | 1005 | struct gpio_chip *chip = achip->chip; |
| 1003 | 1006 | struct gpio_desc *desc; |
| @@ -1040,7 +1043,8 @@ static void acpi_gpiochip_scan_gpios(struct acpi_gpio_chip *achip) · 36 unmodified lines | ||
| 1040 | 1043 | struct fwnode_handle *fwnode; |
| 1041 | 1044 | |
| 1042 | 1045 | device_for_each_child_node(chip->parent, fwnode) { |
| 1043 | − unsigned int lflags, dflags; | |
| 1046 | + unsigned long lflags; | |
| 1047 | + unsigned int dflags; | |
| 1044 | 1048 | struct gpio_desc *desc; |
| 1045 | 1049 | const char *name; |
| 1046 | 1050 | int ret; |
| @@ -287,8 +287,7 @@ static struct gpio_desc *of_find_regulator_gpio(struct device *dev, const char * · 286 unmodified lines | ||
| 287 | 287 | } |
| 288 | 288 | |
| 289 | 289 | struct gpio_desc *of_find_gpio(struct device *dev, const char *con_id, |
| 290 | − unsigned int idx, | |
| 291 | − enum gpio_lookup_flags *flags) | |
| 290 | + unsigned int idx, unsigned long *flags) | |
| 292 | 291 | { |
| 293 | 292 | char prop_name[32]; /* 32 is max size of property name */ |
| 294 | 293 | enum of_gpio_flags of_flags; |
| @@ -361,8 +360,8 @@ struct gpio_desc *of_find_gpio(struct device *dev, const char *con_id, · 66 unmodified lines | ||
| 361 | 360 | * @chip: GPIO chip whose hog is parsed |
| 362 | 361 | * @idx: Index of the GPIO to parse |
| 363 | 362 | * @name: GPIO line name |
| 364 | − * @lflags: gpio_lookup_flags - returned from of_find_gpio() or | |
| 365 | − * of_parse_own_gpio() | |
| 363 | + * @lflags: bitmask of gpio_lookup_flags GPIO_* values - returned from | |
| 364 | + * of_find_gpio() or of_parse_own_gpio() | |
| 366 | 365 | * @dflags: gpiod_flags - optional GPIO initialization flags |
| 367 | 366 | * |
| 368 | 367 | * Returns GPIO descriptor to use with Linux GPIO API, or one of the errno |
| @@ -371,7 +370,7 @@ struct gpio_desc *of_find_gpio(struct device *dev, const char *con_id, · 2 unmodified lines | ||
| 371 | 370 | static struct gpio_desc *of_parse_own_gpio(struct device_node *np, |
| 372 | 371 | struct gpio_chip *chip, |
| 373 | 372 | unsigned int idx, const char **name, |
| 374 | − enum gpio_lookup_flags *lflags, | |
| 373 | + unsigned long *lflags, | |
| 375 | 374 | enum gpiod_flags *dflags) |
| 376 | 375 | { |
| 377 | 376 | struct device_node *chip_np; |
| @@ -444,7 +443,7 @@ static int of_gpiochip_scan_gpios(struct gpio_chip *chip) · 66 unmodified lines | ||
| 444 | 443 | struct gpio_desc *desc = NULL; |
| 445 | 444 | struct device_node *np; |
| 446 | 445 | const char *name; |
| 447 | − enum gpio_lookup_flags lflags; | |
| 446 | + unsigned long lflags; | |
| 448 | 447 | enum gpiod_flags dflags; |
| 449 | 448 | unsigned int i; |
| 450 | 449 | int ret; |
| @@ -3923,8 +3923,7 @@ found: · 3922 unmodified lines | ||
| 3923 | 3923 | } |
| 3924 | 3924 | |
| 3925 | 3925 | static struct gpio_desc *gpiod_find(struct device *dev, const char *con_id, |
| 3926 | − unsigned int idx, | |
| 3927 | − enum gpio_lookup_flags *flags) | |
| 3926 | + unsigned int idx, unsigned long *flags) | |
| 3928 | 3927 | { |
| 3929 | 3928 | struct gpio_desc *desc = ERR_PTR(-ENOENT); |
| 3930 | 3929 | struct gpiod_lookup_table *table; |
| @@ -4080,8 +4079,8 @@ EXPORT_SYMBOL_GPL(gpiod_get_optional); · 149 unmodified lines | ||
| 4080 | 4079 | * gpiod_configure_flags - helper function to configure a given GPIO |
| 4081 | 4080 | * @desc: gpio whose value will be assigned |
| 4082 | 4081 | * @con_id: function within the GPIO consumer |
| 4083 | − * @lflags: gpio_lookup_flags - returned from of_find_gpio() or | |
| 4084 | − * of_get_gpio_hog() | |
| 4082 | + * @lflags: bitmask of gpio_lookup_flags GPIO_* values - returned from | |
| 4083 | + * of_find_gpio() or of_get_gpio_hog() | |
| 4085 | 4084 | * @dflags: gpiod_flags - optional GPIO initialization flags |
| 4086 | 4085 | * |
| 4087 | 4086 | * Return 0 on success, -ENOENT if no GPIO has been assigned to the |
| @@ -4163,9 +4162,9 @@ struct gpio_desc *__must_check gpiod_get_index(struct device *dev, · 75 unmodified lines | ||
| 4163 | 4162 | unsigned int idx, |
| 4164 | 4163 | enum gpiod_flags flags) |
| 4165 | 4164 | { |
| 4165 | + unsigned long lookupflags = 0; | |
| 4166 | 4166 | struct gpio_desc *desc = NULL; |
| 4167 | 4167 | int status; |
| 4168 | − enum gpio_lookup_flags lookupflags = 0; | |
| 4169 | 4168 | /* Maybe we have a device name, maybe not */ |
| 4170 | 4169 | const char *devname = dev ? dev_name(dev) : "?"; |
| 4171 | 4170 | |
| @@ -4403,8 +4402,8 @@ EXPORT_SYMBOL_GPL(gpiod_get_index_optional); · 231 unmodified lines | ||
| 4403 | 4402 | * gpiod_hog - Hog the specified GPIO desc given the provided flags |
| 4404 | 4403 | * @desc: gpio whose value will be assigned |
| 4405 | 4404 | * @name: gpio line name |
| 4406 | − * @lflags: gpio_lookup_flags - returned from of_find_gpio() or | |
| 4407 | − * of_get_gpio_hog() | |
| 4405 | + * @lflags: bitmask of gpio_lookup_flags GPIO_* values - returned from | |
| 4406 | + * of_find_gpio() or of_get_gpio_hog() | |
| 4408 | 4407 | * @dflags: gpiod_flags - optional GPIO initialization flags |
| 4409 | 4408 | */ |
| 4410 | 4409 | int gpiod_hog(struct gpio_desc *desc, const char *name, |
| @@ -17,7 +17,6 @@ · 16 unmodified lines | ||
| 17 | 17 | #include <linux/cdev.h> |
| 18 | 18 | |
| 19 | 19 | enum of_gpio_flags; |
| 20 | −enum gpio_lookup_flags; | |
| 21 | 20 | struct acpi_device; |
| 22 | 21 | |
| 23 | 22 | /** |
| @@ -95,7 +94,7 @@ static __maybe_unused const char * const gpio_suffixes[] = { "gpios", "gpio" }; · 71 unmodified lines | ||
| 95 | 94 | struct gpio_desc *of_find_gpio(struct device *dev, |
| 96 | 95 | const char *con_id, |
| 97 | 96 | unsigned int idx, |
| 98 | − enum gpio_lookup_flags *flags); | |
| 97 | + unsigned long *lookupflags); | |
| 99 | 98 | struct gpio_desc *of_get_named_gpiod_flags(struct device_node *np, |
| 100 | 99 | const char *list_name, int index, enum of_gpio_flags *flags); |
| 101 | 100 | int of_gpiochip_add(struct gpio_chip *gc); |
| @@ -104,7 +103,7 @@ void of_gpiochip_remove(struct gpio_chip *gc); · 2 unmodified lines | ||
| 104 | 103 | static inline struct gpio_desc *of_find_gpio(struct device *dev, |
| 105 | 104 | const char *con_id, |
| 106 | 105 | unsigned int idx, |
| 107 | − enum gpio_lookup_flags *flags) | |
| 106 | + unsigned long *lookupflags) | |
| 108 | 107 | { |
| 109 | 108 | return ERR_PTR(-ENOENT); |
| 110 | 109 | } |
| @@ -131,7 +130,7 @@ struct gpio_desc *acpi_find_gpio(struct device *dev, · 20 unmodified lines | ||
| 131 | 130 | const char *con_id, |
| 132 | 131 | unsigned int idx, |
| 133 | 132 | enum gpiod_flags *dflags, |
| 134 | − enum gpio_lookup_flags *lookupflags); | |
| 133 | + unsigned long *lookupflags); | |
| 135 | 134 | struct gpio_desc *acpi_node_get_gpiod(struct fwnode_handle *fwnode, |
| 136 | 135 | const char *propname, int index, |
| 137 | 136 | struct acpi_gpio_info *info); |
| @@ -158,7 +157,7 @@ acpi_gpio_update_gpiod_flags(enum gpiod_flags *flags, struct acpi_gpio_info *inf · 20 unmodified lines | ||
| 158 | 157 | static inline struct gpio_desc * |
| 159 | 158 | acpi_find_gpio(struct device *dev, const char *con_id, |
| 160 | 159 | unsigned int idx, enum gpiod_flags *dflags, |
| 161 | − enum gpio_lookup_flags *lookupflags) | |
| 160 | + unsigned long *lookupflags) | |
| 162 | 161 | { |
| 163 | 162 | return ERR_PTR(-ENOENT); |
| 164 | 163 | } |
| @@ -22,7 +22,7 @@ enum gpio_lookup_flags { · 21 unmodified lines | ||
| 22 | 22 | * @chip_hwnum: hardware number (i.e. relative to the chip) of the GPIO |
| 23 | 23 | * @con_id: name of the GPIO from the device's point of view |
| 24 | 24 | * @idx: index of the GPIO in case several GPIOs share the same name |
| 25 | − * @flags: mask of GPIO_* values | |
| 25 | + * @flags: bitmask of gpio_lookup_flags GPIO_* values | |
| 26 | 26 | * |
| 27 | 27 | * gpiod_lookup is a lookup table for associating GPIOs to specific devices and |
| 28 | 28 | * functions using platform data. |
| @@ -32,7 +32,7 @@ struct gpiod_lookup { · 3 unmodified lines | ||
| 32 | 32 | u16 chip_hwnum; |
| 33 | 33 | const char *con_id; |
| 34 | 34 | unsigned int idx; |
| 35 | − enum gpio_lookup_flags flags; | |
| 35 | + unsigned long flags; | |
| 36 | 36 | }; |
| 37 | 37 | |
| 38 | 38 | struct gpiod_lookup_table { |
| @@ -46,7 +46,7 @@ struct gpiod_lookup_table { · 7 unmodified lines | ||
| 46 | 46 | * @chip_label: name of the chip the GPIO belongs to |
| 47 | 47 | * @chip_hwnum: hardware number (i.e. relative to the chip) of the GPIO |
| 48 | 48 | * @line_name: consumer name for the hogged line |
| 49 | − * @lflags: mask of GPIO lookup flags | |
| 49 | + * @lflags: bitmask of gpio_lookup_flags GPIO_* values | |
| 50 | 50 | * @dflags: GPIO flags used to specify the direction and value |
| 51 | 51 | */ |
| 52 | 52 | struct gpiod_hog { |
| @@ -54,7 +54,7 @@ struct gpiod_hog { · 1 unmodified line | ||
| 54 | 54 | const char *chip_label; |
| 55 | 55 | u16 chip_hwnum; |
| 56 | 56 | const char *line_name; |
| 57 | − enum gpio_lookup_flags lflags; | |
| 57 | + unsigned long lflags; | |
| 58 | 58 | int dflags; |
| 59 | 59 | }; |
| 60 | 60 | |