Re: [PATCH v1 01/21] hwmon: Fix the type of 'config' in struct hwmon_channel_info to u64
From: Russell King (Oracle)
Date: Tue Jan 21 2025 - 12:06:17 EST
On Tue, Jan 21, 2025 at 02:44:59PM +0800, Huisong Li wrote:
> */
> struct hwmon_channel_info {
> enum hwmon_sensor_types type;
> - const u32 *config;
> + const u64 *config;
> };
>
> #define HWMON_CHANNEL_INFO(stype, ...) \
> (&(const struct hwmon_channel_info) { \
> .type = hwmon_##stype, \
> - .config = (const u32 []) { \
> + .config = (const u64 []) { \
> __VA_ARGS__, 0 \
> } \
> })
I'm sorry, but... no. Just no. Have you tried building with only your
first patch?
It will cause the compiler to barf on, e.g. the following:
static u32 marvell_hwmon_chip_config[] = {
...
static const struct hwmon_channel_info marvell_hwmon_chip = {
.type = hwmon_chip,
.config = marvell_hwmon_chip_config,
};
I suggest that you rearrange your series: first, do the conversions
to HWMON_CHANNEL_INFO() in the drivers you have.
At this point, if all the drivers that assign to hw_channel_info.config
have been converted, this patch 1 is then suitable.
If there are still drivers that assign a u32 array to
hw_channel_info.config, then you need to consider how to handle
that without causing regressions. You can't cast it between a u32
array and u64 array to silence the warning, because config[1]
won't point at the next entry.
I think your only option would be to combine the conversion of struct
hwmon_channel_info and the other drivers into a single patch. Slightly
annoying, but without introducing more preprocessor yuckiness, I don't
see another way.
--
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!