aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/include/linux/gpio
diff options
context:
space:
mode:
authorBartosz Golaszewski <bartosz.golaszewski@linaro.org>2024-01-25 09:35:07 +0100
committerBartosz Golaszewski <bartosz.golaszewski@linaro.org>2024-01-29 11:45:49 +0100
commit6933ba529d06afdd3faf5501855e410b46b77160 (patch)
treec1cd919e34933f98ede5577a4016af050a658957 /include/linux/gpio
parentgpio: unexport GPIO irq domain functions only used internally (diff)
downloadwireguard-linux-6933ba529d06afdd3faf5501855e410b46b77160.tar.xz
wireguard-linux-6933ba529d06afdd3faf5501855e410b46b77160.zip
gpio: improve the API contract for setting direction
If a GPIO driver returns a positive integer from one of the direction setter callbacks, we'll end up propagating it to user-space. Whether we should sanitize the values returned by callbacks is a different question but let's first improve the documentation and fortify the contract with GPIO providers. Reported-by: José Guilherme de Castro Rodrigues <joseguilhermebh@hotmail.com> Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org> Reviewed-by: Kent Gibson <warthog618@gmail.com>
Diffstat (limited to 'include/linux/gpio')
-rw-r--r--include/linux/gpio/driver.h10
1 files changed, 6 insertions, 4 deletions
diff --git a/include/linux/gpio/driver.h b/include/linux/gpio/driver.h
index 363d06c7b637..3a37d058cfcf 100644
--- a/include/linux/gpio/driver.h
+++ b/include/linux/gpio/driver.h
@@ -335,10 +335,12 @@ struct gpio_irq_chip {
* (same as GPIO_LINE_DIRECTION_OUT / GPIO_LINE_DIRECTION_IN),
* or negative error. It is recommended to always implement this
* function, even on input-only or output-only gpio chips.
- * @direction_input: configures signal "offset" as input, or returns error
- * This can be omitted on input-only or output-only gpio chips.
- * @direction_output: configures signal "offset" as output, or returns error
- * This can be omitted on input-only or output-only gpio chips.
+ * @direction_input: configures signal "offset" as input, returns 0 on success
+ * or a negative error number. This can be omitted on input-only or
+ * output-only gpio chips.
+ * @direction_output: configures signal "offset" as output, returns 0 on
+ * success or a negative error number. This can be omitted on input-only
+ * or output-only gpio chips.
* @get: returns value for signal "offset", 0=low, 1=high, or negative error
* @get_multiple: reads values for multiple signals defined by "mask" and
* stores them in "bits", returns 0 on success or negative error