Skip to content

Commit 4398693

Browse files
committed
gpiolib: make struct comments into real kernel docs
We have several comments that start with '/**' but don't conform to the kernel doc standard. Add proper detailed descriptions for the affected definitions and move the docs from the forward declarations to the struct definitions where applicable. Reported-by: Randy Dunlap <rdunlap@infradead.org> Signed-off-by: Bartosz Golaszewski <brgl@bgdev.pl> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Tested-by: Randy Dunlap <rdunlap@infradead.org>
1 parent dec09a4 commit 4398693

2 files changed

Lines changed: 50 additions & 19 deletions

File tree

drivers/gpio/gpiolib.h

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,9 @@
3737
* or name of the IP component in a System on Chip.
3838
* @data: per-instance data assigned by the driver
3939
* @list: links gpio_device:s together for traversal
40+
* @notifier: used to notify subscribers about lines being requested, released
41+
* or reconfigured
42+
* @pin_ranges: range of pins served by the GPIO driver
4043
*
4144
* This state container holds most of the runtime variable data
4245
* for a GPIO device and can hold references and live on after the
@@ -72,6 +75,20 @@ struct gpio_device {
7275
/* gpio suffixes used for ACPI and device tree lookup */
7376
static __maybe_unused const char * const gpio_suffixes[] = { "gpios", "gpio" };
7477

78+
/**
79+
* struct gpio_array - Opaque descriptor for a structure of GPIO array attributes
80+
*
81+
* @desc: Array of pointers to the GPIO descriptors
82+
* @size: Number of elements in desc
83+
* @chip: Parent GPIO chip
84+
* @get_mask: Get mask used in fastpath
85+
* @set_mask: Set mask used in fastpath
86+
* @invert_mask: Invert mask used in fastpath
87+
*
88+
* This structure is attached to struct gpiod_descs obtained from
89+
* gpiod_get_array() and can be passed back to get/set array functions in order
90+
* to activate fast processing path if applicable.
91+
*/
7592
struct gpio_array {
7693
struct gpio_desc **desc;
7794
unsigned int size;
@@ -103,6 +120,23 @@ int gpiod_set_array_value_complex(bool raw, bool can_sleep,
103120
extern spinlock_t gpio_lock;
104121
extern struct list_head gpio_devices;
105122

123+
124+
/**
125+
* struct gpio_desc - Opaque descriptor for a GPIO
126+
*
127+
* @gdev: Pointer to the parent GPIO device
128+
* @flags: Binary descriptor flags
129+
* @label: Name of the consumer
130+
* @name: Line name
131+
* @hog: Pointer to the device node that hogs this line (if any)
132+
* @debounce_period_us: Debounce period in microseconds
133+
*
134+
* These are obtained using gpiod_get() and are preferable to the old
135+
* integer-based handles.
136+
*
137+
* Contrary to integers, a pointer to a &struct gpio_desc is guaranteed to be
138+
* valid until the GPIO is released.
139+
*/
106140
struct gpio_desc {
107141
struct gpio_device *gdev;
108142
unsigned long flags;

include/linux/gpio/consumer.h

Lines changed: 16 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -8,27 +8,16 @@
88
#include <linux/err.h>
99

1010
struct device;
11-
12-
/**
13-
* Opaque descriptor for a GPIO. These are obtained using gpiod_get() and are
14-
* preferable to the old integer-based handles.
15-
*
16-
* Contrary to integers, a pointer to a gpio_desc is guaranteed to be valid
17-
* until the GPIO is released.
18-
*/
1911
struct gpio_desc;
20-
21-
/**
22-
* Opaque descriptor for a structure of GPIO array attributes. This structure
23-
* is attached to struct gpiod_descs obtained from gpiod_get_array() and can be
24-
* passed back to get/set array functions in order to activate fast processing
25-
* path if applicable.
26-
*/
2712
struct gpio_array;
2813

2914
/**
30-
* Struct containing an array of descriptors that can be obtained using
31-
* gpiod_get_array().
15+
* struct gpio_descs - Struct containing an array of descriptors that can be
16+
* obtained using gpiod_get_array()
17+
*
18+
* @info: Pointer to the opaque gpio_array structure
19+
* @ndescs: Number of held descriptors
20+
* @desc: Array of pointers to GPIO descriptors
3221
*/
3322
struct gpio_descs {
3423
struct gpio_array *info;
@@ -43,8 +32,16 @@ struct gpio_descs {
4332
#define GPIOD_FLAGS_BIT_NONEXCLUSIVE BIT(4)
4433

4534
/**
46-
* Optional flags that can be passed to one of gpiod_* to configure direction
47-
* and output value. These values cannot be OR'd.
35+
* enum gpiod_flags - Optional flags that can be passed to one of gpiod_* to
36+
* configure direction and output value. These values
37+
* cannot be OR'd.
38+
*
39+
* @GPIOD_ASIS: Don't change anything
40+
* @GPIOD_IN: Set lines to input mode
41+
* @GPIOD_OUT_LOW: Set lines to output and drive them low
42+
* @GPIOD_OUT_HIGH: Set lines to output and drive them high
43+
* @GPIOD_OUT_LOW_OPEN_DRAIN: Set lines to open-drain output and drive them low
44+
* @GPIOD_OUT_HIGH_OPEN_DRAIN: Set lines to open-drain output and drive them high
4845
*/
4946
enum gpiod_flags {
5047
GPIOD_ASIS = 0,

0 commit comments

Comments
 (0)