gpiolib: Fix gpio_lookup_flags mess and add Return sections
Subsystems (4)
v2 cover gpiolib: Fix gpio_lookup_flags mess and add Return sections
While reviewing another patch I have realised that enum gpio_lookup_flags messes up with GPIO_* flags definitions. Hence the first patch fix. Second one is an updated version of adding Return sections to the kernel-doc.
The series is made in assumption that the patches will land in this order, but if applied separately, e.g., one to for-current and one to for-next branches, no conflicts should appear.
In v2:
- new patch 1
- replaces error-code by errno (Randy)
- added tags to patch 2 (Randy)
Andy Shevchenko (2):
gpiolib: Fix a mess with the GPIO_* flags
gpiolib: Update the kernel documentation - add Return sections
drivers/gpio/gpiolib-acpi.c | 22 ++- drivers/gpio/gpiolib-cdev.c | 8 +- drivers/gpio/gpiolib-devres.c | 44 ++++- drivers/gpio/gpiolib-legacy.c | 3 + drivers/gpio/gpiolib-of.c | 53 ++++-- drivers/gpio/gpiolib-swnode.c | 4 +- drivers/gpio/gpiolib-sysfs.c | 6 +- drivers/gpio/gpiolib.c | 165 ++++++++++++++---- .../broadcom/brcm80211/brcmsmac/led.c | 2 +- include/linux/gpio/driver.h | 3 +- include/linux/gpio/machine.h | 20 +-- 11 files changed, 245 insertions(+), 85 deletions(-)
Signature · 1 line
2.43.0.rc1.1.gbec44491f096
PATCH v2 1/2 gpiolib: Fix a mess with the GPIO_* flags
The GPIO_* flag definitions are *almost* duplicated in two files (with unmatches OPEN_SOURCE / OPEN_DRAIN). Moreover, some code relies on one set of definitions while the rest is on the other. Clean up this mess by providing only one source of the definitions to all.
--- drivers/gpio/gpiolib-of.c | 5 ++--- drivers/gpio/gpiolib.c | 8 +++----- .../broadcom/brcm80211/brcmsmac/led.c | 2 +- include/linux/gpio/driver.h | 3 +-- include/linux/gpio/machine.h | 20 +++++-------------- 5 files changed, 12 insertions(+), 26 deletions(-)
drivers/gpio/gpiolib-of.c +2 -3
@@ -434,7 +434,7 @@ int of_get_named_gpio(const struct device_node *np, const char *propname, }EXPORT_SYMBOL_GPL (of_get_named_gpio); -/* Converts gpio_lookup_flags into bitmask of GPIO_* values */ +/* Converts of_gpio_flags into bitmask of GPIO_* values */ static unsigned long of_convert_gpio_flags (enum of_gpio_flags flags) {unsigned long lflags =GPIO_LOOKUP_FLAGS_DEFAULT ;
@@ -708,8 +708,7 @@ struct gpio_desc *of_find_gpio(struct device_node *np, const char *con_id,* @chip: GPIO chip whose hog is parsed * @idx: Index of the GPIO to parse * @name: GPIO line name -* @lflags: bitmask of gpio_lookup_flags GPIO_* values - returned from -* of_find_gpio() or of_parse_own_gpio() +* @lflags: bitmask of GPIO_* values - returned from *_find_gpio() * @dflags: gpiod_flags - optional GPIO initialization flags * * Returns GPIO descriptor to use with Linux GPIO API, or one of the errno
drivers/gpio/gpiolib.c +3 -5
@@ -2432,7 +2432,7 @@ static inline const char *function_name_or_default(const char *con_id)struct gpio_desc *gpiochip_request_own_desc (struct gpio_chip *gc,unsigned int hwnum,const char *label, -enum gpio_lookup_flags lflags, +unsigned long lflags,enum gpiod_flags dflags) {struct gpio_desc *desc =gpiochip_get_desc (gc, hwnum);
@@ -4348,8 +4348,7 @@ EXPORT_SYMBOL_GPL(gpiod_get_optional);* gpiod_configure_flags - helper function to configure a given GPIO * @desc: gpio whose value will be assigned * @con_id: function within the GPIO consumer -* @lflags: bitmask of gpio_lookup_flags GPIO_* values - returned from -* of_find_gpio() or of_get_gpio_hog() +* @lflags: bitmask of GPIO_* values - returned from *_find_gpio() * @dflags: gpiod_flags - optional GPIO initialization flags * * Return 0 on success, -ENOENT if no GPIO has been assigned to the
@@ -4475,8 +4474,7 @@ EXPORT_SYMBOL_GPL(gpiod_get_index_optional);* gpiod_hog - Hog the specified GPIO desc given the provided flags * @desc: gpio whose value will be assigned * @name: gpio line name -* @lflags: bitmask of gpio_lookup_flags GPIO_* values - returned from -* of_find_gpio() or of_get_gpio_hog() +* @lflags: bitmask of GPIO_* values - returned from *_find_gpio() * @dflags: gpiod_flags - optional GPIO initialization flags */ int gpiod_hog(struct gpio_desc *desc, const char *name,
drivers/net/wireless/broadcom/brcm80211/brcmsmac/led.c +1 -1
@@ -60,8 +60,8 @@ int brcms_led_register(struct brcms_info *wl) &sprom->gpio1, &sprom->gpio2, &sprom->gpio3 }; +unsigned long lflags =GPIO_ACTIVE_HIGH ;int hwnum =-1 ; -enum gpio_lookup_flags lflags =GPIO_ACTIVE_HIGH ;/* find radio enabled LED */ for (i =0 ; i <BRCMS_LED_NO ; i++) {
include/linux/gpio/driver.h +1 -2
@@ -31,7 +31,6 @@ struct gpio_chip;struct gpio_desc ;struct gpio_device ; -enum gpio_lookup_flags ;enum gpiod_flags ;union gpio_irq_fwspec {
@@ -789,7 +788,7 @@ gpiochip_remove_pin_ranges(struct gpio_chip *gc)struct gpio_desc *gpiochip_request_own_desc (struct gpio_chip *gc,unsigned int hwnum,const char *label, -enum gpio_lookup_flags lflags, +unsigned long lflags,enum gpiod_flags dflags);void gpiochip_free_own_desc (struct gpio_desc *desc);
include/linux/gpio/machine.h +5 -15
@@ -2,21 +2,11 @@#ifndef __LINUX_GPIO_MACHINE_H#define __LINUX_GPIO_MACHINE_H +#include <dt-bindings/gpio/gpio.h> /* for GPIO_* flags */ #include <linux/types.h> -enum gpio_lookup_flags { -GPIO_ACTIVE_HIGH = (0 <<0 ), -GPIO_ACTIVE_LOW = (1 <<0 ), -GPIO_OPEN_DRAIN = (1 <<1 ), -GPIO_OPEN_SOURCE = (1 <<2 ), -GPIO_PERSISTENT = (0 <<3 ), -GPIO_TRANSITORY = (1 <<3 ), -GPIO_PULL_UP = (1 <<4 ), -GPIO_PULL_DOWN = (1 <<5 ), -GPIO_PULL_DISABLE = (1 <<6 ), - -GPIO_LOOKUP_FLAGS_DEFAULT =GPIO_ACTIVE_HIGH |GPIO_PERSISTENT , -}; +/* Additional GPIO_* flags for internal use */ +#define GPIO_LOOKUP_FLAGS_DEFAULT (GPIO_ACTIVE_HIGH | GPIO_PERSISTENT)/** * struct gpiod_lookup - lookup table
@@ -27,7 +17,7 @@ enum gpio_lookup_flags {* U16_MAX to indicate that @key is a GPIO line name * @con_id: name of the GPIO from the device's point of view * @idx: index of the GPIO in case several GPIOs share the same name -* @flags: bitmask of gpio_lookup_flags GPIO_* values +* @flags: bitmask of GPIO_* values * * gpiod_lookup is a lookup table for associating GPIOs to specific devices and * functions using platform data.
@@ -51,7 +41,7 @@ struct gpiod_lookup_table {* @chip_label: name of the chip the GPIO belongs to * @chip_hwnum: hardware number (i.e. relative to the chip) of the GPIO * @line_name: consumer name for the hogged line -* @lflags: bitmask of gpio_lookup_flags GPIO_* values +* @lflags: bitmask of GPIO_* values * @dflags: GPIO flags used to specify the direction and value */ struct gpiod_hog {
Signature · 1 line
2.43.0.rc1.1.gbec44491f096
kernel test robot
build botRe: [PATCH v2 1/2] gpiolib: Fix a mess with the GPIO_* flags
kernel test robot noticed the following build warnings:
Hi Andy,
kernel test robot noticed the following build warnings:
[auto build test WARNING on brgl/gpio/for-next]
[also build test WARNING on wireless-next/main wireless/main linus/master v6.9-rc3 next-20240408] [If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Andy-Shevchenko/gpiolib-Fix-a-mess-with-the-GPIO_-flags/20240409-071911 base: https://git.kernel.org/pub/scm/linux/kernel/git/brgl/linux.git gpio/for-next patch link: https://lore.kernel.org/r/20240408231727.396452-2-andriy.shevchenko%40linux.intel.com patch subject: [PATCH v2 1/2] gpiolib: Fix a mess with the GPIO_* flags config: i386-allmodconfig (https://download.01.org/0day-ci/archive/20240409/[email protected]/config) compiler: gcc-13 (Ubuntu 13.2.0-4ubuntu3) 13.2.0 reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240409/[email protected]/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
All warnings (new ones prefixed by >>):
In file included from arch/x86/include/asm/geode.h:12,
from arch/x86/platform/geode/alix.c:28:
>> include/linux/cs5535.h:149: warning: "GPIO_PULL_UP" redefined
149 | #define GPIO_PULL_UP 0x18
|
In file included from include/linux/gpio/machine.h:5,
from arch/x86/platform/geode/alix.c:25:
include/dt-bindings/gpio/gpio.h:37: note: this is the location of the previous definition
37 | #define GPIO_PULL_UP 16
|
>> include/linux/cs5535.h:150: warning: "GPIO_PULL_DOWN" redefined
150 | #define GPIO_PULL_DOWN 0x1C
|
include/dt-bindings/gpio/gpio.h:40: note: this is the location of the previous definition
40 | #define GPIO_PULL_DOWN 32
| vim +/GPIO_PULL_UP +149 include/linux/cs5535.h
f060f27007b393 Andres Salomon 2009-12-14 141 5f0a96b044d8ed Andres Salomon 2009-12-14 142 /* GPIOs */ 5f0a96b044d8ed Andres Salomon 2009-12-14 143 #define GPIO_OUTPUT_VAL 0x00 5f0a96b044d8ed Andres Salomon 2009-12-14 144 #define GPIO_OUTPUT_ENABLE 0x04 5f0a96b044d8ed Andres Salomon 2009-12-14 145 #define GPIO_OUTPUT_OPEN_DRAIN 0x08 5f0a96b044d8ed Andres Salomon 2009-12-14 146 #define GPIO_OUTPUT_INVERT 0x0C 5f0a96b044d8ed Andres Salomon 2009-12-14 147 #define GPIO_OUTPUT_AUX1 0x10 5f0a96b044d8ed Andres Salomon 2009-12-14 148 #define GPIO_OUTPUT_AUX2 0x14 5f0a96b044d8ed Andres Salomon 2009-12-14 @149 #define GPIO_PULL_UP 0x18 5f0a96b044d8ed Andres Salomon 2009-12-14 @150 #define GPIO_PULL_DOWN 0x1C 5f0a96b044d8ed Andres Salomon 2009-12-14 151 #define GPIO_INPUT_ENABLE 0x20 5f0a96b044d8ed Andres Salomon 2009-12-14 152 #define GPIO_INPUT_INVERT 0x24 5f0a96b044d8ed Andres Salomon 2009-12-14 153 #define GPIO_INPUT_FILTER 0x28 5f0a96b044d8ed Andres Salomon 2009-12-14 154 #define GPIO_INPUT_EVENT_COUNT 0x2C 5f0a96b044d8ed Andres Salomon 2009-12-14 155 #define GPIO_READ_BACK 0x30 5f0a96b044d8ed Andres Salomon 2009-12-14 156 #define GPIO_INPUT_AUX1 0x34 5f0a96b044d8ed Andres Salomon 2009-12-14 157 #define GPIO_EVENTS_ENABLE 0x38 5f0a96b044d8ed Andres Salomon 2009-12-14 158 #define GPIO_LOCK_ENABLE 0x3C 5f0a96b044d8ed Andres Salomon 2009-12-14 159 #define GPIO_POSITIVE_EDGE_EN 0x40 5f0a96b044d8ed Andres Salomon 2009-12-14 160 #define GPIO_NEGATIVE_EDGE_EN 0x44 5f0a96b044d8ed Andres Salomon 2009-12-14 161 #define GPIO_POSITIVE_EDGE_STS 0x48 5f0a96b044d8ed Andres Salomon 2009-12-14 162 #define GPIO_NEGATIVE_EDGE_STS 0x4C
5f0a96b044d8ed Andres Salomon 2009-12-14 163
Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki
kernel test robot
build botRe: [PATCH v2 1/2] gpiolib: Fix a mess with the GPIO_* flags
In reply to Andy Shevchenkokernel test robot noticed the following build warnings:
Hi Andy,
kernel test robot noticed the following build warnings:
[auto build test WARNING on brgl/gpio/for-next]
[also build test WARNING on wireless-next/main wireless/main linus/master v6.9-rc3 next-20240409] [If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Andy-Shevchenko/gpiolib-Fix-a-mess-with-the-GPIO_-flags/20240409-071911 base: https://git.kernel.org/pub/scm/linux/kernel/git/brgl/linux.git gpio/for-next patch link: https://lore.kernel.org/r/20240408231727.396452-2-andriy.shevchenko%40linux.intel.com patch subject: [PATCH v2 1/2] gpiolib: Fix a mess with the GPIO_* flags config: i386-buildonly-randconfig-002-20240409 (https://download.01.org/0day-ci/archive/20240409/[email protected]/config) compiler: clang version 17.0.6 (https://github.com/llvm/llvm-project 6009708b4367171ccdbf4b5905cb6a803753fe18) reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240409/[email protected]/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
All warnings (new ones prefixed by >>):
In file included from arch/x86/platform/geode/net5501.c:25:
In file included from arch/x86/include/asm/geode.h:12:
>> include/linux/cs5535.h:149:9: warning: 'GPIO_PULL_UP' macro redefined [-Wmacro-redefined]
149 | #define GPIO_PULL_UP 0x18
| ^
include/dt-bindings/gpio/gpio.h:37:9: note: previous definition is here
37 | #define GPIO_PULL_UP 16
| ^
In file included from arch/x86/platform/geode/net5501.c:25:
In file included from arch/x86/include/asm/geode.h:12:
>> include/linux/cs5535.h:150:9: warning: 'GPIO_PULL_DOWN' macro redefined [-Wmacro-redefined]
150 | #define GPIO_PULL_DOWN 0x1C
| ^
include/dt-bindings/gpio/gpio.h:40:9: note: previous definition is here
40 | #define GPIO_PULL_DOWN 32
| ^2 warnings generated.
vim +/GPIO_PULL_UP +149 include/linux/cs5535.h
f060f27007b393 Andres Salomon 2009-12-14 141 5f0a96b044d8ed Andres Salomon 2009-12-14 142 /* GPIOs */ 5f0a96b044d8ed Andres Salomon 2009-12-14 143 #define GPIO_OUTPUT_VAL 0x00 5f0a96b044d8ed Andres Salomon 2009-12-14 144 #define GPIO_OUTPUT_ENABLE 0x04 5f0a96b044d8ed Andres Salomon 2009-12-14 145 #define GPIO_OUTPUT_OPEN_DRAIN 0x08 5f0a96b044d8ed Andres Salomon 2009-12-14 146 #define GPIO_OUTPUT_INVERT 0x0C 5f0a96b044d8ed Andres Salomon 2009-12-14 147 #define GPIO_OUTPUT_AUX1 0x10 5f0a96b044d8ed Andres Salomon 2009-12-14 148 #define GPIO_OUTPUT_AUX2 0x14 5f0a96b044d8ed Andres Salomon 2009-12-14 @149 #define GPIO_PULL_UP 0x18 5f0a96b044d8ed Andres Salomon 2009-12-14 @150 #define GPIO_PULL_DOWN 0x1C 5f0a96b044d8ed Andres Salomon 2009-12-14 151 #define GPIO_INPUT_ENABLE 0x20 5f0a96b044d8ed Andres Salomon 2009-12-14 152 #define GPIO_INPUT_INVERT 0x24 5f0a96b044d8ed Andres Salomon 2009-12-14 153 #define GPIO_INPUT_FILTER 0x28 5f0a96b044d8ed Andres Salomon 2009-12-14 154 #define GPIO_INPUT_EVENT_COUNT 0x2C 5f0a96b044d8ed Andres Salomon 2009-12-14 155 #define GPIO_READ_BACK 0x30 5f0a96b044d8ed Andres Salomon 2009-12-14 156 #define GPIO_INPUT_AUX1 0x34 5f0a96b044d8ed Andres Salomon 2009-12-14 157 #define GPIO_EVENTS_ENABLE 0x38 5f0a96b044d8ed Andres Salomon 2009-12-14 158 #define GPIO_LOCK_ENABLE 0x3C 5f0a96b044d8ed Andres Salomon 2009-12-14 159 #define GPIO_POSITIVE_EDGE_EN 0x40 5f0a96b044d8ed Andres Salomon 2009-12-14 160 #define GPIO_NEGATIVE_EDGE_EN 0x44 5f0a96b044d8ed Andres Salomon 2009-12-14 161 #define GPIO_POSITIVE_EDGE_STS 0x48 5f0a96b044d8ed Andres Salomon 2009-12-14 162 #define GPIO_NEGATIVE_EDGE_STS 0x4C
5f0a96b044d8ed Andres Salomon 2009-12-14 163
Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki
Re: [PATCH v2 1/2] gpiolib: Fix a mess with the GPIO_* flags
In reply to Andy ShevchenkoQuoted 12 lines · Andy Shevchenko
The GPIO_* flag definitions are *almost* duplicated in two files (with unmatches
OPEN_SOURCE/OPEN_DRAIN). Moreover, some code relies on one set of definitions while the rest is on the other. Clean up this mess by providing only one source of the definitions to all.Fixes b424808115cb ("brcm80211: brcmsmac: Move LEDs to GPIO descriptors")Fixes 5923ea6c2ce6 ("gpio: pass lookup and descriptor flags to request_own")Fixes fed7026adc7c ("gpiolib: Make use of enum gpio_lookup_flags consistent")Fixes 4c0facddb7d8 ("gpio: core: Decouple open drain/source flag with active low/high")Fixes 69d301fdd196 ("gpio: add DT bindings for existing consumer flags")Signed-off-by Andy Shevchenko <[email protected]>
Quoted 8 lines
--- drivers/gpio/gpiolib-of.c | 5 ++--- drivers/gpio/gpiolib.c | 8 +++----- .../broadcom/brcm80211/brcmsmac/led.c | 2 +- include/linux/gpio/driver.h | 3 +-- include/linux/gpio/machine.h | 20 +++++-------------- 5 files changed, 12 insertions(+), 26 deletions(-)
I don't think ./dt-bindings/gpio/gpio.h is the right source of these defines for everyone - including non-OF systems. I would prefer the ones in include/linux/gpio/machine.h be the upstream source but then headers in include/dt-bindings/ cannot include them so my second-best suggestion is to rename the ones in include/linux/gpio/machine.h and treewide too. In general values from ./dt-bindings/gpio/gpio.h should only be used in DTS sources and gpiolib-of code.
Bart
Re: [PATCH v2 1/2] gpiolib: Fix a mess with the GPIO_* flags
Quoted 22 lines · Bartosz Golaszewski
Quoted 12 lines · Andy Shevchenko
The GPIO_* flag definitions are *almost* duplicated in two files (with unmatches
OPEN_SOURCE/OPEN_DRAIN). Moreover, some code relies on one set of definitions while the rest is on the other. Clean up this mess by providing only one source of the definitions to all.Fixes b424808115cb ("brcm80211: brcmsmac: Move LEDs to GPIO descriptors")Fixes 5923ea6c2ce6 ("gpio: pass lookup and descriptor flags to request_own")Fixes fed7026adc7c ("gpiolib: Make use of enum gpio_lookup_flags consistent")Fixes 4c0facddb7d8 ("gpio: core: Decouple open drain/source flag with active low/high")Fixes 69d301fdd196 ("gpio: add DT bindings for existing consumer flags")Signed-off-by Andy Shevchenko <[email protected]>Quoted 7 lines
--- drivers/gpio/gpiolib-of.c | 5 ++--- drivers/gpio/gpiolib.c | 8 +++----- .../broadcom/brcm80211/brcmsmac/led.c | 2 +- include/linux/gpio/driver.h | 3 +-- include/linux/gpio/machine.h | 20 +++++-------------- 5 files changed, 12 insertions(+), 26 deletions(-)
Quoted 7 lines
I don't think
./dt-bindings/gpio/gpio.his the right source of these defines for everyone - including non-OF systems. I would prefer the ones ininclude/linux/gpio/machine.hbe the upstream source but then headers ininclude/dt-bindings/cannot include them so my second-best suggestion is to rename the ones ininclude/linux/gpio/machine.hand treewide too. In general values from./dt-bindings/gpio/gpio.hshould only be used in DTS sources and gpiolib-of code.
Then, please fix that your way. It's quite annoying issue.
Signature · 2 lines
With Best Regards, Andy Shevchenko
Re: [PATCH v2 1/2] gpiolib: Fix a mess with the GPIO_* flags
Quoted 32 lines · Andy Shevchenko
Quoted 22 lines · Bartosz Golaszewski
Quoted 12 lines · Andy Shevchenko
The GPIO_* flag definitions are *almost* duplicated in two files (with unmatches
OPEN_SOURCE/OPEN_DRAIN). Moreover, some code relies on one set of definitions while the rest is on the other. Clean up this mess by providing only one source of the definitions to all.Fixes b424808115cb ("brcm80211: brcmsmac: Move LEDs to GPIO descriptors")Fixes 5923ea6c2ce6 ("gpio: pass lookup and descriptor flags to request_own")Fixes fed7026adc7c ("gpiolib: Make use of enum gpio_lookup_flags consistent")Fixes 4c0facddb7d8 ("gpio: core: Decouple open drain/source flag with active low/high")Fixes 69d301fdd196 ("gpio: add DT bindings for existing consumer flags")Signed-off-by Andy Shevchenko <[email protected]>Quoted 7 lines
--- drivers/gpio/gpiolib-of.c | 5 ++--- drivers/gpio/gpiolib.c | 8 +++----- .../broadcom/brcm80211/brcmsmac/led.c | 2 +- include/linux/gpio/driver.h | 3 +-- include/linux/gpio/machine.h | 20 +++++-------------- 5 files changed, 12 insertions(+), 26 deletions(-)Quoted 7 lines
I don't think
./dt-bindings/gpio/gpio.his the right source of these defines for everyone - including non-OF systems. I would prefer the ones ininclude/linux/gpio/machine.hbe the upstream source but then headers ininclude/dt-bindings/cannot include them so my second-best suggestion is to rename the ones ininclude/linux/gpio/machine.hand treewide too. In general values from./dt-bindings/gpio/gpio.hshould only be used in DTS sources and gpiolib-of code.
Quoted 2 lines
Then, please fix that your way. It's quite annoying issue.
This is not difficult in itself but it's a tree-wide change so we will probably have to send it to Torvalds at the end of the merge window in a separate pull-request.
I don't really have time now, I'll be travelling for 5 weeks in a row. I'll see closer to the merge window. Or next release cycle.
Bart
Re: [PATCH v2 1/2] gpiolib: Fix a mess with the GPIO_* flags
Quoted 33 lines · Bartosz Golaszewski
Quoted 31 lines · Andy Shevchenko
Quoted 29 lines · Bartosz Golaszewski
Quoted 12 lines · Andy Shevchenko
The GPIO_* flag definitions are *almost* duplicated in two files (with unmatches
OPEN_SOURCE/OPEN_DRAIN). Moreover, some code relies on one set of definitions while the rest is on the other. Clean up this mess by providing only one source of the definitions to all.Fixes b424808115cb ("brcm80211: brcmsmac: Move LEDs to GPIO descriptors")Fixes 5923ea6c2ce6 ("gpio: pass lookup and descriptor flags to request_own")Fixes fed7026adc7c ("gpiolib: Make use of enum gpio_lookup_flags consistent")Fixes 4c0facddb7d8 ("gpio: core: Decouple open drain/source flag with active low/high")Fixes 69d301fdd196 ("gpio: add DT bindings for existing consumer flags")Signed-off-by Andy Shevchenko <[email protected]>Quoted 7 lines
--- drivers/gpio/gpiolib-of.c | 5 ++--- drivers/gpio/gpiolib.c | 8 +++----- .../broadcom/brcm80211/brcmsmac/led.c | 2 +- include/linux/gpio/driver.h | 3 +-- include/linux/gpio/machine.h | 20 +++++-------------- 5 files changed, 12 insertions(+), 26 deletions(-)I don't think
./dt-bindings/gpio/gpio.his the right source of these defines for everyone - including non-OF systems. I would prefer the ones ininclude/linux/gpio/machine.hbe the upstream source but then headers ininclude/dt-bindings/cannot include them so my second-best suggestion is to rename the ones ininclude/linux/gpio/machine.hand treewide too. In general values from./dt-bindings/gpio/gpio.hshould only be used in DTS sources and gpiolib-of code.
Quoted 3 lines
Quoted 1 line
Then, please fix that your way. It's quite annoying issue.
This is not difficult in itself
I'm not sure, what about enum gpio_lookup_flags? Shall we resurrect it? I see that you have better vision anyway. Consider my patch as a problem report (and as bonus you have already list of Fixes tags :-).
Quoted 3 lines
but it's a tree-wide change so we will
probably have to send it to Torvalds at the end of the merge window in a separate pull-request.
WFM!
Quoted 2 lines
I don't really have time now, I'll be travelling for 5 weeks in a row. I'll see closer to the merge window. Or next release cycle.
But can you prioritize this? It's a carefully planted minefield with already a bug and confusion here.
Signature · 2 lines
With Best Regards, Andy Shevchenko
Re: [PATCH v2 1/2] gpiolib: Fix a mess with the GPIO_* flags
In reply to Andy ShevchenkoQuoted 11 lines · Andy Shevchenko
The GPIO_* flag definitions are *almost* duplicated in two files (with unmatches
OPEN_SOURCE/OPEN_DRAIN). Moreover, some code relies on one set of definitions while the rest is on the other. Clean up this mess by providing only one source of the definitions to all.Fixes b424808115cb ("brcm80211: brcmsmac: Move LEDs to GPIO descriptors")Fixes 5923ea6c2ce6 ("gpio: pass lookup and descriptor flags to request_own")Fixes fed7026adc7c ("gpiolib: Make use of enum gpio_lookup_flags consistent")Fixes 4c0facddb7d8 ("gpio: core: Decouple open drain/source flag with active low/high")Fixes 69d301fdd196 ("gpio: add DT bindings for existing consumer flags")Signed-off-by Andy Shevchenko <[email protected]>
The way the line lookup flags ("lflags") were conceived was through support for non-DT systems using descriptor tables, and that is how enum gpio_lookup_flags came to be.
When OF support was added it was bolted on on the side, in essence assuming that the DT/OF ABI was completely separate (and they/we sure like to think about it that way...) and thus needed translation from OF flags to kernel-internal enum gpio_lookup_flags.
The way *I* thought about this when writing it was certainly that the DT bindings was a separate thing (<dt-bindings/*.h> didn't even exist at the time I think) and that translation from OF to kernel-internal lflags would happen in *one* place.
The main reasoning still holds: the OF define is an ABI, so it can *never* be changed, but the enum gpio_lookup_flags is subject to Documentation/process/stable-api-nonsense.rst and that means that if we want to swap around the order of the definitions we can.
But admittedly this is a bit over-belief in process and separation of concerns and practical matters may be something else...
Yours,
Linus Walleij
Re: [PATCH v2 1/2] gpiolib: Fix a mess with the GPIO_* flags
Quoted 29 lines · Linus Walleij
Quoted 11 lines · Andy Shevchenko
The GPIO_* flag definitions are *almost* duplicated in two files (with unmatches
OPEN_SOURCE/OPEN_DRAIN). Moreover, some code relies on one set of definitions while the rest is on the other. Clean up this mess by providing only one source of the definitions to all.Fixes b424808115cb ("brcm80211: brcmsmac: Move LEDs to GPIO descriptors")Fixes 5923ea6c2ce6 ("gpio: pass lookup and descriptor flags to request_own")Fixes fed7026adc7c ("gpiolib: Make use of enum gpio_lookup_flags consistent")Fixes 4c0facddb7d8 ("gpio: core: Decouple open drain/source flag with active low/high")Fixes 69d301fdd196 ("gpio: add DT bindings for existing consumer flags")Signed-off-by Andy Shevchenko <[email protected]>The way the line lookup flags ("lflags") were conceived was through support for non-DT systems using descriptor tables, and that is how enum
gpio_lookup_flagscame to be.When OF support was added it was bolted on on the side, in essence assuming that the DT/OF ABI was completely separate (and they/we sure like to think about it that way...) and thus needed translation from OF flags to kernel-internal enum
gpio_lookup_flags.The way *I* thought about this when writing it was certainly that the DT bindings was a separate thing (<dt-bindings/*.h> didn't even exist at the time I think) and that translation from OF to kernel-internal lflags would happen in *one* place.
Quoted 7 lines
The main reasoning still holds: the OF define is an ABI, so it can *never* be changed, but the enum
gpio_lookup_flagsis subject toDocumentation/process/stable-api-nonsense.rstand that means that if we want to swap around the order of the definitions we can.But admittedly this is a bit over-belief in process and separation of concerns and practical matters may be something else...
Got it. But we have a name clash and the mess added to the users. I can redo this to separate these entities.
Note, that there is code in the kernel that *does* use #include <dt-bindings/*.h>
for Linux internals.
$ git grep -lw '^#include <dt-bindings/.*\.h>' -- drivers/ | xargs dirname | cut -f 1,2 -d '/' | sort -u drivers/bus drivers/clk drivers/clocksource drivers/cpufreq drivers/dma drivers/firmware drivers/gpio drivers/gpu drivers/hwtracing drivers/i2c drivers/iio drivers/input drivers/interconnect drivers/iommu drivers/irqchip drivers/leds drivers/mailbox drivers/media drivers/memory drivers/mfd drivers/net drivers/phy drivers/pinctrl drivers/platform drivers/pmdomain drivers/power drivers/pwm drivers/regulator drivers/remoteproc drivers/reset drivers/rtc drivers/soc drivers/spmi drivers/thermal drivers/tty drivers/video drivers/watchdog
P.S>
One of the patch this tries to fix is yours IIRC :-)
Signature · 2 lines
With Best Regards, Andy Shevchenko
Re: [PATCH v2 1/2] gpiolib: Fix a mess with the GPIO_* flags
Quoted 39 lines · Andy Shevchenko
Quoted 29 lines · Linus Walleij
Quoted 11 lines · Andy Shevchenko
The GPIO_* flag definitions are *almost* duplicated in two files (with unmatches
OPEN_SOURCE/OPEN_DRAIN). Moreover, some code relies on one set of definitions while the rest is on the other. Clean up this mess by providing only one source of the definitions to all.Fixes b424808115cb ("brcm80211: brcmsmac: Move LEDs to GPIO descriptors")Fixes 5923ea6c2ce6 ("gpio: pass lookup and descriptor flags to request_own")Fixes fed7026adc7c ("gpiolib: Make use of enum gpio_lookup_flags consistent")Fixes 4c0facddb7d8 ("gpio: core: Decouple open drain/source flag with active low/high")Fixes 69d301fdd196 ("gpio: add DT bindings for existing consumer flags")Signed-off-by Andy Shevchenko <[email protected]>The way the line lookup flags ("lflags") were conceived was through support for non-DT systems using descriptor tables, and that is how enum
gpio_lookup_flagscame to be.When OF support was added it was bolted on on the side, in essence assuming that the DT/OF ABI was completely separate (and they/we sure like to think about it that way...) and thus needed translation from OF flags to kernel-internal enum
gpio_lookup_flags.The way *I* thought about this when writing it was certainly that the DT bindings was a separate thing (<dt-bindings/*.h> didn't even exist at the time I think) and that translation from OF to kernel-internal lflags would happen in *one* place.
Quoted 7 lines
The main reasoning still holds: the OF define is an ABI, so it can *never* be changed, but the enum
gpio_lookup_flagsis subject toDocumentation/process/stable-api-nonsense.rstand that means that if we want to swap around the order of the definitions we can.But admittedly this is a bit over-belief in process and separation of concerns and practical matters may be something else...
Quoted 7 lines
Got it. But we have a name clash and the mess added to the users. I can redo this to separate these entities.
Note, that there is code in the kernel that *does* use #include <dt-bindings/*.h>
for Linux internals.
Well, then they are wrong. We should convert them to using linux/gpio/machine.h first. Or even put these defines elsewhere depending on what these drivers are using it for in general. Maybe machine.h is not the right place. Then once that's figured out, we can start renaming the constants.
IIUC include/dt-bindings/ headers should only be used by DT sources and code that parses the OF properties.
But it seems to me that we need to inspect these users, we cannot just automatically convert them at once, this is asking for trouble IMO.
Bart
Re: [PATCH v2 1/2] gpiolib: Fix a mess with the GPIO_* flags
Quoted 2 lines · Bartosz Golaszewski
IIUC
include/dt-bindings/headers should only be used by DT sources and code that parses the OF properties.
That's what I have come to understand as well.
I wonder if there is something that can be done to enforce it?
Ideally the code that parses OF properties should have to opt in to get access to the <dt-bindings/*> namespace.
Yours,
Linus Walleij
Re: [PATCH v2 1/2] gpiolib: Fix a mess with the GPIO_* flags
Quoted 11 lines · Linus Walleij
Quoted 2 lines · Bartosz Golaszewski
IIUC
include/dt-bindings/headers should only be used by DT sources and code that parses the OF properties.That's what I have come to understand as well.
I wonder if there is something that can be done to enforce it?
Ideally the code that parses OF properties should have to opt in to get access to the <dt-bindings/*> namespace.
Whatever you, guys, come up with as a solution, can it be fixed sooner than later? I mean, I would appreciate if somebody got it done for v6.9-rcX/v6.10-rc1 so we don't need to look into this again.
Signature · 2 lines
With Best Regards, Andy Shevchenko
Re: [PATCH v2 1/2] gpiolib: Fix a mess with the GPIO_* flags
Quoted 9 lines · Andy Shevchenko
Quoted 7 lines · Linus Walleij
Quoted 2 lines · Bartosz Golaszewski
IIUC
include/dt-bindings/headers should only be used by DT sources and code that parses the OF properties.That's what I have come to understand as well.
Quoted 9 lines
Quoted 4 lines
I wonder if there is something that can be done to enforce it?
Ideally the code that parses OF properties should have to opt in to get access to the <dt-bindings/*> namespace.
Whatever you, guys, come up with as a solution, can it be fixed sooner than later? I mean, I would appreciate if somebody got it done for v6.9-rcX/v6.10-rc1 so we don't need to look into this again.
I'm not sure you got what I was saying. I don't think this can be fixed quickly. This is just another bunch of technical debt that will have to be addressed carefully on a case-by-case basis and run through autobuilders in all possible configurations.
This type of include-related issues is always brittle and will lead to build failures if we don't consider our moves.
Bart
Re: [PATCH v2 1/2] gpiolib: Fix a mess with the GPIO_* flags
Quoted 20 lines · Bartosz Golaszewski
Quoted 9 lines · Andy Shevchenko
Quoted 7 lines · Linus Walleij
Quoted 2 lines · Bartosz Golaszewski
IIUC
include/dt-bindings/headers should only be used by DT sources and code that parses the OF properties.That's what I have come to understand as well.
Quoted 8 lines
Quoted 4 lines
I wonder if there is something that can be done to enforce it?
Ideally the code that parses OF properties should have to opt in to get access to the <dt-bindings/*> namespace.
Whatever you, guys, come up with as a solution, can it be fixed sooner than later? I mean, I would appreciate if somebody got it done for v6.9-rcX/v6.10-rc1 so we don't need to look into this again.
Quoted 7 lines
I'm not sure you got what I was saying. I don't think this can be fixed quickly. This is just another bunch of technical debt that will have to be addressed carefully on a case-by-case basis and run through autobuilders in all possible configurations.
This type of include-related issues is always brittle and will lead to build failures if we don't consider our moves.
I proposed a quick fix which was rejected. I think this is still doable in a few steps:
- align constant values in DT and enum
- drop usage of DT in the kernel code (That's what you want IIUC, however I disagree with this from technical perspective as DT constants can be used in the code as long as they are mapped 1:1 to what code does. That's current state of affairs. OTOH semantically this may be an issue.)
- restore enum usage treewide (?)
Again, the problem now is only in open source / open drain configurations and there are only a few users of these flags _in kernel_. I do not see why it can not be done in one or two evenings time range.
P.S>
Most of the time I spent when prepared the proposed fix is digging the history and trying to understand how comes that we have desynchronisation of the values over the time. The output of that is the list of Fixes tags.
Signature · 2 lines
With Best Regards, Andy Shevchenko
Re: [PATCH v2 1/2] gpiolib: Fix a mess with the GPIO_* flags
Quoted 27 lines · Andy Shevchenko
Quoted 25 lines · Bartosz Golaszewski
Quoted 9 lines · Andy Shevchenko
Quoted 7 lines · Linus Walleij
Quoted 2 lines · Bartosz Golaszewski
IIUC
include/dt-bindings/headers should only be used by DT sources and code that parses the OF properties.That's what I have come to understand as well.
Quoted 8 lines
Quoted 4 lines
I wonder if there is something that can be done to enforce it?
Ideally the code that parses OF properties should have to opt in to get access to the <dt-bindings/*> namespace.
Whatever you, guys, come up with as a solution, can it be fixed sooner than later? I mean, I would appreciate if somebody got it done for v6.9-rcX/v6.10-rc1 so we don't need to look into this again.
I'm not sure you got what I was saying. I don't think this can be fixed quickly. This is just another bunch of technical debt that will have to be addressed carefully on a case-by-case basis and run through autobuilders in all possible configurations.
Quoted 6 lines
Quoted 2 lines
This type of include-related issues is always brittle and will lead to build failures if we don't consider our moves.
I proposed a quick fix which was rejected. I think this is still doable in a few steps:
You having proposed a quick fix is not a reason for me to either apply it immediately OR equally promptly provide a proper solution myself.
Quoted 5 lines
- align constant values in DT and enum
- drop usage of DT in the kernel code (That's what you want IIUC, however I disagree with this from technical perspective as DT constants can be used in the code as long as they are mapped 1:1 to what code does. That's current state of affairs. OTOH semantically this may be an issue.)
It's against the convention of only using dt-bindings headers as I described before. I disagree with your proposition and it seems to me Linus backed me up on this.
Quoted 6 lines
- restore enum usage treewide (?)
Again, the problem now is only in open source / open drain configurations and there are only a few users of these flags
_inkernel_. I do not see why it can not be done in one or two evenings time range.
So you know what needs doing. I'm at a conference now, I'll be off for a week in April and I also have another conference scheduled for May. If you believe this needs addressing urgently, then I suggest you do it right. Otherwise, I'll get to it when I have the time. Unfortunately my TODO list runneth over. :(
But I have to say, I suspect it won't be as easy as you present it because we have so many build configs that may fail.
Quoted 5 lines
P.S>
Most of the time I spent when prepared the proposed fix is digging the history and trying to understand how comes that we have desynchronisation of the values over the time. The output of that is the list of Fixes tags.
Thank you, this history is useful and should make its way into git history when we fix this issue.
Bart
Re: [PATCH v2 1/2] gpiolib: Fix a mess with the GPIO_* flags
Quoted 3 lines · Bartosz Golaszewski
Quoted 1 line · Andy Shevchenko
On Tue, Apr 16, 2024 at 11:07:58PM +0200, Bartosz Golaszewski wrote:
...
Quoted 9 lines
Quoted 3 lines
Again, the problem now is only in open source / open drain configurations and there are only a few users of these flags
_inkernel_. I do not see why it can not be done in one or two evenings time range.So you know what needs doing. I'm at a conference now, I'll be off for a week in April and I also have another conference scheduled for May. If you believe this needs addressing urgently, then I suggest you do it right. Otherwise, I'll get to it when I have the time. Unfortunately my TODO list runneth over. :(
I have started already as you may have noticed.
Quoted 2 lines
But I have to say, I suspect it won't be as easy as you present it because we have so many build configs that may fail.
Let's see (with a hope)...
Signature · 2 lines
With Best Regards, Andy Shevchenko
Re: [PATCH v2 1/2] gpiolib: Fix a mess with the GPIO_* flags
In reply to Bartosz GolaszewskiQuoted 1 line · Bartosz Golaszewski
Unfortunately my TODO list runneth over. :(
When in situations like this, patch the objective into drivers/gpio/TODO so others can pick it up, that's why I created the file, and it has actually helped a bit!
IMO you don't even need to send edits to this file for review, it's just a work document. Just edit and commit it in your tree.
Yours,
Linus Walleij
Re: [PATCH v2 1/2] gpiolib: Fix a mess with the GPIO_* flags
Quoted 11 lines · Linus Walleij
Quoted 1 line · Bartosz Golaszewski
Unfortunately my TODO list runneth over. :(
When in situations like this, patch the objective into
drivers/gpio/TODOso others can pick it up, that's why I created the file, and it has actually helped a bit!IMO you don't even need to send edits to this file for review, it's just a work document. Just edit and commit it in your tree.
Btw, good point and thanks for the reminder, I believe I also can use it, but in my case I probably need to send a formal patch :-)
Signature · 2 lines
With Best Regards, Andy Shevchenko
PATCH v2 2/2 gpiolib: Update the kernel documentation - add Return sections
In reply to Andy Shevchenko$ scripts/kernel-doc -v -none -Wall drivers/gpio/gpiolib* 2>&1 | grep -w warning | wc -l 67
Fix these by adding Return sections. While at it, make sure all of Return sections use the same style.
--- drivers/gpio/gpiolib-acpi.c | 22 +++-- drivers/gpio/gpiolib-cdev.c | 8 +- drivers/gpio/gpiolib-devres.c | 44 +++++++++- drivers/gpio/gpiolib-legacy.c | 3 + drivers/gpio/gpiolib-of.c | 48 ++++++++--- drivers/gpio/gpiolib-swnode.c | 4 +- drivers/gpio/gpiolib-sysfs.c | 6 +- drivers/gpio/gpiolib.c | 157 +++++++++++++++++++++++++++------- 8 files changed, 233 insertions(+), 59 deletions(-)
drivers/gpio/gpiolib-acpi.c +17 -5
@@ -136,8 +136,12 @@ static int acpi_gpiochip_find(struct gpio_chip *gc, const void *data)* @path: ACPI GPIO controller full path name, (e.g. "\\_SB.GPO1") * @pin: ACPI GPIO pin number (0-based, controller-relative) * -* Return: GPIO descriptor to use with Linux generic GPIO API, or ERR_PTR -* error value. Specifically returns %-EPROBE_DEFER if the referenced GPIO +* Returns: +* GPIO descriptor to use with Linux generic GPIO API. +* If the GPIO cannot be translated or there is an error an ERR_PTR is +* returned. +* +* Specifically returns -EPROBE_DEFER if the referenced GPIO * controller does not have GPIO chip registered at the moment. This is to * support probe deferral. */
@@ -207,6 +211,9 @@ EXPORT_SYMBOL_GPL(acpi_gpio_get_irq_resource);* I/O resource or return False if not. * @ares: Pointer to the ACPI resource to fetch * @agpio: Pointer to a &struct acpi_resource_gpio to store the output pointer +* +* Returns: +* true if GpioIo resource is found, false otherwise. */ bool acpi_gpio_get_io_resource (struct acpi_resource *ares,struct acpi_resource_gpio **agpio)
@@ -859,7 +866,9 @@ static int acpi_gpio_property_lookup(struct fwnode_handle *fwnode,* that case @index is used to select the GPIO entry in the property value * (in case of multiple). * -* If the GPIO cannot be translated or there is an error, an ERR_PTR is +* Returns: +* GPIO descriptor to use with Linux generic GPIO API. +* If the GPIO cannot be translated or there is an error an ERR_PTR is * returned. * * Note: if the GPIO resource has multiple entries in the pin list, this
@@ -910,6 +919,8 @@ static struct gpio_desc *acpi_get_gpiod_by_index(struct acpi_device *adev,* resource with the relevant information from a data-only ACPI firmware node * and uses that to obtain the GPIO descriptor to return. * +* Returns: +* GPIO descriptor to use with Linux generic GPIO API. * If the GPIO cannot be translated or there is an error an ERR_PTR is * returned. */
@@ -1023,7 +1034,8 @@ struct gpio_desc *acpi_find_gpio(struct fwnode_handle *fwnode,* The GPIO is considered wake capable if the GpioInt resource specifies * SharedAndWake or ExclusiveAndWake. * -* Return: Linux IRQ number (> %0) on success, negative errno on failure. +* Returns: +* Linux IRQ number (> 0) on success, negative errno on failure. */ int acpi_dev_gpio_irq_wake_get_by (struct acpi_device *adev,const char *name,int index,bool *wake_capable)
@@ -1406,7 +1418,7 @@ static int acpi_find_gpio_count(struct acpi_resource *ares, void *data)* @fwnode: firmware node of the GPIO consumer * @con_id: function within the GPIO consumer * -* Return: +* Returns: * The number of GPIOs associated with a firmware node / function or %-ENOENT, * if no GPIO has been assigned to the requested function. */
drivers/gpio/gpiolib-cdev.c +6 -2
@@ -2726,7 +2726,9 @@ static ssize_t lineinfo_watch_read(struct file *file, char __user *buf,* gpio_chrdev_open() - open the chardev for ioctl operations * @inode: inode for this chardev * @file: file struct for storing private data -* Returns 0 on success +* +* Returns: +* 0 on success, or negative errno on failure. */ static int gpio_chrdev_open (struct inode *inode,struct file *file) {
@@ -2792,7 +2794,9 @@ static int gpio_chrdev_open(struct inode *inode, struct file *file)* gpio_chrdev_release() - close chardev after ioctl operations * @inode: inode for this chardev * @file: file struct for storing private data -* Returns 0 on success +* +* Returns: +* 0 on success, or negative errno on failure. */ static int gpio_chrdev_release (struct inode *inode,struct file *file) {
drivers/gpio/gpiolib-devres.c +42 -2
98 lines not on this page · raw message
drivers/gpio/gpiolib-legacy.c +3 -0
@@ -22,6 +22,9 @@ EXPORT_SYMBOL_GPL(gpio_free);* @label: a literal description string of this GPIO * * **DEPRECATED** This function is deprecated and must not be used in new code. +* +* Returns: +* 0 on success, or negative errno on failure. */ int gpio_request_one (unsigned gpio,unsigned long flags,const char *label) {
drivers/gpio/gpiolib-of.c +34 -14
103 lines not on this page · raw message
drivers/gpio/gpiolib-swnode.c +2 -2
@@ -96,8 +96,8 @@ struct gpio_desc *swnode_find_gpio(struct fwnode_handle *fwnode,* system-global GPIOs * @con_id: function within the GPIO consumer * -* Return: -* The number of GPIOs associated with a device / function or %-ENOENT, +* Returns: +* The number of GPIOs associated with a device / function or -ENOENT, * if no GPIO has been assigned to the requested function. */ int swnode_gpio_count (const struct fwnode_handle *fwnode,const char *con_id)
drivers/gpio/gpiolib-sysfs.c +4 -2
@@ -568,7 +568,8 @@ static struct class gpio_class = {* will see "direction" sysfs attribute which may be used to change * the gpio's direction. A "value" attribute will always be provided. * -* Returns zero on success, else an error. +* Returns: +* 0 on success, or negative errno on failure. */ int gpiod_export (struct gpio_desc *desc,bool direction_may_change) {
@@ -667,7 +668,8 @@ static int match_export(struct device *dev, const void *desc)* Set up a symlink from /sys/.../dev/name to /sys/class/gpio/gpioN * node. Caller is responsible for unlinking. * -* Returns zero on success, else an error. +* Returns: +* 0 on success, or negative errno on failure. */ int gpiod_export_link (struct device *dev,const char *name,struct gpio_desc *desc)
drivers/gpio/gpiolib.c +125 -32
431 lines not on this page · raw message
Signature · 1 line
2.43.0.rc1.1.gbec44491f096
Re: [PATCH v2 2/2] gpiolib: Update the kernel documentation - add Return sections
Quoted 5 lines · Andy Shevchenko
$ scripts/kernel-doc -v -none -Wall drivers/gpio/gpiolib* 2>&1 | grep -w warning | wc -l 67Fix these by adding Return sections. While at it, make sure all of Return sections use the same style.
Since there shouldn't be hard dependency to the first one, can you consider applying this one, so it unblocks me?
Thank you!
Signature · 2 lines
With Best Regards, Andy Shevchenko
Re: [PATCH v2 2/2] gpiolib: Update the kernel documentation - add Return sections
Quoted 11 lines · Andy Shevchenko
Quoted 5 lines · Andy Shevchenko
$ scripts/kernel-doc -v -none -Wall drivers/gpio/gpiolib* 2>&1 | grep -w warning | wc -l 67Fix these by adding Return sections. While at it, make sure all of Return sections use the same style.
Since there shouldn't be hard dependency to the first one, can you consider applying this one, so it unblocks me?
I'm not sure what the resolution is for % and HTML <font> tags in the end?
Bart
Re: [PATCH v2 2/2] gpiolib: Update the kernel documentation - add Return sections
Quoted 7 lines · Bartosz Golaszewski
Quoted 5 lines · Andy Shevchenko
Quoted 3 lines · Andy Shevchenko
$ scripts/kernel-doc -v -none -Wall drivers/gpio/gpiolib* 2>&1 | grep -w warning | wc -l 67
Quoted 7 lines
Quoted 5 lines
Quoted 2 lines
Fix these by adding Return sections. While at it, make sure all of Return sections use the same style.
Since there shouldn't be hard dependency to the first one, can you consider applying this one, so it unblocks me?
I'm not sure what the resolution is for % and HTML <font> tags in the end?
Most of the constants are without %, so less churn now is to drop %. If you think otherwise, please, fix it and I will rebase my patches later.
Signature · 2 lines
With Best Regards, Andy Shevchenko
Re: [PATCH v2 2/2] gpiolib: Update the kernel documentation - add Return sections
Quoted 12 lines · Andy Shevchenko
Quoted 10 lines · Bartosz Golaszewski
Quoted 8 lines · Andy Shevchenko
Quoted 5 lines · Andy Shevchenko
$ scripts/kernel-doc -v -none -Wall drivers/gpio/gpiolib* 2>&1 | grep -w warning | wc -l 67Fix these by adding Return sections. While at it, make sure all of Return sections use the same style.
Quoted 8 lines
Quoted 4 lines
Quoted 2 lines
Since there shouldn't be hard dependency to the first one, can you consider applying this one, so it unblocks me?
I'm not sure what the resolution is for % and HTML <font> tags in the end?
Most of the constants are without %, so less churn now is to drop %. If you think otherwise, please, fix it and I will rebase my patches later.
I'm not sure I get the logic of it. If the kernel-wide standard is to use %, then we should work towards using it across the GPIO code even if we do it a few lines at a time instead of going backwards just for consistency in drivers/gpio/, no? We don't need to fix everything now but if you're touching this code, then I'd go with %.
Also: what about the s/error-code/error code/g issue? While we should always say "active-low", I think error code looks better as two words.
Bart
Re: [PATCH v2 2/2] gpiolib: Update the kernel documentation - add Return sections
Quoted 21 lines · Bartosz Golaszewski
Quoted 10 lines · Andy Shevchenko
Quoted 9 lines · Bartosz Golaszewski
Quoted 7 lines · Andy Shevchenko
Quoted 5 lines · Andy Shevchenko
$ scripts/kernel-doc -v -none -Wall drivers/gpio/gpiolib* 2>&1 | grep -w warning | wc -l 67Fix these by adding Return sections. While at it, make sure all of Return sections use the same style.
Quoted 8 lines
Quoted 4 lines
Quoted 2 lines
Since there shouldn't be hard dependency to the first one, can you consider applying this one, so it unblocks me?
I'm not sure what the resolution is for % and HTML <font> tags in the end?
Most of the constants are without %, so less churn now is to drop %. If you think otherwise, please, fix it and I will rebase my patches later.
Quoted 8 lines
I'm not sure I get the logic of it. If the kernel-wide standard is to use %, then we should work towards using it across the GPIO code even if we do it a few lines at a time instead of going backwards just for consistency in
drivers/gpio/, no? We don't need to fix everything now but if you're touching this code, then I'd go with %.Also: what about the s/error-code/error code/g issue? While we should always say "active-low", I think error code looks better as two words.
I also have no much time for these details. :(
Let's drop this series then. Feel free to consider this as a problem report.
Signature · 2 lines
With Best Regards, Andy Shevchenko