Thread (38 messages) 38 messages, 12 authors, 2025-11-11

Re: [PATCH v1 14/23] media: v4l2-ioctl: Switch to use %ptSp

From: Hans Verkuil <hverkuil+cisco@kernel.org>
Date: 2025-11-11 08:05:12
Also in: amd-gfx, ceph-devel, dri-devel, intel-wired-lan, intel-xe, linux-arm-msm, linux-doc, linux-media, linux-mmc, linux-pci, linux-s390, linux-scsi, linux-sound, linux-staging, linux-trace-kernel, lkml

On 10/11/2025 19:40, Andy Shevchenko wrote:
quoted hunk ↗ jump to hunk
Use %ptSp instead of open coded variants to print content of
struct timespec64 in human readable format.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/media/v4l2-core/v4l2-ioctl.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/drivers/media/v4l2-core/v4l2-ioctl.c b/drivers/media/v4l2-core/v4l2-ioctl.c
index 01cf52c3ea33..edc4d97b4161 100644
--- a/drivers/media/v4l2-core/v4l2-ioctl.c
+++ b/drivers/media/v4l2-core/v4l2-ioctl.c
@@ -791,9 +791,8 @@ static void v4l_print_event(const void *arg, bool write_only)
 	const struct v4l2_event *p = arg;
 	const struct v4l2_event_ctrl *c;
 
-	pr_cont("type=0x%x, pending=%u, sequence=%u, id=%u, timestamp=%llu.%9.9llu\n",
-			p->type, p->pending, p->sequence, p->id,
-			p->timestamp.tv_sec, p->timestamp.tv_nsec);
+	pr_cont("type=0x%x, pending=%u, sequence=%u, id=%u, timestamp=%ptSp\n",
+		p->type, p->pending, p->sequence, p->id, &p->timestamp);
Hmm, p->timestamp is a struct __kernel_timespec, but that's not quite the
same thing as struct timespec64:

struct __kernel_timespec {
        __kernel_time64_t       tv_sec;                 /* seconds */
        long long               tv_nsec;                /* nanoseconds */
};

vs:

struct timespec64 {
        time64_t        tv_sec;                 /* seconds */
        long            tv_nsec;                /* nanoseconds */
};

So I'm not sure this will work.

Regards,

	Hans
 	switch (p->type) {
 	case V4L2_EVENT_VSYNC:
 		printk(KERN_DEBUG "field=%s\n",
  
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help