From: Ahmad Fatoum <a.fatoum@barebox.org>
To: barebox@lists.infradead.org
Cc: Ahmad Fatoum <a.fatoum@barebox.org>
Subject: [PATCH] video: vpl: add debug output when calling ioctl
Date: Mon, 27 Oct 2025 07:42:11 +0100 [thread overview]
Message-ID: <20251027064213.2412332-1-a.fatoum@barebox.org> (raw)
To simplify pipeline debugging, add some human-readable output when
an ioctl is propagating along the pipeline.
Signed-off-by: Ahmad Fatoum <a.fatoum@barebox.org>
---
drivers/video/vpl.c | 44 ++++++++++++++++++++++++++++++++++++++++++--
1 file changed, 42 insertions(+), 2 deletions(-)
diff --git a/drivers/video/vpl.c b/drivers/video/vpl.c
index 0235c1e790bd..c4a41648bf04 100644
--- a/drivers/video/vpl.c
+++ b/drivers/video/vpl.c
@@ -116,6 +116,46 @@ static int vpl_foreach_endpoint(struct vpl *vpl, unsigned int port, int endpoint
return 0;
}
+static const char *ioctl_cmd_str(unsigned cmd)
+{
+ switch (cmd) {
+ case VPL_PREPARE:
+ return "PREPARE";
+ case VPL_UNPREPARE:
+ return "UNPREPARE";
+ case VPL_ENABLE:
+ return "ENABLE";
+ case VPL_DISABLE:
+ return "DISABLE";
+ case VPL_GET_VIDEOMODES:
+ return "GET_VIDEOMODES";
+ case VPL_GET_BUS_FORMAT:
+ return "GET_BUS_FORMAT";
+ case VPL_GET_DISPLAY_INFO:
+ return "GET_DISPLAY_INFO";
+ default:
+ return NULL;
+ }
+}
+
+static int vpl_do_ioctl(struct vpl *vpl, unsigned port, unsigned cmd,
+ void *data)
+{
+ char buf[sizeof("0x12345678")];
+ const char *cmdstr;
+
+ cmdstr = ioctl_cmd_str(cmd);
+ if (!cmdstr) {
+ snprintf(buf, sizeof(buf), "0x%08x", cmd);
+ cmdstr = buf;
+ }
+
+ pr_debug("%s: calling %ps(\"%pOF\", %d, %s, %p)\n", __func__,
+ vpl->ioctl, vpl->node, port, cmdstr, data);
+
+ return vpl->ioctl(vpl, port, cmd, data);
+}
+
struct vpl_ioctl {
int err;
unsigned cmd;
@@ -131,7 +171,7 @@ static int vpl_remote_ioctl(struct vpl *vpl, unsigned port, void *_data)
return 0;
}
- return vpl->ioctl(vpl, port, data->cmd, data->ptr);
+ return vpl_do_ioctl(vpl, port, data->cmd, data->ptr);
}
int vpl_ioctl(struct vpl *vpl, unsigned int port,
@@ -182,5 +222,5 @@ int vpl_bridge_ioctl(struct vpl_bridge *bridge, unsigned int cmd, void *ptr)
if (!vpl->ioctl)
return -EOPNOTSUPP;
- return vpl->ioctl(vpl, bridge->port, cmd, ptr);
+ return vpl_do_ioctl(vpl, bridge->port, cmd, ptr);
}
--
2.47.3
next reply other threads:[~2025-10-27 6:42 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-27 6:42 Ahmad Fatoum [this message]
2025-10-28 7:28 ` Sascha Hauer
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=20251027064213.2412332-1-a.fatoum@barebox.org \
--to=a.fatoum@barebox.org \
--cc=barebox@lists.infradead.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox