diff options
author | Hans Verkuil <hans.verkuil@cisco.com> | 2018-05-22 07:33:13 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab+samsung@kernel.org> | 2018-05-28 16:25:25 -0400 |
commit | 736781584931f4069c5a9f09af50490c70bd26a7 (patch) | |
tree | 1427cdb4b75617d8f2d01b217463b5cd9f6fd3e8 /drivers/media | |
parent | 4ba610c8dc1414562b39db68d16a9d8b326c7ee0 (diff) | |
download | linux-736781584931f4069c5a9f09af50490c70bd26a7.tar.gz linux-736781584931f4069c5a9f09af50490c70bd26a7.tar.bz2 linux-736781584931f4069c5a9f09af50490c70bd26a7.zip |
media: cec: fix wrong tx/rx_status values when canceling a msg
When a message was canceled it could return tx_status with
both OK and MAX_RETRIES set, which is illegal.
If a canceled message was waiting for a reply, then rx_status
wasn't updated, so set that as well.
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Diffstat (limited to 'drivers/media')
-rw-r--r-- | drivers/media/cec/cec-adap.c | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/drivers/media/cec/cec-adap.c b/drivers/media/cec/cec-adap.c index 002ed4c90371..b7fad0ec5710 100644 --- a/drivers/media/cec/cec-adap.c +++ b/drivers/media/cec/cec-adap.c @@ -339,12 +339,19 @@ static void cec_data_cancel(struct cec_data *data) data->adap->transmit_queue_sz--; } - /* Mark it as an error */ - data->msg.tx_ts = ktime_get_ns(); - data->msg.tx_status |= CEC_TX_STATUS_ERROR | - CEC_TX_STATUS_MAX_RETRIES; - data->msg.tx_error_cnt++; - data->attempts = 0; + if (data->msg.tx_status & CEC_TX_STATUS_OK) { + /* Mark the canceled RX as a timeout */ + data->msg.rx_ts = ktime_get_ns(); + data->msg.rx_status = CEC_RX_STATUS_TIMEOUT; + } else { + /* Mark the canceled TX as an error */ + data->msg.tx_ts = ktime_get_ns(); + data->msg.tx_status |= CEC_TX_STATUS_ERROR | + CEC_TX_STATUS_MAX_RETRIES; + data->msg.tx_error_cnt++; + data->attempts = 0; + } + /* Queue transmitted message for monitoring purposes */ cec_queue_msg_monitor(data->adap, &data->msg, 1); |