diff options
| author | Sagi Maimon <maimon.sagi@gmail.com> | 2025-04-15 08:31:31 +0300 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2025-04-25 10:45:44 +0200 |
| commit | 06ec3c18810fde67049d77bef785d940e8f05e28 (patch) | |
| tree | da83ed27fe0481e16c6b7a292e4b0c1cbadb2ff2 /drivers/ptp | |
| parent | c7ee467f29a8bf0bff8bc00a41ca6e217356b7a3 (diff) | |
| download | linux-06ec3c18810fde67049d77bef785d940e8f05e28.tar.gz linux-06ec3c18810fde67049d77bef785d940e8f05e28.tar.bz2 linux-06ec3c18810fde67049d77bef785d940e8f05e28.zip | |
ptp: ocp: fix start time alignment in ptp_ocp_signal_set
[ Upstream commit 2a5970d5aaff8f3e33ce3bfaa403ae88c40de40d ]
In ptp_ocp_signal_set, the start time for periodic signals is not
aligned to the next period boundary. The current code rounds up the
start time and divides by the period but fails to multiply back by
the period, causing misaligned signal starts. Fix this by multiplying
the rounded-up value by the period to ensure the start time is the
closest next period.
Fixes: 4bd46bb037f8e ("ptp: ocp: Use DIV64_U64_ROUND_UP for rounding.")
Signed-off-by: Sagi Maimon <maimon.sagi@gmail.com>
Reviewed-by: Vadim Fedorenko <vadim.fedorenko@linux.dev>
Link: https://patch.msgid.link/20250415053131.129413-1-maimon.sagi@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'drivers/ptp')
| -rw-r--r-- | drivers/ptp/ptp_ocp.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/drivers/ptp/ptp_ocp.c b/drivers/ptp/ptp_ocp.c index 13343c319877..4899fdf9bdf7 100644 --- a/drivers/ptp/ptp_ocp.c +++ b/drivers/ptp/ptp_ocp.c @@ -1842,6 +1842,7 @@ ptp_ocp_signal_set(struct ptp_ocp *bp, int gen, struct ptp_ocp_signal *s) if (!s->start) { /* roundup() does not work on 32-bit systems */ s->start = DIV64_U64_ROUND_UP(start_ns, s->period); + s->start *= s->period; s->start = ktime_add(s->start, s->phase); } |
