aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/include/linux/hwmon.h
diff options
context:
space:
mode:
authorJani Nikula <jani.nikula@intel.com>2024-01-17 13:44:05 +0200
committerGuenter Roeck <linux@roeck-us.net>2024-02-11 13:43:08 -0800
commitb9f55084aa0962af6247fa971f0b1e9c7aa676ef (patch)
tree169bc7eecbceda34a87ab963848d55a5c7d97bf7 /include/linux/hwmon.h
parentLinux 6.8-rc4 (diff)
downloadwireguard-linux-b9f55084aa0962af6247fa971f0b1e9c7aa676ef.tar.xz
wireguard-linux-b9f55084aa0962af6247fa971f0b1e9c7aa676ef.zip
hwmon: put HWMON_CHANNEL_INFO() initializers in rodata
HWMON_CHANNEL_INFO() is supposed to be used as initializer for arrays of const struct hwmon_channel_info *. However, without explicit const, HWMON_CHANNEL_INFO() creates mutable compound literals, and the const pointers point at the mutable data. Add const to place the data in rodata. Cc: Jean Delvare <jdelvare@suse.com> Cc: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Jani Nikula <jani.nikula@intel.com> Link: https://lore.kernel.org/r/20240117114405.1506775-1-jani.nikula@intel.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Diffstat (limited to 'include/linux/hwmon.h')
-rw-r--r--include/linux/hwmon.h12
1 files changed, 6 insertions, 6 deletions
diff --git a/include/linux/hwmon.h b/include/linux/hwmon.h
index 8cd6a6b33593..c2c0da18dfa3 100644
--- a/include/linux/hwmon.h
+++ b/include/linux/hwmon.h
@@ -425,12 +425,12 @@ struct hwmon_channel_info {
const u32 *config;
};
-#define HWMON_CHANNEL_INFO(stype, ...) \
- (&(struct hwmon_channel_info) { \
- .type = hwmon_##stype, \
- .config = (u32 []) { \
- __VA_ARGS__, 0 \
- } \
+#define HWMON_CHANNEL_INFO(stype, ...) \
+ (&(const struct hwmon_channel_info) { \
+ .type = hwmon_##stype, \
+ .config = (const u32 []) { \
+ __VA_ARGS__, 0 \
+ } \
})
/**