Skip to content

Commit 4e7c8ab

Browse files
andy-shevpmladek
authored andcommitted
ptp: ocp: Switch to use %ptSp
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>
1 parent b1e7286 commit 4e7c8ab

1 file changed

Lines changed: 5 additions & 8 deletions

File tree

drivers/ptp/ptp_ocp.c

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4287,11 +4287,9 @@ ptp_ocp_summary_show(struct seq_file *s, void *data)
42874287
ns += (s64)bp->utc_tai_offset * NSEC_PER_SEC;
42884288
sys_ts = ns_to_timespec64(ns);
42894289

4290-
seq_printf(s, "%7s: %lld.%ld == %ptT TAI\n", "PHC",
4291-
ts.tv_sec, ts.tv_nsec, &ts);
4292-
seq_printf(s, "%7s: %lld.%ld == %ptT UTC offset %d\n", "SYS",
4293-
sys_ts.tv_sec, sys_ts.tv_nsec, &sys_ts,
4294-
bp->utc_tai_offset);
4290+
seq_printf(s, "%7s: %ptSp == %ptS TAI\n", "PHC", &ts, &ts);
4291+
seq_printf(s, "%7s: %ptSp == %ptS UTC offset %d\n", "SYS",
4292+
&sys_ts, &sys_ts, bp->utc_tai_offset);
42954293
seq_printf(s, "%7s: PHC:SYS offset: %lld window: %lld\n", "",
42964294
timespec64_to_ns(&ts) - ns,
42974295
post_ns - pre_ns);
@@ -4499,9 +4497,8 @@ ptp_ocp_phc_info(struct ptp_ocp *bp)
44994497
ptp_clock_index(bp->ptp));
45004498

45014499
if (!ptp_ocp_gettimex(&bp->ptp_info, &ts, NULL))
4502-
dev_info(&bp->pdev->dev, "Time: %lld.%ld, %s\n",
4503-
ts.tv_sec, ts.tv_nsec,
4504-
bp->sync ? "in-sync" : "UNSYNCED");
4500+
dev_info(&bp->pdev->dev, "Time: %ptSp, %s\n",
4501+
&ts, bp->sync ? "in-sync" : "UNSYNCED");
45054502
}
45064503

45074504
static void

0 commit comments

Comments
 (0)