Re: [PATCH v3 0/2] ptp: split non-host-disciplined PHC drivers into a dedicated subdirectory
From: Wen Gu <guwen@linux.alibaba.com>
Date: 2026-07-01 12:08:50
Also in:
linux-s390, lkml
On 2026/6/30 18:57, David Woodhouse wrote:
On Tue, 2026-06-30 at 11:15 +0800, Wen Gu wrote:
I was thinking we'd move them to drivers/phc, and simplify them as we do.
Most of them are just a lot of PTP driver boilerplate, wrapping around
one central function like
static int vmclock_get_crosststamp(struct vmclock_state *st,
struct ptp_system_timestamp *sts,
struct system_counterval_t *system_counter,
struct timespec64 *tspec)
...which is called with different permutations of arguments depending
on the actual PTP call.
I was thinking of reducing the duplication and having the PHC drivers
provide *only* that central function. Let the common PHC code provide
the interface to PTP (as well as to core timekeeping, for setting the
clock at boot, for timekeeping_set_reference() in the vmclock case, and
perhaps even for a PPS-like discipline from other clocks).
Here's a *very* hastily thrown together proof of concept; utterly
untested and AI-produced, and I've only given it the bare minimum of
oversight thus far (I have been meaning to do this for weeks but other
things have taken precedence so far)...
https://git.infradead.org/?p=linux-phc.git;a=shortlog;h=refs/heads/nextThanks for the POC. I've looked over it and agree this is a cleaner approach overall. The v3 was meant as an interim step, but given the POC it makes more sense to go straight to drivers/phc. I'm happy to adapt the Alibaba CIPU PHC driver to the new framework once it's in place, and glad to help along the way if needed.