All of lore.kernel.org
 help / color / mirror / Atom feed
From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: linux-media@vger.kernel.org
Cc: linux-rockchip@lists.infradead.org,
	Dafna Hirschfeld <dafna@fastmail.com>,
	Heiko Stuebner <heiko@sntech.de>,
	Paul Elder <paul.elder@ideasonboard.com>,
	Tomasz Figa <tfiga@google.com>,
	Ricardo Ribalda <ribalda@chromium.org>
Subject: [PATCH v4.1 18/21] media: rkisp1: debug: Update max register name length
Date: Tue, 26 Apr 2022 00:01:04 +0300	[thread overview]
Message-ID: <20220425210104.31964-1-laurent.pinchart@ideasonboard.com> (raw)
In-Reply-To: <Ymbw52EF+Pcvkclz@pendragon.ideasonboard.com>

Update the maximum register name length to match all the registers being
printed. This helps getting a consistent alignment of register dumps
when concatenating multiple debugfs files.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
Changes since v4:

- Replace dynamic per-file register length with global maximum length
---
 .../media/platform/rockchip/rkisp1/rkisp1-debug.c    | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/drivers/media/platform/rockchip/rkisp1/rkisp1-debug.c b/drivers/media/platform/rockchip/rkisp1/rkisp1-debug.c
index 2c226f20f525..e76dc2b164b6 100644
--- a/drivers/media/platform/rockchip/rkisp1/rkisp1-debug.c
+++ b/drivers/media/platform/rockchip/rkisp1/rkisp1-debug.c
@@ -11,8 +11,10 @@
 #include <linux/debugfs.h>
 #include <linux/delay.h>
 #include <linux/device.h>
+#include <linux/minmax.h>
 #include <linux/pm_runtime.h>
 #include <linux/seq_file.h>
+#include <linux/string.h>
 
 #include "rkisp1-common.h"
 #include "rkisp1-regs.h"
@@ -28,10 +30,14 @@ struct rkisp1_debug_register {
 	RKISP1_CIF_##name, RKISP1_CIF_##name##_SHD, #name \
 }
 
+/* Keep this up-to-date when adding new registers. */
+#define RKISP1_MAX_REG_LENGTH		21
+
 static int rkisp1_debug_dump_regs(struct rkisp1_device *rkisp1,
 				  struct seq_file *m, unsigned int offset,
 				  const struct rkisp1_debug_register *regs)
 {
+	const int width = RKISP1_MAX_REG_LENGTH;
 	u32 val, shd;
 	int ret;
 
@@ -39,15 +45,15 @@ static int rkisp1_debug_dump_regs(struct rkisp1_device *rkisp1,
 	if (ret <= 0)
 		return ret ? : -ENODATA;
 
-	for ( ; regs->name; ++regs) {
+	for (; regs->name; ++regs) {
 		val = rkisp1_read(rkisp1, offset + regs->reg);
 
 		if (regs->shd) {
 			shd = rkisp1_read(rkisp1, offset + regs->shd);
-			seq_printf(m, "%14s: 0x%08x/0x%08x\n", regs->name,
+			seq_printf(m, "%*s: 0x%08x/0x%08x\n", width, regs->name,
 				   val, shd);
 		} else {
-			seq_printf(m, "%14s: 0x%08x\n", regs->name, val);
+			seq_printf(m, "%*s: 0x%08x\n", width, regs->name, val);
 		}
 	}
 
-- 
Regards,

Laurent Pinchart


WARNING: multiple messages have this Message-ID (diff)
From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: linux-media@vger.kernel.org
Cc: linux-rockchip@lists.infradead.org,
	Dafna Hirschfeld <dafna@fastmail.com>,
	Heiko Stuebner <heiko@sntech.de>,
	Paul Elder <paul.elder@ideasonboard.com>,
	Tomasz Figa <tfiga@google.com>,
	Ricardo Ribalda <ribalda@chromium.org>
Subject: [PATCH v4.1 18/21] media: rkisp1: debug: Update max register name length
Date: Tue, 26 Apr 2022 00:01:04 +0300	[thread overview]
Message-ID: <20220425210104.31964-1-laurent.pinchart@ideasonboard.com> (raw)
In-Reply-To: <Ymbw52EF+Pcvkclz@pendragon.ideasonboard.com>

Update the maximum register name length to match all the registers being
printed. This helps getting a consistent alignment of register dumps
when concatenating multiple debugfs files.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
Changes since v4:

- Replace dynamic per-file register length with global maximum length
---
 .../media/platform/rockchip/rkisp1/rkisp1-debug.c    | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/drivers/media/platform/rockchip/rkisp1/rkisp1-debug.c b/drivers/media/platform/rockchip/rkisp1/rkisp1-debug.c
index 2c226f20f525..e76dc2b164b6 100644
--- a/drivers/media/platform/rockchip/rkisp1/rkisp1-debug.c
+++ b/drivers/media/platform/rockchip/rkisp1/rkisp1-debug.c
@@ -11,8 +11,10 @@
 #include <linux/debugfs.h>
 #include <linux/delay.h>
 #include <linux/device.h>
+#include <linux/minmax.h>
 #include <linux/pm_runtime.h>
 #include <linux/seq_file.h>
+#include <linux/string.h>
 
 #include "rkisp1-common.h"
 #include "rkisp1-regs.h"
@@ -28,10 +30,14 @@ struct rkisp1_debug_register {
 	RKISP1_CIF_##name, RKISP1_CIF_##name##_SHD, #name \
 }
 
+/* Keep this up-to-date when adding new registers. */
+#define RKISP1_MAX_REG_LENGTH		21
+
 static int rkisp1_debug_dump_regs(struct rkisp1_device *rkisp1,
 				  struct seq_file *m, unsigned int offset,
 				  const struct rkisp1_debug_register *regs)
 {
+	const int width = RKISP1_MAX_REG_LENGTH;
 	u32 val, shd;
 	int ret;
 
@@ -39,15 +45,15 @@ static int rkisp1_debug_dump_regs(struct rkisp1_device *rkisp1,
 	if (ret <= 0)
 		return ret ? : -ENODATA;
 
-	for ( ; regs->name; ++regs) {
+	for (; regs->name; ++regs) {
 		val = rkisp1_read(rkisp1, offset + regs->reg);
 
 		if (regs->shd) {
 			shd = rkisp1_read(rkisp1, offset + regs->shd);
-			seq_printf(m, "%14s: 0x%08x/0x%08x\n", regs->name,
+			seq_printf(m, "%*s: 0x%08x/0x%08x\n", width, regs->name,
 				   val, shd);
 		} else {
-			seq_printf(m, "%14s: 0x%08x\n", regs->name, val);
+			seq_printf(m, "%*s: 0x%08x\n", width, regs->name, val);
 		}
 	}
 
-- 
Regards,

Laurent Pinchart


_______________________________________________
Linux-rockchip mailing list
Linux-rockchip@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-rockchip

  reply	other threads:[~2022-04-25 21:01 UTC|newest]

Thread overview: 100+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-21 23:42 [PATCH v4 00/21] media: rkisp1: Misc bug fixes and cleanups Laurent Pinchart
2022-04-21 23:42 ` Laurent Pinchart
2022-04-21 23:42 ` [PATCH v4 01/21] media: rkisp1: capture: Initialize entity before video device Laurent Pinchart
2022-04-21 23:42   ` Laurent Pinchart
2022-04-25  7:52   ` Ricardo Ribalda
2022-04-25  7:52     ` Ricardo Ribalda
2022-04-21 23:42 ` [PATCH v4 02/21] media: rkisp1: capture: Fix and simplify (un)registration Laurent Pinchart
2022-04-21 23:42   ` Laurent Pinchart
2022-04-25  9:34   ` Ricardo Ribalda
2022-04-25  9:34     ` Ricardo Ribalda
2022-04-21 23:42 ` [PATCH v4 03/21] media: rkisp1: isp: " Laurent Pinchart
2022-04-21 23:42   ` Laurent Pinchart
2022-04-25  9:36   ` Ricardo Ribalda
2022-04-25  9:36     ` Ricardo Ribalda
2022-04-21 23:42 ` [PATCH v4 04/21] media: rkisp1: resizer: " Laurent Pinchart
2022-04-21 23:42   ` Laurent Pinchart
2022-04-25  9:37   ` Ricardo Ribalda
2022-04-25  9:37     ` Ricardo Ribalda
2022-04-21 23:42 ` [PATCH v4 05/21] media: rkisp1: params: " Laurent Pinchart
2022-04-21 23:42   ` Laurent Pinchart
2022-04-25  9:39   ` Ricardo Ribalda
2022-04-25  9:39     ` Ricardo Ribalda
2022-04-21 23:42 ` [PATCH v4 06/21] media: rkisp1: stats: Simplify (un)registration Laurent Pinchart
2022-04-21 23:42   ` Laurent Pinchart
2022-04-25  9:44   ` Ricardo Ribalda
2022-04-25  9:44     ` Ricardo Ribalda
2022-04-21 23:42 ` [PATCH v4 07/21] media: rkisp1: Simplify rkisp1_entities_register() error path Laurent Pinchart
2022-04-21 23:42   ` Laurent Pinchart
2022-04-25  9:45   ` Ricardo Ribalda
2022-04-25  9:45     ` Ricardo Ribalda
2022-04-21 23:42 ` [PATCH v4 08/21] media: rkisp1: regs: Don't use BIT() macro for multi-bit register fields Laurent Pinchart
2022-04-21 23:42   ` Laurent Pinchart
2022-04-25  9:50   ` Ricardo Ribalda
2022-04-25  9:50     ` Ricardo Ribalda
2022-04-21 23:42 ` [PATCH v4 09/21] media: rkisp1: regs: Rename CCL, ICCL and IRCL registers with VI_ prefix Laurent Pinchart
2022-04-21 23:42   ` Laurent Pinchart
2022-04-25  9:51   ` Ricardo Ribalda
2022-04-25  9:51     ` Ricardo Ribalda
2022-04-21 23:42 ` [PATCH v4 10/21] media: rkisp1: Swap value and address arguments to rkisp1_write() Laurent Pinchart
2022-04-21 23:42   ` Laurent Pinchart
2022-04-25  9:53   ` Ricardo Ribalda
2022-04-25  9:53     ` Ricardo Ribalda
2022-04-25 18:59     ` Laurent Pinchart
2022-04-25 18:59       ` Laurent Pinchart
2022-04-21 23:42 ` [PATCH v4 11/21] media: rkisp1: resizer: Simplify register access Laurent Pinchart
2022-04-21 23:42   ` Laurent Pinchart
2022-04-25  9:58   ` Ricardo Ribalda
2022-04-25  9:58     ` Ricardo Ribalda
2022-04-21 23:42 ` [PATCH v4 12/21] media: rkisp1: Move debugfs code to a separate file Laurent Pinchart
2022-04-21 23:42   ` Laurent Pinchart
2022-04-25 10:54   ` Ricardo Ribalda
2022-04-25 10:54     ` Ricardo Ribalda
2022-04-21 23:42 ` [PATCH v4 13/21] media: rkisp1: Compile debugfs support conditionally Laurent Pinchart
2022-04-21 23:42   ` Laurent Pinchart
2022-04-25 10:58   ` Ricardo Ribalda
2022-04-25 10:58     ` Ricardo Ribalda
2022-04-25 19:08     ` Laurent Pinchart
2022-04-25 19:08       ` Laurent Pinchart
2022-04-26  7:33       ` Ricardo Ribalda
2022-04-26  7:33         ` Ricardo Ribalda
2022-04-21 23:42 ` [PATCH v4 14/21] media: rkisp1: debug: Collect input status by sampling ISP_FLAGS_SHD Laurent Pinchart
2022-04-21 23:42   ` Laurent Pinchart
2022-04-25 11:08   ` Ricardo Ribalda
2022-04-25 11:08     ` Ricardo Ribalda
2022-04-25 20:13     ` Laurent Pinchart
2022-04-25 20:13       ` Laurent Pinchart
2022-04-21 23:42 ` [PATCH v4 15/21] media: rkisp1: debug: Add debugfs files to dump core and ISP registers Laurent Pinchart
2022-04-21 23:42   ` Laurent Pinchart
2022-04-25 11:13   ` Ricardo Ribalda
2022-04-25 11:13     ` Ricardo Ribalda
2022-04-21 23:42 ` [PATCH v4 16/21] media: rkisp1: debug: Move resizer register dump to debugfs Laurent Pinchart
2022-04-21 23:42   ` Laurent Pinchart
2022-04-25 11:16   ` Ricardo Ribalda
2022-04-25 11:16     ` Ricardo Ribalda
2022-04-21 23:42 ` [PATCH v4 17/21] media: rkisp1: debug: Consolidate reg dumps for shadow registers Laurent Pinchart
2022-04-21 23:42   ` Laurent Pinchart
2022-04-25 11:45   ` Ricardo Ribalda
2022-04-25 11:45     ` Ricardo Ribalda
2022-04-21 23:42 ` [PATCH v4 18/21] media: rkisp1: debug: Compute max register length name dynamically Laurent Pinchart
2022-04-21 23:42   ` Laurent Pinchart
2022-04-25 11:49   ` Ricardo Ribalda
2022-04-25 11:49     ` Ricardo Ribalda
2022-04-25 19:05     ` Laurent Pinchart
2022-04-25 19:05       ` Laurent Pinchart
2022-04-25 21:01       ` Laurent Pinchart [this message]
2022-04-25 21:01         ` [PATCH v4.1 18/21] media: rkisp1: debug: Update max register name length Laurent Pinchart
2022-04-26  7:39         ` Ricardo Ribalda
2022-04-26  7:39           ` Ricardo Ribalda
2022-04-21 23:42 ` [PATCH v4 19/21] media: rkisp1: capture: Bypass the main device for handling querycap Laurent Pinchart
2022-04-21 23:42   ` Laurent Pinchart
2022-04-25 11:51   ` Ricardo Ribalda
2022-04-25 11:51     ` Ricardo Ribalda
2022-04-21 23:42 ` [PATCH v4 20/21] media: rkisp1: Align macro definitions Laurent Pinchart
2022-04-21 23:42   ` Laurent Pinchart
2022-04-25 11:52   ` Ricardo Ribalda
2022-04-25 11:52     ` Ricardo Ribalda
2022-04-21 23:42 ` [PATCH v4 21/21] media: rkisp1: Drop parentheses and fix indentation in rkisp1_probe() Laurent Pinchart
2022-04-21 23:42   ` Laurent Pinchart
2022-04-25  8:30   ` Ricardo Ribalda
2022-04-25  8:30     ` Ricardo Ribalda

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220425210104.31964-1-laurent.pinchart@ideasonboard.com \
    --to=laurent.pinchart@ideasonboard.com \
    --cc=dafna@fastmail.com \
    --cc=heiko@sntech.de \
    --cc=linux-media@vger.kernel.org \
    --cc=linux-rockchip@lists.infradead.org \
    --cc=paul.elder@ideasonboard.com \
    --cc=ribalda@chromium.org \
    --cc=tfiga@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.