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.
Showing the changes to include/uapi (1 of 1 file). Show all
Unified · Split
| @@ -142,6 +142,26 @@ static inline void cec_msg_set_reply_to(struct cec_msg *msg, · 141 unmodified lines | ||
| 142 | 142 | msg->reply = msg->timeout = 0; |
| 143 | 143 | } |
| 144 | 144 | |
| 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 | + | |
| 145 | 165 | /* cec_msg flags field */ |
| 146 | 166 | #define CEC_MSG_FL_REPLY_TO_FOLLOWERS (1 << 0) |
| 147 | 167 | #define CEC_MSG_FL_RAW (1 << 1) |