Skip to content

Commit 2a5970d

Browse files
sagimaimonkuba-moo
authored andcommitted
ptp: ocp: fix start time alignment in ptp_ocp_signal_set
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: 4bd46bb ("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>
1 parent 7e49e64 commit 2a5970d

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

drivers/ptp/ptp_ocp.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2067,6 +2067,7 @@ ptp_ocp_signal_set(struct ptp_ocp *bp, int gen, struct ptp_ocp_signal *s)
20672067
if (!s->start) {
20682068
/* roundup() does not work on 32-bit systems */
20692069
s->start = DIV64_U64_ROUND_UP(start_ns, s->period);
2070+
s->start *= s->period;
20702071
s->start = ktime_add(s->start, s->phase);
20712072
}
20722073

0 commit comments

Comments
 (0)