]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
tools headers UAPI: Sync linux/const.h with the kernel sources
authorArnaldo Carvalho de Melo <acme@redhat.com>
Thu, 25 Jun 2026 16:02:03 +0000 (13:02 -0300)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Wed, 22 Jul 2026 00:00:09 +0000 (21:00 -0300)
To pick up the changes in:

  de9e2b3d88af3641 ("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>
tools/include/uapi/linux/const.h

index b8f629ef135f356f552b9aa9dd73356167503134..565f309b9df8b158b8c5f91ccec25b55e957480d 100644 (file)
 
 #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 */