summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias Fend <matthias.fend@emfend.at>2024-07-23 08:09:08 +0200
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>2024-08-23 15:55:29 +0200
commit3f6a2f8768e91cdb69947cb589d0b3a09114be83 (patch)
treeec654d0e1f8595c57655db79369de9431f06f32b
parentMerge tag 'next-media-rkisp1-20240814' of git://git.kernel.org/pub/scm/linux/... (diff)
downloadlinux-3f6a2f8768e91cdb69947cb589d0b3a09114be83.tar.xz
linux-3f6a2f8768e91cdb69947cb589d0b3a09114be83.zip
media: imx-mipi-csis: avoid logging while holding spinlock
Refactor mipi_csis_log_counters() to prevent calling dev_info() while IRQs are disabled. This reduces crucial IRQs off time to a bare minimum. Signed-off-by: Matthias Fend <matthias.fend@emfend.at> Reviewed-by: Rui Miguel Silva <rmfrfs@gmail.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Link: https://lore.kernel.org/r/20240723060909.534584-1-matthias.fend@emfend.at Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
-rw-r--r--drivers/media/platform/nxp/imx-mipi-csis.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/drivers/media/platform/nxp/imx-mipi-csis.c b/drivers/media/platform/nxp/imx-mipi-csis.c
index b9729a8883d6..e0b1d3adda10 100644
--- a/drivers/media/platform/nxp/imx-mipi-csis.c
+++ b/drivers/media/platform/nxp/imx-mipi-csis.c
@@ -861,18 +861,21 @@ static void mipi_csis_log_counters(struct mipi_csis_device *csis, bool non_error
{
unsigned int num_events = non_errors ? MIPI_CSIS_NUM_EVENTS
: MIPI_CSIS_NUM_EVENTS - 8;
+ unsigned int counters[MIPI_CSIS_NUM_EVENTS];
unsigned long flags;
unsigned int i;
spin_lock_irqsave(&csis->slock, flags);
+ for (i = 0; i < num_events; ++i)
+ counters[i] = csis->events[i].counter;
+ spin_unlock_irqrestore(&csis->slock, flags);
for (i = 0; i < num_events; ++i) {
- if (csis->events[i].counter > 0 || csis->debug.enable)
+ if (counters[i] > 0 || csis->debug.enable)
dev_info(csis->dev, "%s events: %d\n",
csis->events[i].name,
- csis->events[i].counter);
+ counters[i]);
}
- spin_unlock_irqrestore(&csis->slock, flags);
}
static int mipi_csis_dump_regs(struct mipi_csis_device *csis)