Commit 2613cc6f authored by Hans Verkuil's avatar Hans Verkuil Committed by Mauro Carvalho Chehab

[media] stih-cec/vivid/pulse8/rainshadow: use cec_transmit_attempt_done

Use the helper function cec_transmit_attempt_done instead of
cec_transmit_done to simplify the code.
Signed-off-by: default avatarHans Verkuil <hans.verkuil@cisco.com>
Acked-by: default avatarBenjamin Gaignard <benjamin.gaignard@linaro.org>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@s-opensource.com>
parent c94cdc1e
......@@ -226,22 +226,21 @@ static int stih_cec_adap_transmit(struct cec_adapter *adap, u8 attempts,
static void stih_tx_done(struct stih_cec *cec, u32 status)
{
if (status & CEC_TX_ERROR) {
cec_transmit_done(cec->adap, CEC_TX_STATUS_ERROR, 0, 0, 0, 1);
cec_transmit_attempt_done(cec->adap, CEC_TX_STATUS_ERROR);
return;
}
if (status & CEC_TX_ARB_ERROR) {
cec_transmit_done(cec->adap,
CEC_TX_STATUS_ARB_LOST, 1, 0, 0, 0);
cec_transmit_attempt_done(cec->adap, CEC_TX_STATUS_ARB_LOST);
return;
}
if (!(status & CEC_TX_ACK_GET_STS)) {
cec_transmit_done(cec->adap, CEC_TX_STATUS_NACK, 0, 1, 0, 0);
cec_transmit_attempt_done(cec->adap, CEC_TX_STATUS_NACK);
return;
}
cec_transmit_done(cec->adap, CEC_TX_STATUS_OK, 0, 0, 0, 0);
cec_transmit_attempt_done(cec->adap, CEC_TX_STATUS_OK);
}
static void stih_rx_done(struct stih_cec *cec, u32 status)
......
......@@ -34,7 +34,7 @@ void vivid_cec_bus_free_work(struct vivid_dev *dev)
cancel_delayed_work_sync(&cw->work);
spin_lock(&dev->cec_slock);
list_del(&cw->list);
cec_transmit_done(cw->adap, CEC_TX_STATUS_LOW_DRIVE, 0, 0, 1, 0);
cec_transmit_attempt_done(cw->adap, CEC_TX_STATUS_LOW_DRIVE);
kfree(cw);
}
spin_unlock(&dev->cec_slock);
......@@ -84,7 +84,7 @@ static void vivid_cec_xfer_done_worker(struct work_struct *work)
dev->cec_xfer_start_jiffies = 0;
list_del(&cw->list);
spin_unlock(&dev->cec_slock);
cec_transmit_done(cw->adap, cw->tx_status, 0, valid_dest ? 0 : 1, 0, 0);
cec_transmit_attempt_done(cw->adap, cw->tx_status);
/* Broadcast message */
if (adap != dev->cec_rx_adap)
......@@ -105,7 +105,7 @@ static void vivid_cec_xfer_try_worker(struct work_struct *work)
if (dev->cec_xfer_time_jiffies) {
list_del(&cw->list);
spin_unlock(&dev->cec_slock);
cec_transmit_done(cw->adap, CEC_TX_STATUS_ARB_LOST, 1, 0, 0, 0);
cec_transmit_attempt_done(cw->adap, CEC_TX_STATUS_ARB_LOST);
kfree(cw);
} else {
INIT_DELAYED_WORK(&cw->work, vivid_cec_xfer_done_worker);
......
......@@ -148,18 +148,15 @@ static void pulse8_irq_work_handler(struct work_struct *work)
cec_received_msg(pulse8->adap, &pulse8->rx_msg);
break;
case MSGCODE_TRANSMIT_SUCCEEDED:
cec_transmit_done(pulse8->adap, CEC_TX_STATUS_OK,
0, 0, 0, 0);
cec_transmit_attempt_done(pulse8->adap, CEC_TX_STATUS_OK);
break;
case MSGCODE_TRANSMIT_FAILED_ACK:
cec_transmit_done(pulse8->adap, CEC_TX_STATUS_NACK,
0, 1, 0, 0);
cec_transmit_attempt_done(pulse8->adap, CEC_TX_STATUS_NACK);
break;
case MSGCODE_TRANSMIT_FAILED_LINE:
case MSGCODE_TRANSMIT_FAILED_TIMEOUT_DATA:
case MSGCODE_TRANSMIT_FAILED_TIMEOUT_LINE:
cec_transmit_done(pulse8->adap, CEC_TX_STATUS_ERROR,
0, 0, 0, 1);
cec_transmit_attempt_done(pulse8->adap, CEC_TX_STATUS_ERROR);
break;
}
}
......
......@@ -98,16 +98,13 @@ static void rain_process_msg(struct rain *rain)
switch (stat) {
case 1:
cec_transmit_done(rain->adap, CEC_TX_STATUS_OK,
0, 0, 0, 0);
cec_transmit_attempt_done(rain->adap, CEC_TX_STATUS_OK);
break;
case 2:
cec_transmit_done(rain->adap, CEC_TX_STATUS_NACK,
0, 1, 0, 0);
cec_transmit_attempt_done(rain->adap, CEC_TX_STATUS_NACK);
break;
default:
cec_transmit_done(rain->adap, CEC_TX_STATUS_LOW_DRIVE,
0, 0, 0, 1);
cec_transmit_attempt_done(rain->adap, CEC_TX_STATUS_LOW_DRIVE);
break;
}
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment