History

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.

Hans Verkuil committed 4 years ago

Commit 567f8821 parent f9d0ecb1 file · +20 −0Browse files

Showing the changes to include/uapi (1 of 1 file). Show all

Unified · Split

include/uapi/linux/cec.h+20−0
@@ -142,6 +142,26 @@ static inline void cec_msg_set_reply_to(struct cec_msg *msg, · 141 unmodified lines
142142 msg->reply = msg->timeout = 0;
143143 }
144144
145+/**
146+ * cec_msg_recv_is_tx_result - return true if this message contains the
147+ * result of an earlier non-blocking transmit
148+ * @msg: the message structure from CEC_RECEIVE
149+ */
150+static inline int cec_msg_recv_is_tx_result(const struct cec_msg *msg)
151+{
152+ return msg->sequence && msg->tx_status && !msg->rx_status;
153+}
154+
155+/**
156+ * cec_msg_recv_is_rx_result - return true if this message contains the
157+ * reply of an earlier non-blocking transmit
158+ * @msg: the message structure from CEC_RECEIVE
159+ */
160+static inline int cec_msg_recv_is_rx_result(const struct cec_msg *msg)
161+{
162+ return msg->sequence && !msg->tx_status && msg->rx_status;
163+}
164+
145165 /* cec_msg flags field */
146166 #define CEC_MSG_FL_REPLY_TO_FOLLOWERS (1 << 0)
147167 #define CEC_MSG_FL_RAW (1 << 1)