aboutsummaryrefslogtreecommitdiff
path: root/include/linux/compiler.h
diff options
context:
space:
mode:
authorMark Brown <broonie@kernel.org>2024-09-12 12:38:44 +0100
committerMark Brown <broonie@kernel.org>2024-09-12 12:38:44 +0100
commitf10d52087cbe85dcff2af3dc94c5b9d06e6d4b9a (patch)
treed07ff0a3767fbb6118505de85ad657f78f512c06 /include/linux/compiler.h
parent740c1c84bfa3d8c63bd3b01fb570e7452f51fbd8 (diff)
parentb787a33864121a565aeb0e88561bf6062a19f99c (diff)
spi: Merge up fixes
A patch for Qualcomm depends on some fixes.
Diffstat (limited to 'include/linux/compiler.h')
-rw-r--r--include/linux/compiler.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/include/linux/compiler.h b/include/linux/compiler.h
index 2594553bb30b..2df665fa2964 100644
--- a/include/linux/compiler.h
+++ b/include/linux/compiler.h
@@ -297,6 +297,15 @@ static inline void *offset_to_ptr(const int *off)
#define is_unsigned_type(type) (!is_signed_type(type))
/*
+ * Useful shorthand for "is this condition known at compile-time?"
+ *
+ * Note that the condition may involve non-constant values,
+ * but the compiler may know enough about the details of the
+ * values to determine that the condition is statically true.
+ */
+#define statically_true(x) (__builtin_constant_p(x) && (x))
+
+/*
* This is needed in functions which generate the stack canary, see
* arch/x86/kernel/smpboot.c::start_secondary() for an example.
*/