]> git.baikalelectronics.ru Git - kernel.git/commitdiff
media: atomisp: reduce debug printk rate when IRQs are received
authorMauro Carvalho Chehab <mchehab+huawei@kernel.org>
Thu, 21 May 2020 07:05:11 +0000 (09:05 +0200)
committerMauro Carvalho Chehab <mchehab+huawei@kernel.org>
Thu, 11 Jun 2020 15:58:26 +0000 (17:58 +0200)
Currently, when an EOF IRQ is received, it generates two messages:

[   59.191893] atomisp-isp2 0000:00:03.0: irq:0x200000
[   59.191913] atomisp-isp2 0000:00:03.0: atomisp_isr EOF exp_id 142, asd 0

Flooding the dmesg with lots of messages per second. The same
pattern happens for all other IRQs.

Change the logic for printing just one message per IRQ and
rate-limit those, as, for debugging purposes, it is usually
interesting to know that IRQs are being received, but not
displaying every single one.

Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
drivers/staging/media/atomisp/pci/atomisp_cmd.c

index 5be690f876c11d326bf95f57fbc9a450ddd4d727..1e22cb70ac1b0d81ebd98d5bd2abff81dfaa9e3b 100644 (file)
@@ -526,8 +526,6 @@ irqreturn_t atomisp_isr(int irq, void *dev)
                return IRQ_NONE;
        }
 
-       dev_dbg(isp->dev, "irq:0x%x\n", irq_infos);
-
        clear_irq_reg(isp);
 
        if (!atomisp_streaming_count(isp) && !atomisp_is_acc_enabled(isp))
@@ -564,8 +562,12 @@ irqreturn_t atomisp_isr(int irq, void *dev)
                                   atomic_read(&asd->sequence_temp));
        }
 
-       if (irq_infos & CSS_IRQ_INFO_CSS_RECEIVER_SOF)
+       if (irq_infos & CSS_IRQ_INFO_CSS_RECEIVER_SOF) {
+               dev_dbg_ratelimited(isp->dev,
+                                   "irq:0x%x (CSS_IRQ_INFO_CSS_RECEIVER_SOF)\n",
+                                   irq_infos);
                irq_infos &= ~CSS_IRQ_INFO_CSS_RECEIVER_SOF;
+       }
 
        if ((irq_infos & CSS_IRQ_INFO_INPUT_SYSTEM_ERROR) ||
            (irq_infos & CSS_IRQ_INFO_IF_ERROR)) {
@@ -587,14 +589,16 @@ irqreturn_t atomisp_isr(int irq, void *dev)
                        /* EOF Event does not have the css_pipe returned */
                        asd = __get_asd_from_port(isp, eof_event.event.port);
                        if (!asd) {
-                               dev_err(isp->dev, "%s:no subdev.event:%d",  __func__,
-                                       eof_event.event.type);
+                               dev_err(isp->dev, "%s:no subdev.event:%d",
+                                       __func__, eof_event.event.type);
                                continue;
                        }
 
                        atomisp_eof_event(asd, eof_event.event.exp_id);
-                       dev_dbg(isp->dev, "%s EOF exp_id %d, asd %d\n",
-                               __func__, eof_event.event.exp_id, asd->index);
+                       dev_dbg_ratelimited(isp->dev,
+                                           "%s EOF exp_id %d, asd %d\n",
+                                           __func__, eof_event.event.exp_id,
+                                           asd->index);
                }
 
                irq_infos &= ~IA_CSS_IRQ_INFO_ISYS_EVENTS_READY;
@@ -604,11 +608,16 @@ irqreturn_t atomisp_isr(int irq, void *dev)
 
        spin_unlock_irqrestore(&isp->lock, flags);
 
+       dev_dbg_ratelimited(isp->dev, "irq:0x%x\n", irq_infos);
+
        return IRQ_WAKE_THREAD;
 
 out_nowake:
        spin_unlock_irqrestore(&isp->lock, flags);
 
+       if (irq_infos)
+               dev_dbg_ratelimited(isp->dev, "irq:0x%x\n", irq_infos);
+
        return IRQ_HANDLED;
 }