[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20220529003447.GA32026@hoboy.vegasvil.org>
Date: Sat, 28 May 2022 17:34:47 -0700
From: Richard Cochran <richardcochran@...il.com>
To: Jonathan Lemon <jonathan.lemon@...il.com>
Cc: netdev@...r.kernel.org, f.fainelli@...il.com, andrew@...n.ch,
hkallweit1@...il.com, linux@...linux.org.uk,
bcm-kernel-feedback-list@...adcom.com, kernel-team@...com,
davem@...emloft.net, kuba@...nel.org, pabeni@...hat.com,
edumazet@...gle.com
Subject: Re: [PATCH net-next v5 2/2] net: phy: broadcom: Add PTP support for
some Broadcom PHYs.
On Wed, May 18, 2022 at 03:39:35PM -0700, Jonathan Lemon wrote:
> +static int bcm_ptp_adjtime_locked(struct bcm_ptp_private *priv,
> + s64 delta_ns)
> +{
> + struct timespec64 ts;
> + int err;
> +
> + err = bcm_ptp_gettime_locked(priv, &ts, NULL);
> + if (!err) {
> + set_normalized_timespec64(&ts, ts.tv_sec,
> + ts.tv_nsec + delta_ns);
This also takes a LONG time when delta is large...
> + err = bcm_ptp_settime_locked(priv, &ts);
> + }
> + return err;
> +}
Try this instead:
s64 ns;
err = bcm_ptp_gettime_locked(priv, &ts, NULL);
if (err) {
return err;
}
ns = timespec64_to_ns(&ts);
ns += delta_ns;
ts = ns_to_timespec64(ns);
err = bcm_ptp_settime_locked(priv, &ts);
return err;
Thanks,
Richard
Powered by blists - more mailing lists