@@ -84,7 +84,12 @@ static inline void desc_set_label(struct gpio_desc *d, const char *label)
8484}
8585
8686/**
87- * Convert a GPIO number to its descriptor
87+ * gpio_to_desc - Convert a GPIO number to its descriptor
88+ * @gpio: global GPIO number
89+ *
90+ * Returns:
91+ * The GPIO descriptor associated with the given GPIO, or %NULL if no GPIO
92+ * with the given number exists in the system.
8893 */
8994struct gpio_desc * gpio_to_desc (unsigned gpio )
9095{
@@ -111,7 +116,14 @@ struct gpio_desc *gpio_to_desc(unsigned gpio)
111116EXPORT_SYMBOL_GPL (gpio_to_desc );
112117
113118/**
114- * Get the GPIO descriptor corresponding to the given hw number for this chip.
119+ * gpiochip_get_desc - get the GPIO descriptor corresponding to the given
120+ * hardware number for this chip
121+ * @chip: GPIO chip
122+ * @hwnum: hardware number of the GPIO for this chip
123+ *
124+ * Returns:
125+ * A pointer to the GPIO descriptor or %ERR_PTR(-EINVAL) if no GPIO exists
126+ * in the given chip for the specified hardware number.
115127 */
116128struct gpio_desc * gpiochip_get_desc (struct gpio_chip * chip ,
117129 u16 hwnum )
@@ -125,9 +137,14 @@ struct gpio_desc *gpiochip_get_desc(struct gpio_chip *chip,
125137}
126138
127139/**
128- * Convert a GPIO descriptor to the integer namespace.
140+ * desc_to_gpio - convert a GPIO descriptor to the integer namespace
141+ * @desc: GPIO descriptor
142+ *
129143 * This should disappear in the future but is needed since we still
130- * use GPIO numbers for error messages and sysfs nodes
144+ * use GPIO numbers for error messages and sysfs nodes.
145+ *
146+ * Returns:
147+ * The global GPIO number for the GPIO specified by its descriptor.
131148 */
132149int desc_to_gpio (const struct gpio_desc * desc )
133150{
@@ -254,7 +271,7 @@ static int gpiodev_add_to_list(struct gpio_device *gdev)
254271 return - EBUSY ;
255272}
256273
257- /**
274+ /*
258275 * Convert a GPIO name to its descriptor
259276 */
260277static struct gpio_desc * gpio_name_to_desc (const char * const name )
@@ -878,7 +895,7 @@ static int lineevent_create(struct gpio_device *gdev, void __user *ip)
878895 return ret ;
879896}
880897
881- /**
898+ /*
882899 * gpio_ioctl() - ioctl handler for the GPIO chardev
883900 */
884901static long gpio_ioctl (struct file * filp , unsigned int cmd , unsigned long arg )
@@ -1077,11 +1094,9 @@ static void gpiochip_setup_devs(void)
10771094/**
10781095 * gpiochip_add_data() - register a gpio_chip
10791096 * @chip: the chip to register, with chip->base initialized
1080- * Context: potentially before irqs will work
1097+ * @data: driver-private data associated with this chip
10811098 *
1082- * Returns a negative errno if the chip can't be registered, such as
1083- * because the chip->base is invalid or already associated with a
1084- * different chip. Otherwise it returns zero as a success code.
1099+ * Context: potentially before irqs will work
10851100 *
10861101 * When gpiochip_add_data() is called very early during boot, so that GPIOs
10871102 * can be freely used, the chip->parent device must be registered before
@@ -1093,6 +1108,11 @@ static void gpiochip_setup_devs(void)
10931108 *
10941109 * If chip->base is negative, this requests dynamic assignment of
10951110 * a range of valid GPIOs.
1111+ *
1112+ * Returns:
1113+ * A negative errno if the chip can't be registered, such as because the
1114+ * chip->base is invalid or already associated with a different chip.
1115+ * Otherwise it returns zero as a success code.
10961116 */
10971117int gpiochip_add_data (struct gpio_chip * chip , void * data )
10981118{
@@ -1298,6 +1318,10 @@ EXPORT_SYMBOL_GPL(gpiochip_add_data);
12981318
12991319/**
13001320 * gpiochip_get_data() - get per-subdriver data for the chip
1321+ * @chip: GPIO chip
1322+ *
1323+ * Returns:
1324+ * The per-subdriver data for the chip.
13011325 */
13021326void * gpiochip_get_data (struct gpio_chip * chip )
13031327{
@@ -1381,13 +1405,16 @@ static int devm_gpio_chip_match(struct device *dev, void *res, void *data)
13811405 * devm_gpiochip_add_data() - Resource manager piochip_add_data()
13821406 * @dev: the device pointer on which irq_chip belongs to.
13831407 * @chip: the chip to register, with chip->base initialized
1384- * Context: potentially before irqs will work
1408+ * @data: driver-private data associated with this chip
13851409 *
1386- * Returns a negative errno if the chip can't be registered, such as
1387- * because the chip->base is invalid or already associated with a
1388- * different chip. Otherwise it returns zero as a success code.
1410+ * Context: potentially before irqs will work
13891411 *
13901412 * The gpio chip automatically be released when the device is unbound.
1413+ *
1414+ * Returns:
1415+ * A negative errno if the chip can't be registered, such as because the
1416+ * chip->base is invalid or already associated with a different chip.
1417+ * Otherwise it returns zero as a success code.
13911418 */
13921419int devm_gpiochip_add_data (struct device * dev , struct gpio_chip * chip ,
13931420 void * data )
@@ -1433,7 +1460,7 @@ EXPORT_SYMBOL_GPL(devm_gpiochip_remove);
14331460/**
14341461 * gpiochip_find() - iterator for locating a specific gpio_chip
14351462 * @data: data to pass to match function
1436- * @callback : Callback function to check gpio_chip
1463+ * @match : Callback function to check gpio_chip
14371464 *
14381465 * Similar to bus_find_device. It returns a reference to a gpio_chip as
14391466 * determined by a user supplied @match callback. The callback should return
@@ -1924,11 +1951,14 @@ EXPORT_SYMBOL_GPL(gpiochip_add_pingroup_range);
19241951/**
19251952 * gpiochip_add_pin_range() - add a range for GPIO <-> pin mapping
19261953 * @chip: the gpiochip to add the range for
1927- * @pinctrl_name : the dev_name() of the pin controller to map to
1954+ * @pinctl_name : the dev_name() of the pin controller to map to
19281955 * @gpio_offset: the start offset in the current gpio_chip number space
19291956 * @pin_offset: the start offset in the pin controller number space
19301957 * @npins: the number of pins from the offset of each pin space (GPIO and
19311958 * pin controller) to accumulate in this range
1959+ *
1960+ * Returns:
1961+ * 0 on success, or a negative error-code on failure.
19321962 */
19331963int gpiochip_add_pin_range (struct gpio_chip * chip , const char * pinctl_name ,
19341964 unsigned int gpio_offset , unsigned int pin_offset ,
@@ -2173,14 +2203,19 @@ EXPORT_SYMBOL_GPL(gpiochip_is_requested);
21732203
21742204/**
21752205 * gpiochip_request_own_desc - Allow GPIO chip to request its own descriptor
2176- * @desc: GPIO descriptor to request
2206+ * @chip: GPIO chip
2207+ * @hwnum: hardware number of the GPIO for which to request the descriptor
21772208 * @label: label for the GPIO
21782209 *
21792210 * Function allows GPIO chip drivers to request and use their own GPIO
21802211 * descriptors via gpiolib API. Difference to gpiod_request() is that this
21812212 * function will not increase reference count of the GPIO chip module. This
21822213 * allows the GPIO chip module to be unloaded as needed (we assume that the
21832214 * GPIO chip driver handles freeing the GPIOs it has requested).
2215+ *
2216+ * Returns:
2217+ * A pointer to the GPIO descriptor, or an ERR_PTR()-encoded negative error
2218+ * code on failure.
21842219 */
21852220struct gpio_desc * gpiochip_request_own_desc (struct gpio_chip * chip , u16 hwnum ,
21862221 const char * label )
@@ -2362,12 +2397,13 @@ int gpiod_direction_output(struct gpio_desc *desc, int value)
23622397EXPORT_SYMBOL_GPL (gpiod_direction_output );
23632398
23642399/**
2365- * gpiod_set_debounce - sets @debounce time for a @gpio
2366- * @gpio: the gpio to set debounce time
2367- * @debounce: debounce time is microseconds
2400+ * gpiod_set_debounce - sets @debounce time for a GPIO
2401+ * @desc: descriptor of the GPIO for which to set debounce time
2402+ * @debounce: debounce time in microseconds
23682403 *
2369- * returns -ENOTSUPP if the controller does not support setting
2370- * debounce.
2404+ * Returns:
2405+ * 0 on success, %-ENOTSUPP if the controller doesn't support setting the
2406+ * debounce time.
23712407 */
23722408int gpiod_set_debounce (struct gpio_desc * desc , unsigned debounce )
23732409{
@@ -3316,6 +3352,7 @@ EXPORT_SYMBOL_GPL(gpiod_get_index);
33163352 * @propname: name of the firmware property representing the GPIO
33173353 * @index: index of the GPIO to obtain in the consumer
33183354 * @dflags: GPIO initialization flags
3355+ * @label: label to attach to the requested GPIO
33193356 *
33203357 * This function can be used for drivers that get their configuration
33213358 * from firmware.
@@ -3324,6 +3361,7 @@ EXPORT_SYMBOL_GPL(gpiod_get_index);
33243361 * underlying firmware interface and then makes sure that the GPIO
33253362 * descriptor is requested before it is returned to the caller.
33263363 *
3364+ * Returns:
33273365 * On successful request the GPIO pin is configured in accordance with
33283366 * provided @dflags.
33293367 *
0 commit comments