Skip to content

Commit 4bd46bb

Browse files
jlemonkuba-moo
authored andcommitted
ptp: ocp: Use DIV64_U64_ROUND_UP for rounding.
The initial code used roundup() to round the starting time to a multiple of a period. This generated an error on 32-bit systems, so was replaced with DIV_ROUND_UP_ULL(). However, this truncates to 32-bits on a 64-bit system. Replace with DIV64_U64_ROUND_UP() instead. Fixes: b325af3 ("ptp: ocp: Add signal generators and update sysfs nodes") Signed-off-by: Jonathan Lemon <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 51ca86b commit 4bd46bb

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/ptp/ptp_ocp.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1557,7 +1557,7 @@ ptp_ocp_signal_set(struct ptp_ocp *bp, int gen, struct ptp_ocp_signal *s)
15571557
start_ns = ktime_set(ts.tv_sec, ts.tv_nsec) + NSEC_PER_MSEC;
15581558
if (!s->start) {
15591559
/* roundup() does not work on 32-bit systems */
1560-
s->start = DIV_ROUND_UP_ULL(start_ns, s->period);
1560+
s->start = DIV64_U64_ROUND_UP(start_ns, s->period);
15611561
s->start = ktime_add(s->start, s->phase);
15621562
}
15631563

0 commit comments

Comments
 (0)