]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
sched_ext: Make string params of __ENUM_set() const
authorKuba Piecuch <jpiecuch@google.com>
Mon, 13 Apr 2026 12:49:02 +0000 (12:49 +0000)
committerTejun Heo <tj@kernel.org>
Mon, 13 Apr 2026 16:14:05 +0000 (06:14 -1000)
A small change to improve type safety/const correctness.
__COMPAT_read_enum() already has const string parameters.

It fixes a warning when using the header in C++ code:

  error: ISO C++11 does not allow conversion from string literal
         to 'char *' [-Werror,-Wwritable-strings]

That's because string literals have type char[N] in C and
const char[N] in C++.

Signed-off-by: Kuba Piecuch <jpiecuch@google.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
tools/sched_ext/include/scx/enums.h

index 8e7c91575f0b32616bd4fbd503a0db8bd5adc664..c3b09acce824a5112bb93e1fda032b8a9e38bcc2 100644 (file)
@@ -9,7 +9,7 @@
 #ifndef __SCX_ENUMS_H
 #define __SCX_ENUMS_H
 
-static inline void __ENUM_set(u64 *val, char *type, char *name)
+static inline void __ENUM_set(u64 *val, const char *type, const char *name)
 {
        bool res;