[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250515081332.151250-4-asoponar@taladin.ro>
Date: Thu, 15 May 2025 11:13:19 +0300
From: Alexandru Soponar <asoponar@...adin.ro>
To: linux-kernel@...r.kernel.org,
linux-hwmon@...r.kernel.org,
linux-iio@...r.kernel.org,
linux-leds@...r.kernel.org,
linux-watchdog@...r.kernel.org
Cc: jdelvare@...e.com,
linux@...ck-us.net,
jic23@...nel.org,
pavel@....cz,
lee@...nel.org,
baocheng.su@...mens.com,
wim@...ux-watchdog.org,
tobias.schaffner@...mens.com,
angelogioacchino.delregno@...labora.com,
benedikt.niedermayr@...mens.com,
matthias.bgg@...il.com,
aardelean@...libre.com,
contact@...y.one,
Alexandru Soponar <asoponar@...adin.ro>
Subject: [PATCH 03/16] hwmon: ina3221: Fix type incompatibility with non-macro find_closest
The ina3221_conv_time array was previously declared as u16 but used with
find_closest(). With find_closest() now implemented as a function taking
signed int parameters instead of a macro, passing unsigned arrays causes
type incompatibility errors. This patch changes the array type from
u16 to int to ensure compatibility with the function signature and
prevent compilation errors.
Signed-off-by: Alexandru Soponar <asoponar@...adin.ro>
---
drivers/hwmon/ina3221.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/hwmon/ina3221.c b/drivers/hwmon/ina3221.c
index 1bf479a0f793..482ab8e53d5c 100644
--- a/drivers/hwmon/ina3221.c
+++ b/drivers/hwmon/ina3221.c
@@ -178,7 +178,7 @@ static inline int ina3221_summation_shunt_resistor(struct ina3221_data *ina)
}
/* Lookup table for Bus and Shunt conversion times in usec */
-static const u16 ina3221_conv_time[] = {
+static const int ina3221_conv_time[] = {
140, 204, 332, 588, 1100, 2116, 4156, 8244,
};
@@ -192,7 +192,7 @@ static inline u32 ina3221_interval_ms_to_conv_time(u16 config, int interval)
{
u32 channels = hweight16(config & INA3221_CONFIG_CHs_EN_MASK);
u32 samples_idx = INA3221_CONFIG_AVG(config);
- u32 samples = ina3221_avg_samples[samples_idx];
+ int samples = ina3221_avg_samples[samples_idx];
/* Bisect the result to Bus and Shunt conversion times */
return DIV_ROUND_CLOSEST(interval * 1000 / 2, channels * samples);
@@ -204,8 +204,8 @@ static inline u32 ina3221_reg_to_interval_us(u16 config)
u32 channels = hweight16(config & INA3221_CONFIG_CHs_EN_MASK);
u32 vbus_ct_idx = INA3221_CONFIG_VBUS_CT(config);
u32 vsh_ct_idx = INA3221_CONFIG_VSH_CT(config);
- u32 vbus_ct = ina3221_conv_time[vbus_ct_idx];
- u32 vsh_ct = ina3221_conv_time[vsh_ct_idx];
+ int vbus_ct = ina3221_conv_time[vbus_ct_idx];
+ int vsh_ct = ina3221_conv_time[vsh_ct_idx];
/* Calculate total conversion time */
return channels * (vbus_ct + vsh_ct);
--
2.49.0
Powered by blists - more mailing lists