Skip to content

Commit

Permalink
media: imx: imx7_mipi_csis: Fix logging of only error event counters
Browse files Browse the repository at this point in the history
[ Upstream commit d2fcc9c ]

The mipi_csis_events array ends with 6 non-error events, not 4. Update
mipi_csis_log_counters() accordingly. While at it, log event counters in
forward order, as there's no reason to log them backward.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Rui Miguel Silva <rmfrfs@gmail.com>
Reviewed-by: Frieder Schrempf <frieder.schrempf@kontron.de>
Tested-by: Frieder Schrempf <frieder.schrempf@kontron.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
pinchartl authored and gregkh committed Jul 14, 2021
1 parent 6a8e205 commit d7a7519
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions drivers/staging/media/imx/imx7-mipi-csis.c
Original file line number Diff line number Diff line change
Expand Up @@ -597,13 +597,15 @@ static void mipi_csis_clear_counters(struct csi_state *state)

static void mipi_csis_log_counters(struct csi_state *state, bool non_errors)
{
int i = non_errors ? MIPI_CSIS_NUM_EVENTS : MIPI_CSIS_NUM_EVENTS - 4;
unsigned int num_events = non_errors ? MIPI_CSIS_NUM_EVENTS
: MIPI_CSIS_NUM_EVENTS - 6;
struct device *dev = &state->pdev->dev;
unsigned long flags;
unsigned int i;

spin_lock_irqsave(&state->slock, flags);

for (i--; i >= 0; i--) {
for (i = 0; i < num_events; ++i) {
if (state->events[i].counter > 0 || state->debug)
dev_info(dev, "%s events: %d\n", state->events[i].name,
state->events[i].counter);
Expand Down

0 comments on commit d7a7519

Please sign in to comment.