]> Gentwo Git Trees - linux/.git/commitdiff
ptp: ocp: Switch to use %ptSp
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Thu, 13 Nov 2025 14:32:31 +0000 (15:32 +0100)
committerPetr Mladek <pmladek@suse.com>
Wed, 19 Nov 2025 11:26:07 +0000 (12:26 +0100)
Use %ptSp instead of open coded variants to print content of
struct timespec64 in human readable format.

While at it, fix wrong use of %ptT against struct timespec64.
It's kinda lucky that it worked just because the first member
there 64-bit and it's of time64_t type. Now with %ptS it may
be used correctly.

Acked-by: Vadim Fedorenko <vadim.fedorenko@linux.dev>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://patch.msgid.link/20251113150217.3030010-18-andriy.shevchenko@linux.intel.com
Signed-off-by: Petr Mladek <pmladek@suse.com>
drivers/ptp/ptp_ocp.c

index 794ec6e71990c8917925bd3c9c91613c2f0e753d..70e4e6679e512b5b59165e080048262e547f3242 100644 (file)
@@ -4287,11 +4287,9 @@ ptp_ocp_summary_show(struct seq_file *s, void *data)
                ns += (s64)bp->utc_tai_offset * NSEC_PER_SEC;
                sys_ts = ns_to_timespec64(ns);
 
-               seq_printf(s, "%7s: %lld.%ld == %ptT TAI\n", "PHC",
-                          ts.tv_sec, ts.tv_nsec, &ts);
-               seq_printf(s, "%7s: %lld.%ld == %ptT UTC offset %d\n", "SYS",
-                          sys_ts.tv_sec, sys_ts.tv_nsec, &sys_ts,
-                          bp->utc_tai_offset);
+               seq_printf(s, "%7s: %ptSp == %ptS TAI\n", "PHC", &ts, &ts);
+               seq_printf(s, "%7s: %ptSp == %ptS UTC offset %d\n", "SYS",
+                          &sys_ts, &sys_ts, bp->utc_tai_offset);
                seq_printf(s, "%7s: PHC:SYS offset: %lld  window: %lld\n", "",
                           timespec64_to_ns(&ts) - ns,
                           post_ns - pre_ns);
@@ -4499,9 +4497,8 @@ ptp_ocp_phc_info(struct ptp_ocp *bp)
                 ptp_clock_index(bp->ptp));
 
        if (!ptp_ocp_gettimex(&bp->ptp_info, &ts, NULL))
-               dev_info(&bp->pdev->dev, "Time: %lld.%ld, %s\n",
-                        ts.tv_sec, ts.tv_nsec,
-                        bp->sync ? "in-sync" : "UNSYNCED");
+               dev_info(&bp->pdev->dev, "Time: %ptSp, %s\n",
+                        &ts, bp->sync ? "in-sync" : "UNSYNCED");
 }
 
 static void