Skip to content

Commit cbe4999

Browse files
Hans Verkuilmchehab
authored andcommitted
media: cec: core: avoid confusing "transmit timed out" message
If, when waiting for a transmit to finish, the wait is interrupted, then you might get a "transmit timed out" message, even though the transmit was interrupted and did not actually time out. Set transmit_in_progress_aborted to true if the wait_for_completion_killable() call was interrupted and ensure that the transmit is properly marked as ABORTED. Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Reported-by: Yang, Chenyuan <cy54@illinois.edu> Closes: https://lore.kernel.org/linux-media/PH7PR11MB57688E64ADE4FE82E658D86DA09EA@PH7PR11MB5768.namprd11.prod.outlook.com/ Fixes: 590a8e5 ("media: cec: abort if the current transmit was canceled") Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
1 parent 47c82aa commit cbe4999

1 file changed

Lines changed: 14 additions & 1 deletion

File tree

drivers/media/cec/core/cec-adap.c

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -490,6 +490,15 @@ int cec_thread_func(void *_adap)
490490
goto unlock;
491491
}
492492

493+
if (adap->transmit_in_progress &&
494+
adap->transmit_in_progress_aborted) {
495+
if (adap->transmitting)
496+
cec_data_cancel(adap->transmitting,
497+
CEC_TX_STATUS_ABORTED, 0);
498+
adap->transmit_in_progress = false;
499+
adap->transmit_in_progress_aborted = false;
500+
goto unlock;
501+
}
493502
if (adap->transmit_in_progress && timeout) {
494503
/*
495504
* If we timeout, then log that. Normally this does
@@ -771,6 +780,7 @@ int cec_transmit_msg_fh(struct cec_adapter *adap, struct cec_msg *msg,
771780
{
772781
struct cec_data *data;
773782
bool is_raw = msg_is_raw(msg);
783+
int err;
774784

775785
if (adap->devnode.unregistered)
776786
return -ENODEV;
@@ -935,10 +945,13 @@ int cec_transmit_msg_fh(struct cec_adapter *adap, struct cec_msg *msg,
935945
* Release the lock and wait, retake the lock afterwards.
936946
*/
937947
mutex_unlock(&adap->lock);
938-
wait_for_completion_killable(&data->c);
948+
err = wait_for_completion_killable(&data->c);
939949
cancel_delayed_work_sync(&data->work);
940950
mutex_lock(&adap->lock);
941951

952+
if (err)
953+
adap->transmit_in_progress_aborted = true;
954+
942955
/* Cancel the transmit if it was interrupted */
943956
if (!data->completed) {
944957
if (data->msg.tx_status & CEC_TX_STATUS_OK)

0 commit comments

Comments
 (0)