diff options
author | Hans Verkuil <hans.verkuil@cisco.com> | 2016-07-16 09:44:13 -0300 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@s-opensource.com> | 2016-07-19 13:22:17 -0300 |
commit | 40df3a7e586df59190547fe0e7d9928da735eada (patch) | |
tree | 3fa7f354c935863fb0a516f6507ea67d5c2bcd0c /drivers | |
parent | e883b4d02670ae83ab24e9af969de1af756959f8 (diff) |
[media] cec: clear all status fields before transmit and always fill in sequence
Before transmitting a message clear all status fields and always fill
in the sequence number. Make sure the sequence number is never 0.
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/staging/media/cec/cec-adap.c | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/drivers/staging/media/cec/cec-adap.c b/drivers/staging/media/cec/cec-adap.c index 4d86a6c9258f..2b34c0f8929a 100644 --- a/drivers/staging/media/cec/cec-adap.c +++ b/drivers/staging/media/cec/cec-adap.c @@ -574,6 +574,19 @@ int cec_transmit_msg_fh(struct cec_adapter *adap, struct cec_msg *msg, unsigned int timeout; int res = 0; + msg->rx_ts = 0; + msg->tx_ts = 0; + msg->rx_status = 0; + msg->tx_status = 0; + msg->tx_arb_lost_cnt = 0; + msg->tx_nack_cnt = 0; + msg->tx_low_drive_cnt = 0; + msg->tx_error_cnt = 0; + msg->flags = 0; + msg->sequence = ++adap->sequence; + if (!msg->sequence) + msg->sequence = ++adap->sequence; + if (msg->reply && msg->timeout == 0) { /* Make sure the timeout isn't 0. */ msg->timeout = 1000; @@ -640,14 +653,6 @@ int cec_transmit_msg_fh(struct cec_adapter *adap, struct cec_msg *msg, dprintk(2, "cec_transmit_msg: %*ph%s\n", msg->len, msg->msg, !block ? " (nb)" : ""); - msg->rx_ts = 0; - msg->tx_ts = 0; - msg->rx_status = 0; - msg->tx_status = 0; - msg->tx_arb_lost_cnt = 0; - msg->tx_nack_cnt = 0; - msg->tx_low_drive_cnt = 0; - msg->tx_error_cnt = 0; data->msg = *msg; data->fh = fh; data->adap = adap; @@ -673,7 +678,6 @@ int cec_transmit_msg_fh(struct cec_adapter *adap, struct cec_msg *msg, init_completion(&data->c); INIT_DELAYED_WORK(&data->work, cec_wait_timeout); - data->msg.sequence = adap->sequence++; if (fh) list_add_tail(&data->xfer_list, &fh->xfer_list); list_add_tail(&data->list, &adap->transmit_queue); |