OSDN Git Service

media: cec: improve transmit timeout logging
authorHans Verkuil <hans.verkuil@cisco.com>
Tue, 11 Jul 2017 06:30:34 +0000 (03:30 -0300)
committerMauro Carvalho Chehab <mchehab@s-opensource.com>
Tue, 18 Jul 2017 15:45:50 +0000 (12:45 -0300)
Kernel logging messes up the upcoming low-level CEC monitoring support
which is very time-sensitive. So change the debug level of this message
but keep a counter that is shown in the debugfs status log.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Reviewed-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
drivers/media/cec/cec-adap.c
include/media/cec.h

index a311c52..7bd4d7d 100644 (file)
@@ -394,13 +394,17 @@ int cec_thread_func(void *_adap)
 
                if (adap->transmitting && timeout) {
                        /*
-                        * If we timeout, then log that. This really shouldn't
-                        * happen and is an indication of a faulty CEC adapter
-                        * driver, or the CEC bus is in some weird state.
+                        * If we timeout, then log that. Normally this does
+                        * not happen and it is an indication of a faulty CEC
+                        * adapter driver, or the CEC bus is in some weird
+                        * state. On rare occasions it can happen if there is
+                        * so much traffic on the bus that the adapter was
+                        * unable to transmit for CEC_XFER_TIMEOUT_MS (2.1s).
                         */
-                       dprintk(0, "%s: message %*ph timed out!\n", __func__,
+                       dprintk(1, "%s: message %*ph timed out\n", __func__,
                                adap->transmitting->msg.len,
                                adap->transmitting->msg.msg);
+                       adap->tx_timeouts++;
                        /* Just give up on this. */
                        cec_data_cancel(adap->transmitting);
                        goto unlock;
@@ -1951,6 +1955,11 @@ int cec_adap_status(struct seq_file *file, void *priv)
        if (adap->monitor_all_cnt)
                seq_printf(file, "file handles in Monitor All mode: %u\n",
                           adap->monitor_all_cnt);
+       if (adap->tx_timeouts) {
+               seq_printf(file, "transmit timeouts: %u\n",
+                          adap->tx_timeouts);
+               adap->tx_timeouts = 0;
+       }
        data = adap->transmitting;
        if (data)
                seq_printf(file, "transmitting message: %*ph (reply: %02x, timeout: %ums)\n",
index 56643b2..e32b0e1 100644 (file)
@@ -174,6 +174,8 @@ struct cec_adapter {
        bool passthrough;
        struct cec_log_addrs log_addrs;
 
+       u32 tx_timeouts;
+
 #ifdef CONFIG_CEC_NOTIFIER
        struct cec_notifier *notifier;
 #endif