tools headers UAPI: Sync linux/const.h with the kernel sources

To pick up the changes in:

  de9e2b3d88 ("uapi: Provide DIV_ROUND_CLOSEST()")

That just rebuilds perf, silencing this build warning.

This addresses this perf build warning:

  Warning: Kernel ABI header differences:
    diff -u tools/include/uapi/linux/const.h include/uapi/linux/const.h

Please see tools/include/uapi/README for further details.

Cc: Cristian Ciocaltea <cristian.ciocaltea@collabora.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
Arnaldo Carvalho de Melo 2026-06-25 13:02:03 -03:00
parent 88b8c6ae2c
commit 4a97144794

View File

@ -50,4 +50,22 @@
#define __KERNEL_DIV_ROUND_UP(n, d) (((n) + (d) - 1) / (d))
/*
* Divide positive or negative dividend by positive or negative divisor
* and round to closest integer. Result is undefined for negative
* divisors if the dividend variable type is unsigned and for negative
* dividends if the divisor variable type is unsigned.
*/
#define __KERNEL_DIV_ROUND_CLOSEST(x, divisor) \
({ \
__typeof__(x) __x = x; \
__typeof__(divisor) __d = divisor; \
\
(((__typeof__(x))-1) > 0 || \
((__typeof__(divisor))-1) > 0 || \
(((__x) > 0) == ((__d) > 0))) ? \
(((__x) + ((__d) / 2)) / (__d)) : \
(((__x) - ((__d) / 2)) / (__d)); \
})
#endif /* _UAPI_LINUX_CONST_H */