From: Nicolas Ferre <nicolas.ferre@microchip.com>
To: Harini Katakam <harini.katakam@xilinx.com>, <davem@davemloft.net>
Cc: <netdev@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
<michal.simek@xilinx.com>, <harinikatakamlinux@gmail.com>,
Claudiu Beznea - M18063 <Claudiu.Beznea@microchip.com>
Subject: Re: [PATCH] net: macb: Fix ptp time adjustment for large negative delta
Date: Wed, 20 Jun 2018 16:04:17 +0200 [thread overview]
Message-ID: <ff8fac12-b5a1-5e2d-e4f6-4ee68bf685a7@microchip.com> (raw)
In-Reply-To: <1529494460-4689-1-git-send-email-harini.katakam@xilinx.com>
On 20/06/2018 at 13:34, Harini Katakam wrote:
> When delta passed to gem_ptp_adjtime is negative, the sign is
> maintained in the ns_to_timespec64 conversion. Hence timespec_add
> should be used directly. timespec_sub will just subtract the negative
> value thus increasing the time difference.
>
> Signed-off-by: Harini Katakam <harini.katakam@xilinx.com>
Makes sense:
Acked-by: Nicolas Ferre <nicolas.ferre@microchip.com>
> ---
> drivers/net/ethernet/cadence/macb_ptp.c | 5 +----
> 1 file changed, 1 insertion(+), 4 deletions(-)
>
> diff --git a/drivers/net/ethernet/cadence/macb_ptp.c b/drivers/net/ethernet/cadence/macb_ptp.c
> index 2220c77..6788351 100644
> --- a/drivers/net/ethernet/cadence/macb_ptp.c
> +++ b/drivers/net/ethernet/cadence/macb_ptp.c
> @@ -170,10 +170,7 @@ static int gem_ptp_adjtime(struct ptp_clock_info *ptp, s64 delta)
>
> if (delta > TSU_NSEC_MAX_VAL) {
> gem_tsu_get_time(&bp->ptp_clock_info, &now);
> - if (sign)
> - now = timespec64_sub(now, then);
> - else
> - now = timespec64_add(now, then);
> + now = timespec64_add(now, then);
>
> gem_tsu_set_time(&bp->ptp_clock_info,
> (const struct timespec64 *)&now);
>
--
Nicolas Ferre
next prev parent reply other threads:[~2018-06-20 14:04 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-06-20 11:34 [PATCH] net: macb: Fix ptp time adjustment for large negative delta Harini Katakam
2018-06-20 14:04 ` Nicolas Ferre [this message]
2018-06-21 6:01 ` David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ff8fac12-b5a1-5e2d-e4f6-4ee68bf685a7@microchip.com \
--to=nicolas.ferre@microchip.com \
--cc=Claudiu.Beznea@microchip.com \
--cc=davem@davemloft.net \
--cc=harini.katakam@xilinx.com \
--cc=harinikatakamlinux@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=michal.simek@xilinx.com \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).