diff options
author | Hans Verkuil <hverkuil-cisco@xs4all.nl> | 2022-03-09 10:55:43 +0000 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@kernel.org> | 2022-04-24 07:40:13 +0100 |
commit | 567f882a401346779d05a90beb8f21865ebdd398 (patch) | |
tree | 6057ba90e62701ebc69ad211d848a77df1544dfd /include/uapi/linux/cec.h | |
parent | f9d0ecbf56f4b90745a6adc5b59281ad8f70ab54 (diff) | |
download | lwn-567f882a401346779d05a90beb8f21865ebdd398.tar.gz lwn-567f882a401346779d05a90beb8f21865ebdd398.zip |
media: cec.h: add cec_msg_recv_is_rx/tx_result helpers
These two helper functions return true if the received message
contains the result of a previous non-blocking transmit. Either
the tx_status result (cec_msg_recv_is_tx_result) of the transmit,
or the rx_status result (cec_msg_recv_is_rx_result) of the reply
to the original transmit.
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
Diffstat (limited to 'include/uapi/linux/cec.h')
-rw-r--r-- | include/uapi/linux/cec.h | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/include/uapi/linux/cec.h b/include/uapi/linux/cec.h index de936f5e446d..1d48da926216 100644 --- a/include/uapi/linux/cec.h +++ b/include/uapi/linux/cec.h @@ -142,6 +142,26 @@ static inline void cec_msg_set_reply_to(struct cec_msg *msg, msg->reply = msg->timeout = 0; } +/** + * cec_msg_recv_is_tx_result - return true if this message contains the + * result of an earlier non-blocking transmit + * @msg: the message structure from CEC_RECEIVE + */ +static inline int cec_msg_recv_is_tx_result(const struct cec_msg *msg) +{ + return msg->sequence && msg->tx_status && !msg->rx_status; +} + +/** + * cec_msg_recv_is_rx_result - return true if this message contains the + * reply of an earlier non-blocking transmit + * @msg: the message structure from CEC_RECEIVE + */ +static inline int cec_msg_recv_is_rx_result(const struct cec_msg *msg) +{ + return msg->sequence && !msg->tx_status && msg->rx_status; +} + /* cec_msg flags field */ #define CEC_MSG_FL_REPLY_TO_FOLLOWERS (1 << 0) #define CEC_MSG_FL_RAW (1 << 1) |