aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/include/media
diff options
context:
space:
mode:
authorHans Verkuil <hverkuil-cisco@xs4all.nl>2020-04-21 11:23:41 +0200
committerMauro Carvalho Chehab <mchehab+huawei@kernel.org>2020-04-29 12:04:38 +0200
commite5ad7db4b2f35aaed796669b47e24c6d79cab3d0 (patch)
treed5fc2cf22e0ddb0b89bfe34996f012a204bb58d1 /include/media
parentmedia: vidioc-reqbufs/create-bufs.rst: fix typo (diff)
downloadwireguard-linux-e5ad7db4b2f35aaed796669b47e24c6d79cab3d0.tar.xz
wireguard-linux-e5ad7db4b2f35aaed796669b47e24c6d79cab3d0.zip
media: cec-gpio: handle gpiod_get_value errors correctly
gpiod_get_value() can return negative values if an error occurs. In several places this error code was ignored. Ensure that errors codes are handled correctly throughout the CEC pin framework and CEC pin drivers. The return code of the cec_pin_ops read() callback had to be changed from 'bool' to 'int', which mean the prototype of that callback in the sun4i drm driver also had to be changed. Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Reported-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Diffstat (limited to 'include/media')
-rw-r--r--include/media/cec-pin.h16
1 files changed, 7 insertions, 9 deletions
diff --git a/include/media/cec-pin.h b/include/media/cec-pin.h
index 88c8b016eb09..483bc4769fe9 100644
--- a/include/media/cec-pin.h
+++ b/include/media/cec-pin.h
@@ -13,7 +13,8 @@
/**
* struct cec_pin_ops - low-level CEC pin operations
- * @read: read the CEC pin. Return true if high, false if low.
+ * @read: read the CEC pin. Returns > 0 if high, 0 if low, or an error
+ * if negative.
* @low: drive the CEC pin low.
* @high: stop driving the CEC pin. The pull-up will drive the pin
* high, unless someone else is driving the pin low.
@@ -22,13 +23,10 @@
* @free: optional. Free any allocated resources. Called when the
* adapter is deleted.
* @status: optional, log status information.
- * @read_hpd: read the HPD pin. Return true if high, false if low or
- * an error if negative. If NULL or -ENOTTY is returned,
- * then this is not supported.
- * @read_5v: read the 5V pin. Return true if high, false if low or
- * an error if negative. If NULL or -ENOTTY is returned,
- * then this is not supported.
- *
+ * @read_hpd: optional. Read the HPD pin. Returns > 0 if high, 0 if low or
+ * an error if negative.
+ * @read_5v: optional. Read the 5V pin. Returns > 0 if high, 0 if low or
+ * an error if negative.
* @received: optional. High-level CEC message callback. Allows the driver
* to process CEC messages.
*
@@ -36,7 +34,7 @@
* cec pin framework to manipulate the CEC pin.
*/
struct cec_pin_ops {
- bool (*read)(struct cec_adapter *adap);
+ int (*read)(struct cec_adapter *adap);
void (*low)(struct cec_adapter *adap);
void (*high)(struct cec_adapter *adap);
bool (*enable_irq)(struct cec_adapter *adap);