* [PATCH v1 01/21] hwmon: Fix the type of 'config' in struct hwmon_channel_info to u64
2025-01-21 6:44 [PATCH v1 00/21] hwmon: Fix the type of 'config' in struct hwmon_channel_info to u64 Huisong Li
@ 2025-01-21 6:44 ` Huisong Li
2025-01-21 17:05 ` Russell King (Oracle)
2025-01-21 6:45 ` [PATCH v1 02/21] media: video-i2c: Use HWMON_CHANNEL_INFO macro to simplify code Huisong Li
` (21 subsequent siblings)
22 siblings, 1 reply; 40+ messages in thread
From: Huisong Li @ 2025-01-21 6:44 UTC (permalink / raw)
To: linux-hwmon
Cc: linux-kernel, linux-media, linux-arm-kernel, arm-scmi, netdev,
linux-rtc, oss-drivers, linux-rdma, platform-driver-x86, linuxarm,
linux, jdelvare, kernel, pauk.denis, james, sudeep.holla,
cristian.marussi, matt, mchehab, irusskikh, andrew+netdev, davem,
edumazet, kuba, pabeni, saeedm, leon, tariqt, louis.peens,
hkallweit1, linux, kabel, W_Armin, hdegoede, ilpo.jarvinen,
alexandre.belloni, krzk, jonathan.cameron, zhanjie9, zhenglifeng1,
liuyonglong, lihuisong
Currently, the maximum number of hwmon channel attributes is 32 which is
limited by current hwmon core codes. And the power attributes are up to 31.
It's already encountered the issue of not adding attribute name to power
channel attribute.
So fix the type of 'config' in struct hwmon_channel_info to u64 so as to
support more attributes. For this goal, the following points are needed to
be done:
(1) Fix the type of 'config' in hwmon_channel_info structure to u64.
(2) Modify hwmon_num_channel_attrs() with hweight64.
(3) Type of BIT(xxx) in linux/hwmon.h is 'UL', need to modify to BIT_ULL.
Signed-off-by: Huisong Li <lihuisong@huawei.com>
---
drivers/hwmon/hwmon.c | 4 +-
include/linux/hwmon.h | 300 +++++++++++++++++++++---------------------
2 files changed, 152 insertions(+), 152 deletions(-)
diff --git a/drivers/hwmon/hwmon.c b/drivers/hwmon/hwmon.c
index 9703d60e9bbf..1fe8fa12cc60 100644
--- a/drivers/hwmon/hwmon.c
+++ b/drivers/hwmon/hwmon.c
@@ -790,7 +790,7 @@ static int hwmon_num_channel_attrs(const struct hwmon_channel_info *info)
int i, n;
for (i = n = 0; info->config[i]; i++)
- n += hweight32(info->config[i]);
+ n += hweight64(info->config[i]);
return n;
}
@@ -811,7 +811,7 @@ static int hwmon_genattrs(const void *drvdata,
template_size = __templates_size[info->type];
for (i = 0; info->config[i]; i++) {
- u32 attr_mask = info->config[i];
+ u64 attr_mask = info->config[i];
u32 attr;
while (attr_mask) {
diff --git a/include/linux/hwmon.h b/include/linux/hwmon.h
index 3a63dff62d03..544266a58d07 100644
--- a/include/linux/hwmon.h
+++ b/include/linux/hwmon.h
@@ -48,20 +48,20 @@ enum hwmon_chip_attributes {
hwmon_chip_pec,
};
-#define HWMON_C_TEMP_RESET_HISTORY BIT(hwmon_chip_temp_reset_history)
-#define HWMON_C_IN_RESET_HISTORY BIT(hwmon_chip_in_reset_history)
-#define HWMON_C_CURR_RESET_HISTORY BIT(hwmon_chip_curr_reset_history)
-#define HWMON_C_POWER_RESET_HISTORY BIT(hwmon_chip_power_reset_history)
-#define HWMON_C_REGISTER_TZ BIT(hwmon_chip_register_tz)
-#define HWMON_C_UPDATE_INTERVAL BIT(hwmon_chip_update_interval)
-#define HWMON_C_ALARMS BIT(hwmon_chip_alarms)
-#define HWMON_C_SAMPLES BIT(hwmon_chip_samples)
-#define HWMON_C_CURR_SAMPLES BIT(hwmon_chip_curr_samples)
-#define HWMON_C_IN_SAMPLES BIT(hwmon_chip_in_samples)
-#define HWMON_C_POWER_SAMPLES BIT(hwmon_chip_power_samples)
-#define HWMON_C_TEMP_SAMPLES BIT(hwmon_chip_temp_samples)
-#define HWMON_C_BEEP_ENABLE BIT(hwmon_chip_beep_enable)
-#define HWMON_C_PEC BIT(hwmon_chip_pec)
+#define HWMON_C_TEMP_RESET_HISTORY BIT_ULL(hwmon_chip_temp_reset_history)
+#define HWMON_C_IN_RESET_HISTORY BIT_ULL(hwmon_chip_in_reset_history)
+#define HWMON_C_CURR_RESET_HISTORY BIT_ULL(hwmon_chip_curr_reset_history)
+#define HWMON_C_POWER_RESET_HISTORY BIT_ULL(hwmon_chip_power_reset_history)
+#define HWMON_C_REGISTER_TZ BIT_ULL(hwmon_chip_register_tz)
+#define HWMON_C_UPDATE_INTERVAL BIT_ULL(hwmon_chip_update_interval)
+#define HWMON_C_ALARMS BIT_ULL(hwmon_chip_alarms)
+#define HWMON_C_SAMPLES BIT_ULL(hwmon_chip_samples)
+#define HWMON_C_CURR_SAMPLES BIT_ULL(hwmon_chip_curr_samples)
+#define HWMON_C_IN_SAMPLES BIT_ULL(hwmon_chip_in_samples)
+#define HWMON_C_POWER_SAMPLES BIT_ULL(hwmon_chip_power_samples)
+#define HWMON_C_TEMP_SAMPLES BIT_ULL(hwmon_chip_temp_samples)
+#define HWMON_C_BEEP_ENABLE BIT_ULL(hwmon_chip_beep_enable)
+#define HWMON_C_PEC BIT_ULL(hwmon_chip_pec)
enum hwmon_temp_attributes {
hwmon_temp_enable,
@@ -94,34 +94,34 @@ enum hwmon_temp_attributes {
hwmon_temp_beep,
};
-#define HWMON_T_ENABLE BIT(hwmon_temp_enable)
-#define HWMON_T_INPUT BIT(hwmon_temp_input)
-#define HWMON_T_TYPE BIT(hwmon_temp_type)
-#define HWMON_T_LCRIT BIT(hwmon_temp_lcrit)
-#define HWMON_T_LCRIT_HYST BIT(hwmon_temp_lcrit_hyst)
-#define HWMON_T_MIN BIT(hwmon_temp_min)
-#define HWMON_T_MIN_HYST BIT(hwmon_temp_min_hyst)
-#define HWMON_T_MAX BIT(hwmon_temp_max)
-#define HWMON_T_MAX_HYST BIT(hwmon_temp_max_hyst)
-#define HWMON_T_CRIT BIT(hwmon_temp_crit)
-#define HWMON_T_CRIT_HYST BIT(hwmon_temp_crit_hyst)
-#define HWMON_T_EMERGENCY BIT(hwmon_temp_emergency)
-#define HWMON_T_EMERGENCY_HYST BIT(hwmon_temp_emergency_hyst)
-#define HWMON_T_ALARM BIT(hwmon_temp_alarm)
-#define HWMON_T_MIN_ALARM BIT(hwmon_temp_min_alarm)
-#define HWMON_T_MAX_ALARM BIT(hwmon_temp_max_alarm)
-#define HWMON_T_CRIT_ALARM BIT(hwmon_temp_crit_alarm)
-#define HWMON_T_LCRIT_ALARM BIT(hwmon_temp_lcrit_alarm)
-#define HWMON_T_EMERGENCY_ALARM BIT(hwmon_temp_emergency_alarm)
-#define HWMON_T_FAULT BIT(hwmon_temp_fault)
-#define HWMON_T_OFFSET BIT(hwmon_temp_offset)
-#define HWMON_T_LABEL BIT(hwmon_temp_label)
-#define HWMON_T_LOWEST BIT(hwmon_temp_lowest)
-#define HWMON_T_HIGHEST BIT(hwmon_temp_highest)
-#define HWMON_T_RESET_HISTORY BIT(hwmon_temp_reset_history)
-#define HWMON_T_RATED_MIN BIT(hwmon_temp_rated_min)
-#define HWMON_T_RATED_MAX BIT(hwmon_temp_rated_max)
-#define HWMON_T_BEEP BIT(hwmon_temp_beep)
+#define HWMON_T_ENABLE BIT_ULL(hwmon_temp_enable)
+#define HWMON_T_INPUT BIT_ULL(hwmon_temp_input)
+#define HWMON_T_TYPE BIT_ULL(hwmon_temp_type)
+#define HWMON_T_LCRIT BIT_ULL(hwmon_temp_lcrit)
+#define HWMON_T_LCRIT_HYST BIT_ULL(hwmon_temp_lcrit_hyst)
+#define HWMON_T_MIN BIT_ULL(hwmon_temp_min)
+#define HWMON_T_MIN_HYST BIT_ULL(hwmon_temp_min_hyst)
+#define HWMON_T_MAX BIT_ULL(hwmon_temp_max)
+#define HWMON_T_MAX_HYST BIT_ULL(hwmon_temp_max_hyst)
+#define HWMON_T_CRIT BIT_ULL(hwmon_temp_crit)
+#define HWMON_T_CRIT_HYST BIT_ULL(hwmon_temp_crit_hyst)
+#define HWMON_T_EMERGENCY BIT_ULL(hwmon_temp_emergency)
+#define HWMON_T_EMERGENCY_HYST BIT_ULL(hwmon_temp_emergency_hyst)
+#define HWMON_T_ALARM BIT_ULL(hwmon_temp_alarm)
+#define HWMON_T_MIN_ALARM BIT_ULL(hwmon_temp_min_alarm)
+#define HWMON_T_MAX_ALARM BIT_ULL(hwmon_temp_max_alarm)
+#define HWMON_T_CRIT_ALARM BIT_ULL(hwmon_temp_crit_alarm)
+#define HWMON_T_LCRIT_ALARM BIT_ULL(hwmon_temp_lcrit_alarm)
+#define HWMON_T_EMERGENCY_ALARM BIT_ULL(hwmon_temp_emergency_alarm)
+#define HWMON_T_FAULT BIT_ULL(hwmon_temp_fault)
+#define HWMON_T_OFFSET BIT_ULL(hwmon_temp_offset)
+#define HWMON_T_LABEL BIT_ULL(hwmon_temp_label)
+#define HWMON_T_LOWEST BIT_ULL(hwmon_temp_lowest)
+#define HWMON_T_HIGHEST BIT_ULL(hwmon_temp_highest)
+#define HWMON_T_RESET_HISTORY BIT_ULL(hwmon_temp_reset_history)
+#define HWMON_T_RATED_MIN BIT_ULL(hwmon_temp_rated_min)
+#define HWMON_T_RATED_MAX BIT_ULL(hwmon_temp_rated_max)
+#define HWMON_T_BEEP BIT_ULL(hwmon_temp_beep)
enum hwmon_in_attributes {
hwmon_in_enable,
@@ -146,26 +146,26 @@ enum hwmon_in_attributes {
hwmon_in_fault,
};
-#define HWMON_I_ENABLE BIT(hwmon_in_enable)
-#define HWMON_I_INPUT BIT(hwmon_in_input)
-#define HWMON_I_MIN BIT(hwmon_in_min)
-#define HWMON_I_MAX BIT(hwmon_in_max)
-#define HWMON_I_LCRIT BIT(hwmon_in_lcrit)
-#define HWMON_I_CRIT BIT(hwmon_in_crit)
-#define HWMON_I_AVERAGE BIT(hwmon_in_average)
-#define HWMON_I_LOWEST BIT(hwmon_in_lowest)
-#define HWMON_I_HIGHEST BIT(hwmon_in_highest)
-#define HWMON_I_RESET_HISTORY BIT(hwmon_in_reset_history)
-#define HWMON_I_LABEL BIT(hwmon_in_label)
-#define HWMON_I_ALARM BIT(hwmon_in_alarm)
-#define HWMON_I_MIN_ALARM BIT(hwmon_in_min_alarm)
-#define HWMON_I_MAX_ALARM BIT(hwmon_in_max_alarm)
-#define HWMON_I_LCRIT_ALARM BIT(hwmon_in_lcrit_alarm)
-#define HWMON_I_CRIT_ALARM BIT(hwmon_in_crit_alarm)
-#define HWMON_I_RATED_MIN BIT(hwmon_in_rated_min)
-#define HWMON_I_RATED_MAX BIT(hwmon_in_rated_max)
-#define HWMON_I_BEEP BIT(hwmon_in_beep)
-#define HWMON_I_FAULT BIT(hwmon_in_fault)
+#define HWMON_I_ENABLE BIT_ULL(hwmon_in_enable)
+#define HWMON_I_INPUT BIT_ULL(hwmon_in_input)
+#define HWMON_I_MIN BIT_ULL(hwmon_in_min)
+#define HWMON_I_MAX BIT_ULL(hwmon_in_max)
+#define HWMON_I_LCRIT BIT_ULL(hwmon_in_lcrit)
+#define HWMON_I_CRIT BIT_ULL(hwmon_in_crit)
+#define HWMON_I_AVERAGE BIT_ULL(hwmon_in_average)
+#define HWMON_I_LOWEST BIT_ULL(hwmon_in_lowest)
+#define HWMON_I_HIGHEST BIT_ULL(hwmon_in_highest)
+#define HWMON_I_RESET_HISTORY BIT_ULL(hwmon_in_reset_history)
+#define HWMON_I_LABEL BIT_ULL(hwmon_in_label)
+#define HWMON_I_ALARM BIT_ULL(hwmon_in_alarm)
+#define HWMON_I_MIN_ALARM BIT_ULL(hwmon_in_min_alarm)
+#define HWMON_I_MAX_ALARM BIT_ULL(hwmon_in_max_alarm)
+#define HWMON_I_LCRIT_ALARM BIT_ULL(hwmon_in_lcrit_alarm)
+#define HWMON_I_CRIT_ALARM BIT_ULL(hwmon_in_crit_alarm)
+#define HWMON_I_RATED_MIN BIT_ULL(hwmon_in_rated_min)
+#define HWMON_I_RATED_MAX BIT_ULL(hwmon_in_rated_max)
+#define HWMON_I_BEEP BIT_ULL(hwmon_in_beep)
+#define HWMON_I_FAULT BIT_ULL(hwmon_in_fault)
enum hwmon_curr_attributes {
hwmon_curr_enable,
@@ -189,25 +189,25 @@ enum hwmon_curr_attributes {
hwmon_curr_beep,
};
-#define HWMON_C_ENABLE BIT(hwmon_curr_enable)
-#define HWMON_C_INPUT BIT(hwmon_curr_input)
-#define HWMON_C_MIN BIT(hwmon_curr_min)
-#define HWMON_C_MAX BIT(hwmon_curr_max)
-#define HWMON_C_LCRIT BIT(hwmon_curr_lcrit)
-#define HWMON_C_CRIT BIT(hwmon_curr_crit)
-#define HWMON_C_AVERAGE BIT(hwmon_curr_average)
-#define HWMON_C_LOWEST BIT(hwmon_curr_lowest)
-#define HWMON_C_HIGHEST BIT(hwmon_curr_highest)
-#define HWMON_C_RESET_HISTORY BIT(hwmon_curr_reset_history)
-#define HWMON_C_LABEL BIT(hwmon_curr_label)
-#define HWMON_C_ALARM BIT(hwmon_curr_alarm)
-#define HWMON_C_MIN_ALARM BIT(hwmon_curr_min_alarm)
-#define HWMON_C_MAX_ALARM BIT(hwmon_curr_max_alarm)
-#define HWMON_C_LCRIT_ALARM BIT(hwmon_curr_lcrit_alarm)
-#define HWMON_C_CRIT_ALARM BIT(hwmon_curr_crit_alarm)
-#define HWMON_C_RATED_MIN BIT(hwmon_curr_rated_min)
-#define HWMON_C_RATED_MAX BIT(hwmon_curr_rated_max)
-#define HWMON_C_BEEP BIT(hwmon_curr_beep)
+#define HWMON_C_ENABLE BIT_ULL(hwmon_curr_enable)
+#define HWMON_C_INPUT BIT_ULL(hwmon_curr_input)
+#define HWMON_C_MIN BIT_ULL(hwmon_curr_min)
+#define HWMON_C_MAX BIT_ULL(hwmon_curr_max)
+#define HWMON_C_LCRIT BIT_ULL(hwmon_curr_lcrit)
+#define HWMON_C_CRIT BIT_ULL(hwmon_curr_crit)
+#define HWMON_C_AVERAGE BIT_ULL(hwmon_curr_average)
+#define HWMON_C_LOWEST BIT_ULL(hwmon_curr_lowest)
+#define HWMON_C_HIGHEST BIT_ULL(hwmon_curr_highest)
+#define HWMON_C_RESET_HISTORY BIT_ULL(hwmon_curr_reset_history)
+#define HWMON_C_LABEL BIT_ULL(hwmon_curr_label)
+#define HWMON_C_ALARM BIT_ULL(hwmon_curr_alarm)
+#define HWMON_C_MIN_ALARM BIT_ULL(hwmon_curr_min_alarm)
+#define HWMON_C_MAX_ALARM BIT_ULL(hwmon_curr_max_alarm)
+#define HWMON_C_LCRIT_ALARM BIT_ULL(hwmon_curr_lcrit_alarm)
+#define HWMON_C_CRIT_ALARM BIT_ULL(hwmon_curr_crit_alarm)
+#define HWMON_C_RATED_MIN BIT_ULL(hwmon_curr_rated_min)
+#define HWMON_C_RATED_MAX BIT_ULL(hwmon_curr_rated_max)
+#define HWMON_C_BEEP BIT_ULL(hwmon_curr_beep)
enum hwmon_power_attributes {
hwmon_power_enable,
@@ -243,37 +243,37 @@ enum hwmon_power_attributes {
hwmon_power_rated_max,
};
-#define HWMON_P_ENABLE BIT(hwmon_power_enable)
-#define HWMON_P_AVERAGE BIT(hwmon_power_average)
-#define HWMON_P_AVERAGE_INTERVAL BIT(hwmon_power_average_interval)
-#define HWMON_P_AVERAGE_INTERVAL_MAX BIT(hwmon_power_average_interval_max)
-#define HWMON_P_AVERAGE_INTERVAL_MIN BIT(hwmon_power_average_interval_min)
-#define HWMON_P_AVERAGE_HIGHEST BIT(hwmon_power_average_highest)
-#define HWMON_P_AVERAGE_LOWEST BIT(hwmon_power_average_lowest)
-#define HWMON_P_AVERAGE_MAX BIT(hwmon_power_average_max)
-#define HWMON_P_AVERAGE_MIN BIT(hwmon_power_average_min)
-#define HWMON_P_INPUT BIT(hwmon_power_input)
-#define HWMON_P_INPUT_HIGHEST BIT(hwmon_power_input_highest)
-#define HWMON_P_INPUT_LOWEST BIT(hwmon_power_input_lowest)
-#define HWMON_P_RESET_HISTORY BIT(hwmon_power_reset_history)
-#define HWMON_P_ACCURACY BIT(hwmon_power_accuracy)
-#define HWMON_P_CAP BIT(hwmon_power_cap)
-#define HWMON_P_CAP_HYST BIT(hwmon_power_cap_hyst)
-#define HWMON_P_CAP_MAX BIT(hwmon_power_cap_max)
-#define HWMON_P_CAP_MIN BIT(hwmon_power_cap_min)
-#define HWMON_P_MIN BIT(hwmon_power_min)
-#define HWMON_P_MAX BIT(hwmon_power_max)
-#define HWMON_P_LCRIT BIT(hwmon_power_lcrit)
-#define HWMON_P_CRIT BIT(hwmon_power_crit)
-#define HWMON_P_LABEL BIT(hwmon_power_label)
-#define HWMON_P_ALARM BIT(hwmon_power_alarm)
-#define HWMON_P_CAP_ALARM BIT(hwmon_power_cap_alarm)
-#define HWMON_P_MIN_ALARM BIT(hwmon_power_min_alarm)
-#define HWMON_P_MAX_ALARM BIT(hwmon_power_max_alarm)
-#define HWMON_P_LCRIT_ALARM BIT(hwmon_power_lcrit_alarm)
-#define HWMON_P_CRIT_ALARM BIT(hwmon_power_crit_alarm)
-#define HWMON_P_RATED_MIN BIT(hwmon_power_rated_min)
-#define HWMON_P_RATED_MAX BIT(hwmon_power_rated_max)
+#define HWMON_P_ENABLE BIT_ULL(hwmon_power_enable)
+#define HWMON_P_AVERAGE BIT_ULL(hwmon_power_average)
+#define HWMON_P_AVERAGE_INTERVAL BIT_ULL(hwmon_power_average_interval)
+#define HWMON_P_AVERAGE_INTERVAL_MAX BIT_ULL(hwmon_power_average_interval_max)
+#define HWMON_P_AVERAGE_INTERVAL_MIN BIT_ULL(hwmon_power_average_interval_min)
+#define HWMON_P_AVERAGE_HIGHEST BIT_ULL(hwmon_power_average_highest)
+#define HWMON_P_AVERAGE_LOWEST BIT_ULL(hwmon_power_average_lowest)
+#define HWMON_P_AVERAGE_MAX BIT_ULL(hwmon_power_average_max)
+#define HWMON_P_AVERAGE_MIN BIT_ULL(hwmon_power_average_min)
+#define HWMON_P_INPUT BIT_ULL(hwmon_power_input)
+#define HWMON_P_INPUT_HIGHEST BIT_ULL(hwmon_power_input_highest)
+#define HWMON_P_INPUT_LOWEST BIT_ULL(hwmon_power_input_lowest)
+#define HWMON_P_RESET_HISTORY BIT_ULL(hwmon_power_reset_history)
+#define HWMON_P_ACCURACY BIT_ULL(hwmon_power_accuracy)
+#define HWMON_P_CAP BIT_ULL(hwmon_power_cap)
+#define HWMON_P_CAP_HYST BIT_ULL(hwmon_power_cap_hyst)
+#define HWMON_P_CAP_MAX BIT_ULL(hwmon_power_cap_max)
+#define HWMON_P_CAP_MIN BIT_ULL(hwmon_power_cap_min)
+#define HWMON_P_MIN BIT_ULL(hwmon_power_min)
+#define HWMON_P_MAX BIT_ULL(hwmon_power_max)
+#define HWMON_P_LCRIT BIT_ULL(hwmon_power_lcrit)
+#define HWMON_P_CRIT BIT_ULL(hwmon_power_crit)
+#define HWMON_P_LABEL BIT_ULL(hwmon_power_label)
+#define HWMON_P_ALARM BIT_ULL(hwmon_power_alarm)
+#define HWMON_P_CAP_ALARM BIT_ULL(hwmon_power_cap_alarm)
+#define HWMON_P_MIN_ALARM BIT_ULL(hwmon_power_min_alarm)
+#define HWMON_P_MAX_ALARM BIT_ULL(hwmon_power_max_alarm)
+#define HWMON_P_LCRIT_ALARM BIT_ULL(hwmon_power_lcrit_alarm)
+#define HWMON_P_CRIT_ALARM BIT_ULL(hwmon_power_crit_alarm)
+#define HWMON_P_RATED_MIN BIT_ULL(hwmon_power_rated_min)
+#define HWMON_P_RATED_MAX BIT_ULL(hwmon_power_rated_max)
enum hwmon_energy_attributes {
hwmon_energy_enable,
@@ -281,9 +281,9 @@ enum hwmon_energy_attributes {
hwmon_energy_label,
};
-#define HWMON_E_ENABLE BIT(hwmon_energy_enable)
-#define HWMON_E_INPUT BIT(hwmon_energy_input)
-#define HWMON_E_LABEL BIT(hwmon_energy_label)
+#define HWMON_E_ENABLE BIT_ULL(hwmon_energy_enable)
+#define HWMON_E_INPUT BIT_ULL(hwmon_energy_input)
+#define HWMON_E_LABEL BIT_ULL(hwmon_energy_label)
enum hwmon_humidity_attributes {
hwmon_humidity_enable,
@@ -301,19 +301,19 @@ enum hwmon_humidity_attributes {
hwmon_humidity_max_alarm,
};
-#define HWMON_H_ENABLE BIT(hwmon_humidity_enable)
-#define HWMON_H_INPUT BIT(hwmon_humidity_input)
-#define HWMON_H_LABEL BIT(hwmon_humidity_label)
-#define HWMON_H_MIN BIT(hwmon_humidity_min)
-#define HWMON_H_MIN_HYST BIT(hwmon_humidity_min_hyst)
-#define HWMON_H_MAX BIT(hwmon_humidity_max)
-#define HWMON_H_MAX_HYST BIT(hwmon_humidity_max_hyst)
-#define HWMON_H_ALARM BIT(hwmon_humidity_alarm)
-#define HWMON_H_FAULT BIT(hwmon_humidity_fault)
-#define HWMON_H_RATED_MIN BIT(hwmon_humidity_rated_min)
-#define HWMON_H_RATED_MAX BIT(hwmon_humidity_rated_max)
-#define HWMON_H_MIN_ALARM BIT(hwmon_humidity_min_alarm)
-#define HWMON_H_MAX_ALARM BIT(hwmon_humidity_max_alarm)
+#define HWMON_H_ENABLE BIT_ULL(hwmon_humidity_enable)
+#define HWMON_H_INPUT BIT_ULL(hwmon_humidity_input)
+#define HWMON_H_LABEL BIT_ULL(hwmon_humidity_label)
+#define HWMON_H_MIN BIT_ULL(hwmon_humidity_min)
+#define HWMON_H_MIN_HYST BIT_ULL(hwmon_humidity_min_hyst)
+#define HWMON_H_MAX BIT_ULL(hwmon_humidity_max)
+#define HWMON_H_MAX_HYST BIT_ULL(hwmon_humidity_max_hyst)
+#define HWMON_H_ALARM BIT_ULL(hwmon_humidity_alarm)
+#define HWMON_H_FAULT BIT_ULL(hwmon_humidity_fault)
+#define HWMON_H_RATED_MIN BIT_ULL(hwmon_humidity_rated_min)
+#define HWMON_H_RATED_MAX BIT_ULL(hwmon_humidity_rated_max)
+#define HWMON_H_MIN_ALARM BIT_ULL(hwmon_humidity_min_alarm)
+#define HWMON_H_MAX_ALARM BIT_ULL(hwmon_humidity_max_alarm)
enum hwmon_fan_attributes {
hwmon_fan_enable,
@@ -331,19 +331,19 @@ enum hwmon_fan_attributes {
hwmon_fan_beep,
};
-#define HWMON_F_ENABLE BIT(hwmon_fan_enable)
-#define HWMON_F_INPUT BIT(hwmon_fan_input)
-#define HWMON_F_LABEL BIT(hwmon_fan_label)
-#define HWMON_F_MIN BIT(hwmon_fan_min)
-#define HWMON_F_MAX BIT(hwmon_fan_max)
-#define HWMON_F_DIV BIT(hwmon_fan_div)
-#define HWMON_F_PULSES BIT(hwmon_fan_pulses)
-#define HWMON_F_TARGET BIT(hwmon_fan_target)
-#define HWMON_F_ALARM BIT(hwmon_fan_alarm)
-#define HWMON_F_MIN_ALARM BIT(hwmon_fan_min_alarm)
-#define HWMON_F_MAX_ALARM BIT(hwmon_fan_max_alarm)
-#define HWMON_F_FAULT BIT(hwmon_fan_fault)
-#define HWMON_F_BEEP BIT(hwmon_fan_beep)
+#define HWMON_F_ENABLE BIT_ULL(hwmon_fan_enable)
+#define HWMON_F_INPUT BIT_ULL(hwmon_fan_input)
+#define HWMON_F_LABEL BIT_ULL(hwmon_fan_label)
+#define HWMON_F_MIN BIT_ULL(hwmon_fan_min)
+#define HWMON_F_MAX BIT_ULL(hwmon_fan_max)
+#define HWMON_F_DIV BIT_ULL(hwmon_fan_div)
+#define HWMON_F_PULSES BIT_ULL(hwmon_fan_pulses)
+#define HWMON_F_TARGET BIT_ULL(hwmon_fan_target)
+#define HWMON_F_ALARM BIT_ULL(hwmon_fan_alarm)
+#define HWMON_F_MIN_ALARM BIT_ULL(hwmon_fan_min_alarm)
+#define HWMON_F_MAX_ALARM BIT_ULL(hwmon_fan_max_alarm)
+#define HWMON_F_FAULT BIT_ULL(hwmon_fan_fault)
+#define HWMON_F_BEEP BIT_ULL(hwmon_fan_beep)
enum hwmon_pwm_attributes {
hwmon_pwm_input,
@@ -353,18 +353,18 @@ enum hwmon_pwm_attributes {
hwmon_pwm_auto_channels_temp,
};
-#define HWMON_PWM_INPUT BIT(hwmon_pwm_input)
-#define HWMON_PWM_ENABLE BIT(hwmon_pwm_enable)
-#define HWMON_PWM_MODE BIT(hwmon_pwm_mode)
-#define HWMON_PWM_FREQ BIT(hwmon_pwm_freq)
-#define HWMON_PWM_AUTO_CHANNELS_TEMP BIT(hwmon_pwm_auto_channels_temp)
+#define HWMON_PWM_INPUT BIT_ULL(hwmon_pwm_input)
+#define HWMON_PWM_ENABLE BIT_ULL(hwmon_pwm_enable)
+#define HWMON_PWM_MODE BIT_ULL(hwmon_pwm_mode)
+#define HWMON_PWM_FREQ BIT_ULL(hwmon_pwm_freq)
+#define HWMON_PWM_AUTO_CHANNELS_TEMP BIT_ULL(hwmon_pwm_auto_channels_temp)
enum hwmon_intrusion_attributes {
hwmon_intrusion_alarm,
hwmon_intrusion_beep,
};
-#define HWMON_INTRUSION_ALARM BIT(hwmon_intrusion_alarm)
-#define HWMON_INTRUSION_BEEP BIT(hwmon_intrusion_beep)
+#define HWMON_INTRUSION_ALARM BIT_ULL(hwmon_intrusion_alarm)
+#define HWMON_INTRUSION_BEEP BIT_ULL(hwmon_intrusion_beep)
/**
* struct hwmon_ops - hwmon device operations
@@ -433,13 +433,13 @@ struct hwmon_ops {
*/
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 \
} \
})
--
2.22.0
^ permalink raw reply related [flat|nested] 40+ messages in thread* Re: [PATCH v1 01/21] hwmon: Fix the type of 'config' in struct hwmon_channel_info to u64
2025-01-21 6:44 ` [PATCH v1 01/21] " Huisong Li
@ 2025-01-21 17:05 ` Russell King (Oracle)
2025-01-21 17:32 ` Guenter Roeck
2025-01-22 3:34 ` lihuisong (C)
0 siblings, 2 replies; 40+ messages in thread
From: Russell King (Oracle) @ 2025-01-21 17:05 UTC (permalink / raw)
To: Huisong Li
Cc: linux-hwmon, linux-kernel, linux-media, linux-arm-kernel,
arm-scmi, netdev, linux-rtc, oss-drivers, linux-rdma,
platform-driver-x86, linuxarm, linux, jdelvare, kernel,
pauk.denis, james, sudeep.holla, cristian.marussi, matt, mchehab,
irusskikh, andrew+netdev, davem, edumazet, kuba, pabeni, saeedm,
leon, tariqt, louis.peens, hkallweit1, kabel, W_Armin, hdegoede,
ilpo.jarvinen, alexandre.belloni, krzk, jonathan.cameron,
zhanjie9, zhenglifeng1, liuyonglong
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!
^ permalink raw reply [flat|nested] 40+ messages in thread* Re: [PATCH v1 01/21] hwmon: Fix the type of 'config' in struct hwmon_channel_info to u64
2025-01-21 17:05 ` Russell King (Oracle)
@ 2025-01-21 17:32 ` Guenter Roeck
2025-01-22 3:34 ` lihuisong (C)
1 sibling, 0 replies; 40+ messages in thread
From: Guenter Roeck @ 2025-01-21 17:32 UTC (permalink / raw)
To: Russell King (Oracle), Huisong Li
Cc: linux-hwmon, linux-kernel, linux-media, linux-arm-kernel,
arm-scmi, netdev, linux-rtc, oss-drivers, linux-rdma,
platform-driver-x86, linuxarm, jdelvare, kernel, pauk.denis,
james, sudeep.holla, cristian.marussi, matt, mchehab, irusskikh,
andrew+netdev, davem, edumazet, kuba, pabeni, saeedm, leon,
tariqt, louis.peens, hkallweit1, kabel, W_Armin, hdegoede,
ilpo.jarvinen, alexandre.belloni, krzk, jonathan.cameron,
zhanjie9, zhenglifeng1, liuyonglong
On 1/21/25 09:05, Russell King (Oracle) wrote:
> 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.
>
This is moot because the series does not explain which attributes
would be added ... and it turns out the to-be-added attributes would be
non-standard and thus not be acceptable anyway. On top of that, if the
size of configuration fields ever becomes an issue, I would look for a
much less invasive solution.
The author of this series did not contact me before submitting it,
and I did not have a chance to prevent it from being submitted.
Still, sorry for the noise.
Guenter
^ permalink raw reply [flat|nested] 40+ messages in thread* Re: [PATCH v1 01/21] hwmon: Fix the type of 'config' in struct hwmon_channel_info to u64
2025-01-21 17:05 ` Russell King (Oracle)
2025-01-21 17:32 ` Guenter Roeck
@ 2025-01-22 3:34 ` lihuisong (C)
1 sibling, 0 replies; 40+ messages in thread
From: lihuisong (C) @ 2025-01-22 3:34 UTC (permalink / raw)
To: Russell King (Oracle)
Cc: linux-hwmon, linux-kernel, linux-media, linux-arm-kernel,
arm-scmi, netdev, linux-rtc, oss-drivers, linux-rdma,
platform-driver-x86, linuxarm, linux, jdelvare, kernel,
pauk.denis, james, sudeep.holla, cristian.marussi, matt, mchehab,
irusskikh, andrew+netdev, davem, edumazet, kuba, pabeni, saeedm,
leon, tariqt, louis.peens, hkallweit1, kabel, W_Armin, hdegoede,
ilpo.jarvinen, alexandre.belloni, krzk, jonathan.cameron,
zhanjie9, zhenglifeng1, liuyonglong
在 2025/1/22 1:05, Russell King (Oracle) 写道:
> 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.
Yes.
>
> 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.
got it. Thanks for suggestion.
^ permalink raw reply [flat|nested] 40+ messages in thread
* [PATCH v1 02/21] media: video-i2c: Use HWMON_CHANNEL_INFO macro to simplify code
2025-01-21 6:44 [PATCH v1 00/21] hwmon: Fix the type of 'config' in struct hwmon_channel_info to u64 Huisong Li
2025-01-21 6:44 ` [PATCH v1 01/21] " Huisong Li
@ 2025-01-21 6:45 ` Huisong Li
2025-01-21 6:45 ` [PATCH v1 03/21] net: aquantia: " Huisong Li
` (20 subsequent siblings)
22 siblings, 0 replies; 40+ messages in thread
From: Huisong Li @ 2025-01-21 6:45 UTC (permalink / raw)
To: linux-hwmon
Cc: linux-kernel, linux-media, linux-arm-kernel, arm-scmi, netdev,
linux-rtc, oss-drivers, linux-rdma, platform-driver-x86, linuxarm,
linux, jdelvare, kernel, pauk.denis, james, sudeep.holla,
cristian.marussi, matt, mchehab, irusskikh, andrew+netdev, davem,
edumazet, kuba, pabeni, saeedm, leon, tariqt, louis.peens,
hkallweit1, linux, kabel, W_Armin, hdegoede, ilpo.jarvinen,
alexandre.belloni, krzk, jonathan.cameron, zhanjie9, zhenglifeng1,
liuyonglong, lihuisong
Use HWMON_CHANNEL_INFO macro to simplify code.
Signed-off-by: Huisong Li <lihuisong@huawei.com>
---
drivers/media/i2c/video-i2c.c | 12 +-----------
1 file changed, 1 insertion(+), 11 deletions(-)
diff --git a/drivers/media/i2c/video-i2c.c b/drivers/media/i2c/video-i2c.c
index 036a6375627a..0dd991d70d53 100644
--- a/drivers/media/i2c/video-i2c.c
+++ b/drivers/media/i2c/video-i2c.c
@@ -264,18 +264,8 @@ static int amg88xx_set_power(struct video_i2c_data *data, bool on)
#if IS_REACHABLE(CONFIG_HWMON)
-static const u32 amg88xx_temp_config[] = {
- HWMON_T_INPUT,
- 0
-};
-
-static const struct hwmon_channel_info amg88xx_temp = {
- .type = hwmon_temp,
- .config = amg88xx_temp_config,
-};
-
static const struct hwmon_channel_info * const amg88xx_info[] = {
- &amg88xx_temp,
+ HWMON_CHANNEL_INFO(temp, HWMON_T_INPUT),
NULL
};
--
2.22.0
^ permalink raw reply related [flat|nested] 40+ messages in thread* [PATCH v1 03/21] net: aquantia: Use HWMON_CHANNEL_INFO macro to simplify code
2025-01-21 6:44 [PATCH v1 00/21] hwmon: Fix the type of 'config' in struct hwmon_channel_info to u64 Huisong Li
2025-01-21 6:44 ` [PATCH v1 01/21] " Huisong Li
2025-01-21 6:45 ` [PATCH v1 02/21] media: video-i2c: Use HWMON_CHANNEL_INFO macro to simplify code Huisong Li
@ 2025-01-21 6:45 ` Huisong Li
2025-01-21 6:45 ` [PATCH v1 04/21] net: nfp: " Huisong Li
` (19 subsequent siblings)
22 siblings, 0 replies; 40+ messages in thread
From: Huisong Li @ 2025-01-21 6:45 UTC (permalink / raw)
To: linux-hwmon
Cc: linux-kernel, linux-media, linux-arm-kernel, arm-scmi, netdev,
linux-rtc, oss-drivers, linux-rdma, platform-driver-x86, linuxarm,
linux, jdelvare, kernel, pauk.denis, james, sudeep.holla,
cristian.marussi, matt, mchehab, irusskikh, andrew+netdev, davem,
edumazet, kuba, pabeni, saeedm, leon, tariqt, louis.peens,
hkallweit1, linux, kabel, W_Armin, hdegoede, ilpo.jarvinen,
alexandre.belloni, krzk, jonathan.cameron, zhanjie9, zhenglifeng1,
liuyonglong, lihuisong
Use HWMON_CHANNEL_INFO macro to simplify code.
Signed-off-by: Huisong Li <lihuisong@huawei.com>
---
.../net/ethernet/aquantia/atlantic/aq_drvinfo.c | 14 ++------------
1 file changed, 2 insertions(+), 12 deletions(-)
diff --git a/drivers/net/ethernet/aquantia/atlantic/aq_drvinfo.c b/drivers/net/ethernet/aquantia/atlantic/aq_drvinfo.c
index 414b2e448d59..787ea91802e7 100644
--- a/drivers/net/ethernet/aquantia/atlantic/aq_drvinfo.c
+++ b/drivers/net/ethernet/aquantia/atlantic/aq_drvinfo.c
@@ -113,19 +113,9 @@ static const struct hwmon_ops aq_hwmon_ops = {
.read_string = aq_hwmon_read_string,
};
-static u32 aq_hwmon_temp_config[] = {
- HWMON_T_INPUT | HWMON_T_LABEL,
- HWMON_T_INPUT | HWMON_T_LABEL,
- 0,
-};
-
-static const struct hwmon_channel_info aq_hwmon_temp = {
- .type = hwmon_temp,
- .config = aq_hwmon_temp_config,
-};
-
static const struct hwmon_channel_info * const aq_hwmon_info[] = {
- &aq_hwmon_temp,
+ HWMON_CHANNEL_INFO(temp, HWMON_T_INPUT | HWMON_T_LABEL,
+ HWMON_T_INPUT | HWMON_T_LABEL),
NULL,
};
--
2.22.0
^ permalink raw reply related [flat|nested] 40+ messages in thread* [PATCH v1 04/21] net: nfp: Use HWMON_CHANNEL_INFO macro to simplify code
2025-01-21 6:44 [PATCH v1 00/21] hwmon: Fix the type of 'config' in struct hwmon_channel_info to u64 Huisong Li
` (2 preceding siblings ...)
2025-01-21 6:45 ` [PATCH v1 03/21] net: aquantia: " Huisong Li
@ 2025-01-21 6:45 ` Huisong Li
2025-01-21 6:45 ` [PATCH v1 05/21] net: phy: marvell: " Huisong Li
` (18 subsequent siblings)
22 siblings, 0 replies; 40+ messages in thread
From: Huisong Li @ 2025-01-21 6:45 UTC (permalink / raw)
To: linux-hwmon
Cc: linux-kernel, linux-media, linux-arm-kernel, arm-scmi, netdev,
linux-rtc, oss-drivers, linux-rdma, platform-driver-x86, linuxarm,
linux, jdelvare, kernel, pauk.denis, james, sudeep.holla,
cristian.marussi, matt, mchehab, irusskikh, andrew+netdev, davem,
edumazet, kuba, pabeni, saeedm, leon, tariqt, louis.peens,
hkallweit1, linux, kabel, W_Armin, hdegoede, ilpo.jarvinen,
alexandre.belloni, krzk, jonathan.cameron, zhanjie9, zhenglifeng1,
liuyonglong, lihuisong
Use HWMON_CHANNEL_INFO macro to simplify code.
Signed-off-by: Huisong Li <lihuisong@huawei.com>
---
.../net/ethernet/netronome/nfp/nfp_hwmon.c | 40 +++----------------
1 file changed, 5 insertions(+), 35 deletions(-)
diff --git a/drivers/net/ethernet/netronome/nfp/nfp_hwmon.c b/drivers/net/ethernet/netronome/nfp/nfp_hwmon.c
index 0d6c59d6d4ae..ea6a288c0d5e 100644
--- a/drivers/net/ethernet/netronome/nfp/nfp_hwmon.c
+++ b/drivers/net/ethernet/netronome/nfp/nfp_hwmon.c
@@ -83,42 +83,12 @@ nfp_hwmon_is_visible(const void *data, enum hwmon_sensor_types type, u32 attr,
return 0;
}
-static u32 nfp_chip_config[] = {
- HWMON_C_REGISTER_TZ,
- 0
-};
-
-static const struct hwmon_channel_info nfp_chip = {
- .type = hwmon_chip,
- .config = nfp_chip_config,
-};
-
-static u32 nfp_temp_config[] = {
- HWMON_T_INPUT | HWMON_T_MAX | HWMON_T_CRIT,
- 0
-};
-
-static const struct hwmon_channel_info nfp_temp = {
- .type = hwmon_temp,
- .config = nfp_temp_config,
-};
-
-static u32 nfp_power_config[] = {
- HWMON_P_INPUT | HWMON_P_MAX,
- HWMON_P_INPUT,
- HWMON_P_INPUT,
- 0
-};
-
-static const struct hwmon_channel_info nfp_power = {
- .type = hwmon_power,
- .config = nfp_power_config,
-};
-
static const struct hwmon_channel_info * const nfp_hwmon_info[] = {
- &nfp_chip,
- &nfp_temp,
- &nfp_power,
+ HWMON_CHANNEL_INFO(chip, HWMON_C_REGISTER_TZ),
+ HWMON_CHANNEL_INFO(temp, HWMON_T_INPUT | HWMON_T_MAX | HWMON_T_CRIT),
+ HWMON_CHANNEL_INFO(power, HWMON_P_INPUT | HWMON_P_MAX,
+ HWMON_P_INPUT,
+ HWMON_P_INPUT),
NULL
};
--
2.22.0
^ permalink raw reply related [flat|nested] 40+ messages in thread* [PATCH v1 05/21] net: phy: marvell: Use HWMON_CHANNEL_INFO macro to simplify code
2025-01-21 6:44 [PATCH v1 00/21] hwmon: Fix the type of 'config' in struct hwmon_channel_info to u64 Huisong Li
` (3 preceding siblings ...)
2025-01-21 6:45 ` [PATCH v1 04/21] net: nfp: " Huisong Li
@ 2025-01-21 6:45 ` Huisong Li
2025-01-21 6:45 ` [PATCH v1 06/21] net: phy: marvell10g: " Huisong Li
` (17 subsequent siblings)
22 siblings, 0 replies; 40+ messages in thread
From: Huisong Li @ 2025-01-21 6:45 UTC (permalink / raw)
To: linux-hwmon
Cc: linux-kernel, linux-media, linux-arm-kernel, arm-scmi, netdev,
linux-rtc, oss-drivers, linux-rdma, platform-driver-x86, linuxarm,
linux, jdelvare, kernel, pauk.denis, james, sudeep.holla,
cristian.marussi, matt, mchehab, irusskikh, andrew+netdev, davem,
edumazet, kuba, pabeni, saeedm, leon, tariqt, louis.peens,
hkallweit1, linux, kabel, W_Armin, hdegoede, ilpo.jarvinen,
alexandre.belloni, krzk, jonathan.cameron, zhanjie9, zhenglifeng1,
liuyonglong, lihuisong
Use HWMON_CHANNEL_INFO macro to simplify code.
Signed-off-by: Huisong Li <lihuisong@huawei.com>
---
drivers/net/phy/marvell.c | 24 ++----------------------
1 file changed, 2 insertions(+), 22 deletions(-)
diff --git a/drivers/net/phy/marvell.c b/drivers/net/phy/marvell.c
index 44e1927de499..dd254e36ca8a 100644
--- a/drivers/net/phy/marvell.c
+++ b/drivers/net/phy/marvell.c
@@ -3124,33 +3124,13 @@ static umode_t marvell_hwmon_is_visible(const void *data,
}
}
-static u32 marvell_hwmon_chip_config[] = {
- HWMON_C_REGISTER_TZ,
- 0
-};
-
-static const struct hwmon_channel_info marvell_hwmon_chip = {
- .type = hwmon_chip,
- .config = marvell_hwmon_chip_config,
-};
-
/* we can define HWMON_T_CRIT and HWMON_T_MAX_ALARM even though these are not
* defined for all PHYs, because the hwmon code checks whether the attributes
* exists via the .is_visible method
*/
-static u32 marvell_hwmon_temp_config[] = {
- HWMON_T_INPUT | HWMON_T_CRIT | HWMON_T_MAX_ALARM,
- 0
-};
-
-static const struct hwmon_channel_info marvell_hwmon_temp = {
- .type = hwmon_temp,
- .config = marvell_hwmon_temp_config,
-};
-
static const struct hwmon_channel_info * const marvell_hwmon_info[] = {
- &marvell_hwmon_chip,
- &marvell_hwmon_temp,
+ HWMON_CHANNEL_INFO(chip, HWMON_C_REGISTER_TZ),
+ HWMON_CHANNEL_INFO(temp, HWMON_T_INPUT | HWMON_T_CRIT | HWMON_T_MAX_ALARM),
NULL
};
--
2.22.0
^ permalink raw reply related [flat|nested] 40+ messages in thread* [PATCH v1 06/21] net: phy: marvell10g: Use HWMON_CHANNEL_INFO macro to simplify code
2025-01-21 6:44 [PATCH v1 00/21] hwmon: Fix the type of 'config' in struct hwmon_channel_info to u64 Huisong Li
` (4 preceding siblings ...)
2025-01-21 6:45 ` [PATCH v1 05/21] net: phy: marvell: " Huisong Li
@ 2025-01-21 6:45 ` Huisong Li
2025-01-21 6:45 ` [PATCH v1 07/21] rtc: ab-eoz9: " Huisong Li
` (16 subsequent siblings)
22 siblings, 0 replies; 40+ messages in thread
From: Huisong Li @ 2025-01-21 6:45 UTC (permalink / raw)
To: linux-hwmon
Cc: linux-kernel, linux-media, linux-arm-kernel, arm-scmi, netdev,
linux-rtc, oss-drivers, linux-rdma, platform-driver-x86, linuxarm,
linux, jdelvare, kernel, pauk.denis, james, sudeep.holla,
cristian.marussi, matt, mchehab, irusskikh, andrew+netdev, davem,
edumazet, kuba, pabeni, saeedm, leon, tariqt, louis.peens,
hkallweit1, linux, kabel, W_Armin, hdegoede, ilpo.jarvinen,
alexandre.belloni, krzk, jonathan.cameron, zhanjie9, zhenglifeng1,
liuyonglong, lihuisong
Use HWMON_CHANNEL_INFO macro to simplify code.
Signed-off-by: Huisong Li <lihuisong@huawei.com>
---
drivers/net/phy/marvell10g.c | 24 ++----------------------
1 file changed, 2 insertions(+), 22 deletions(-)
diff --git a/drivers/net/phy/marvell10g.c b/drivers/net/phy/marvell10g.c
index 623bdb8466b8..5354c8895163 100644
--- a/drivers/net/phy/marvell10g.c
+++ b/drivers/net/phy/marvell10g.c
@@ -230,29 +230,9 @@ static const struct hwmon_ops mv3310_hwmon_ops = {
.read = mv3310_hwmon_read,
};
-static u32 mv3310_hwmon_chip_config[] = {
- HWMON_C_REGISTER_TZ | HWMON_C_UPDATE_INTERVAL,
- 0,
-};
-
-static const struct hwmon_channel_info mv3310_hwmon_chip = {
- .type = hwmon_chip,
- .config = mv3310_hwmon_chip_config,
-};
-
-static u32 mv3310_hwmon_temp_config[] = {
- HWMON_T_INPUT,
- 0,
-};
-
-static const struct hwmon_channel_info mv3310_hwmon_temp = {
- .type = hwmon_temp,
- .config = mv3310_hwmon_temp_config,
-};
-
static const struct hwmon_channel_info * const mv3310_hwmon_info[] = {
- &mv3310_hwmon_chip,
- &mv3310_hwmon_temp,
+ HWMON_CHANNEL_INFO(chip, HWMON_C_REGISTER_TZ | HWMON_C_UPDATE_INTERVAL),
+ HWMON_CHANNEL_INFO(temp, HWMON_T_INPUT),
NULL,
};
--
2.22.0
^ permalink raw reply related [flat|nested] 40+ messages in thread* [PATCH v1 07/21] rtc: ab-eoz9: Use HWMON_CHANNEL_INFO macro to simplify code
2025-01-21 6:44 [PATCH v1 00/21] hwmon: Fix the type of 'config' in struct hwmon_channel_info to u64 Huisong Li
` (5 preceding siblings ...)
2025-01-21 6:45 ` [PATCH v1 06/21] net: phy: marvell10g: " Huisong Li
@ 2025-01-21 6:45 ` Huisong Li
2025-01-21 6:45 ` [PATCH v1 08/21] rtc: ds3232: " Huisong Li
` (15 subsequent siblings)
22 siblings, 0 replies; 40+ messages in thread
From: Huisong Li @ 2025-01-21 6:45 UTC (permalink / raw)
To: linux-hwmon
Cc: linux-kernel, linux-media, linux-arm-kernel, arm-scmi, netdev,
linux-rtc, oss-drivers, linux-rdma, platform-driver-x86, linuxarm,
linux, jdelvare, kernel, pauk.denis, james, sudeep.holla,
cristian.marussi, matt, mchehab, irusskikh, andrew+netdev, davem,
edumazet, kuba, pabeni, saeedm, leon, tariqt, louis.peens,
hkallweit1, linux, kabel, W_Armin, hdegoede, ilpo.jarvinen,
alexandre.belloni, krzk, jonathan.cameron, zhanjie9, zhenglifeng1,
liuyonglong, lihuisong
Use HWMON_CHANNEL_INFO macro to simplify code.
Signed-off-by: Huisong Li <lihuisong@huawei.com>
---
drivers/rtc/rtc-ab-eoz9.c | 24 ++----------------------
1 file changed, 2 insertions(+), 22 deletions(-)
diff --git a/drivers/rtc/rtc-ab-eoz9.c b/drivers/rtc/rtc-ab-eoz9.c
index d2b60487d462..de002f7a39bf 100644
--- a/drivers/rtc/rtc-ab-eoz9.c
+++ b/drivers/rtc/rtc-ab-eoz9.c
@@ -426,29 +426,9 @@ static umode_t abeoz9_is_visible(const void *data,
}
}
-static const u32 abeoz9_chip_config[] = {
- HWMON_C_REGISTER_TZ,
- 0
-};
-
-static const struct hwmon_channel_info abeoz9_chip = {
- .type = hwmon_chip,
- .config = abeoz9_chip_config,
-};
-
-static const u32 abeoz9_temp_config[] = {
- HWMON_T_INPUT | HWMON_T_MAX | HWMON_T_MIN,
- 0
-};
-
-static const struct hwmon_channel_info abeoz9_temp = {
- .type = hwmon_temp,
- .config = abeoz9_temp_config,
-};
-
static const struct hwmon_channel_info * const abeoz9_info[] = {
- &abeoz9_chip,
- &abeoz9_temp,
+ HWMON_CHANNEL_INFO(chip, HWMON_C_REGISTER_TZ),
+ HWMON_CHANNEL_INFO(temp, HWMON_T_INPUT | HWMON_T_MAX | HWMON_T_MIN),
NULL
};
--
2.22.0
^ permalink raw reply related [flat|nested] 40+ messages in thread* [PATCH v1 08/21] rtc: ds3232: Use HWMON_CHANNEL_INFO macro to simplify code
2025-01-21 6:44 [PATCH v1 00/21] hwmon: Fix the type of 'config' in struct hwmon_channel_info to u64 Huisong Li
` (6 preceding siblings ...)
2025-01-21 6:45 ` [PATCH v1 07/21] rtc: ab-eoz9: " Huisong Li
@ 2025-01-21 6:45 ` Huisong Li
2025-01-21 6:45 ` [PATCH v1 09/21] w1: w1_therm: w1: " Huisong Li
` (14 subsequent siblings)
22 siblings, 0 replies; 40+ messages in thread
From: Huisong Li @ 2025-01-21 6:45 UTC (permalink / raw)
To: linux-hwmon
Cc: linux-kernel, linux-media, linux-arm-kernel, arm-scmi, netdev,
linux-rtc, oss-drivers, linux-rdma, platform-driver-x86, linuxarm,
linux, jdelvare, kernel, pauk.denis, james, sudeep.holla,
cristian.marussi, matt, mchehab, irusskikh, andrew+netdev, davem,
edumazet, kuba, pabeni, saeedm, leon, tariqt, louis.peens,
hkallweit1, linux, kabel, W_Armin, hdegoede, ilpo.jarvinen,
alexandre.belloni, krzk, jonathan.cameron, zhanjie9, zhenglifeng1,
liuyonglong, lihuisong
Use HWMON_CHANNEL_INFO macro to simplify code.
Signed-off-by: Huisong Li <lihuisong@huawei.com>
---
drivers/rtc/rtc-ds3232.c | 24 ++----------------------
1 file changed, 2 insertions(+), 22 deletions(-)
diff --git a/drivers/rtc/rtc-ds3232.c b/drivers/rtc/rtc-ds3232.c
index 19c09c418746..18f35823b4b5 100644
--- a/drivers/rtc/rtc-ds3232.c
+++ b/drivers/rtc/rtc-ds3232.c
@@ -339,29 +339,9 @@ static int ds3232_hwmon_read(struct device *dev,
return err;
}
-static u32 ds3232_hwmon_chip_config[] = {
- HWMON_C_REGISTER_TZ,
- 0
-};
-
-static const struct hwmon_channel_info ds3232_hwmon_chip = {
- .type = hwmon_chip,
- .config = ds3232_hwmon_chip_config,
-};
-
-static u32 ds3232_hwmon_temp_config[] = {
- HWMON_T_INPUT,
- 0
-};
-
-static const struct hwmon_channel_info ds3232_hwmon_temp = {
- .type = hwmon_temp,
- .config = ds3232_hwmon_temp_config,
-};
-
static const struct hwmon_channel_info * const ds3232_hwmon_info[] = {
- &ds3232_hwmon_chip,
- &ds3232_hwmon_temp,
+ HWMON_CHANNEL_INFO(chip, HWMON_C_REGISTER_TZ),
+ HWMON_CHANNEL_INFO(temp, HWMON_T_INPUT),
NULL
};
--
2.22.0
^ permalink raw reply related [flat|nested] 40+ messages in thread* [PATCH v1 09/21] w1: w1_therm: w1: Use HWMON_CHANNEL_INFO macro to simplify code
2025-01-21 6:44 [PATCH v1 00/21] hwmon: Fix the type of 'config' in struct hwmon_channel_info to u64 Huisong Li
` (7 preceding siblings ...)
2025-01-21 6:45 ` [PATCH v1 08/21] rtc: ds3232: " Huisong Li
@ 2025-01-21 6:45 ` Huisong Li
2025-01-21 6:45 ` [PATCH v1 10/21] net: phy: aquantia: " Huisong Li
` (13 subsequent siblings)
22 siblings, 0 replies; 40+ messages in thread
From: Huisong Li @ 2025-01-21 6:45 UTC (permalink / raw)
To: linux-hwmon
Cc: linux-kernel, linux-media, linux-arm-kernel, arm-scmi, netdev,
linux-rtc, oss-drivers, linux-rdma, platform-driver-x86, linuxarm,
linux, jdelvare, kernel, pauk.denis, james, sudeep.holla,
cristian.marussi, matt, mchehab, irusskikh, andrew+netdev, davem,
edumazet, kuba, pabeni, saeedm, leon, tariqt, louis.peens,
hkallweit1, linux, kabel, W_Armin, hdegoede, ilpo.jarvinen,
alexandre.belloni, krzk, jonathan.cameron, zhanjie9, zhenglifeng1,
liuyonglong, lihuisong
Use HWMON_CHANNEL_INFO macro to simplify code.
Signed-off-by: Huisong Li <lihuisong@huawei.com>
---
drivers/w1/slaves/w1_therm.c | 12 +-----------
1 file changed, 1 insertion(+), 11 deletions(-)
diff --git a/drivers/w1/slaves/w1_therm.c b/drivers/w1/slaves/w1_therm.c
index c85e80c7e130..9ccedb3264fb 100644
--- a/drivers/w1/slaves/w1_therm.c
+++ b/drivers/w1/slaves/w1_therm.c
@@ -444,18 +444,8 @@ static int w1_read(struct device *dev, enum hwmon_sensor_types type,
}
}
-static const u32 w1_temp_config[] = {
- HWMON_T_INPUT,
- 0
-};
-
-static const struct hwmon_channel_info w1_temp = {
- .type = hwmon_temp,
- .config = w1_temp_config,
-};
-
static const struct hwmon_channel_info * const w1_info[] = {
- &w1_temp,
+ HWMON_CHANNEL_INFO(temp, HWMON_T_INPUT),
NULL
};
--
2.22.0
^ permalink raw reply related [flat|nested] 40+ messages in thread* [PATCH v1 10/21] net: phy: aquantia: Use HWMON_CHANNEL_INFO macro to simplify code
2025-01-21 6:44 [PATCH v1 00/21] hwmon: Fix the type of 'config' in struct hwmon_channel_info to u64 Huisong Li
` (8 preceding siblings ...)
2025-01-21 6:45 ` [PATCH v1 09/21] w1: w1_therm: w1: " Huisong Li
@ 2025-01-21 6:45 ` Huisong Li
2025-01-21 6:45 ` [PATCH v1 11/21] hwmon: (asus_wmi_sensors) Fix type of 'config' in struct hwmon_channel_info to u64 Huisong Li
` (12 subsequent siblings)
22 siblings, 0 replies; 40+ messages in thread
From: Huisong Li @ 2025-01-21 6:45 UTC (permalink / raw)
To: linux-hwmon
Cc: linux-kernel, linux-media, linux-arm-kernel, arm-scmi, netdev,
linux-rtc, oss-drivers, linux-rdma, platform-driver-x86, linuxarm,
linux, jdelvare, kernel, pauk.denis, james, sudeep.holla,
cristian.marussi, matt, mchehab, irusskikh, andrew+netdev, davem,
edumazet, kuba, pabeni, saeedm, leon, tariqt, louis.peens,
hkallweit1, linux, kabel, W_Armin, hdegoede, ilpo.jarvinen,
alexandre.belloni, krzk, jonathan.cameron, zhanjie9, zhenglifeng1,
liuyonglong, lihuisong
Use HWMON_CHANNEL_INFO macro to simplify code.
Signed-off-by: Huisong Li <lihuisong@huawei.com>
---
drivers/net/phy/aquantia/aquantia_hwmon.c | 32 +++++------------------
1 file changed, 6 insertions(+), 26 deletions(-)
diff --git a/drivers/net/phy/aquantia/aquantia_hwmon.c b/drivers/net/phy/aquantia/aquantia_hwmon.c
index 7b3c49c3bf49..02b7a2639bbb 100644
--- a/drivers/net/phy/aquantia/aquantia_hwmon.c
+++ b/drivers/net/phy/aquantia/aquantia_hwmon.c
@@ -172,33 +172,13 @@ static const struct hwmon_ops aqr_hwmon_ops = {
.write = aqr_hwmon_write,
};
-static u32 aqr_hwmon_chip_config[] = {
- HWMON_C_REGISTER_TZ,
- 0,
-};
-
-static const struct hwmon_channel_info aqr_hwmon_chip = {
- .type = hwmon_chip,
- .config = aqr_hwmon_chip_config,
-};
-
-static u32 aqr_hwmon_temp_config[] = {
- HWMON_T_INPUT |
- HWMON_T_MAX | HWMON_T_MIN |
- HWMON_T_MAX_ALARM | HWMON_T_MIN_ALARM |
- HWMON_T_CRIT | HWMON_T_LCRIT |
- HWMON_T_CRIT_ALARM | HWMON_T_LCRIT_ALARM,
- 0,
-};
-
-static const struct hwmon_channel_info aqr_hwmon_temp = {
- .type = hwmon_temp,
- .config = aqr_hwmon_temp_config,
-};
-
static const struct hwmon_channel_info * const aqr_hwmon_info[] = {
- &aqr_hwmon_chip,
- &aqr_hwmon_temp,
+ HWMON_CHANNEL_INFO(chip, HWMON_C_REGISTER_TZ),
+ HWMON_CHANNEL_INFO(temp, HWMON_T_INPUT |
+ HWMON_T_MAX | HWMON_T_MIN |
+ HWMON_T_MAX_ALARM | HWMON_T_MIN_ALARM |
+ HWMON_T_CRIT | HWMON_T_LCRIT |
+ HWMON_T_CRIT_ALARM | HWMON_T_LCRIT_ALARM),
NULL,
};
--
2.22.0
^ permalink raw reply related [flat|nested] 40+ messages in thread* [PATCH v1 11/21] hwmon: (asus_wmi_sensors) Fix type of 'config' in struct hwmon_channel_info to u64
2025-01-21 6:44 [PATCH v1 00/21] hwmon: Fix the type of 'config' in struct hwmon_channel_info to u64 Huisong Li
` (9 preceding siblings ...)
2025-01-21 6:45 ` [PATCH v1 10/21] net: phy: aquantia: " Huisong Li
@ 2025-01-21 6:45 ` Huisong Li
2025-01-21 6:45 ` [PATCH v1 12/21] hwmon: (hp-wmi-sensors) " Huisong Li
` (11 subsequent siblings)
22 siblings, 0 replies; 40+ messages in thread
From: Huisong Li @ 2025-01-21 6:45 UTC (permalink / raw)
To: linux-hwmon
Cc: linux-kernel, linux-media, linux-arm-kernel, arm-scmi, netdev,
linux-rtc, oss-drivers, linux-rdma, platform-driver-x86, linuxarm,
linux, jdelvare, kernel, pauk.denis, james, sudeep.holla,
cristian.marussi, matt, mchehab, irusskikh, andrew+netdev, davem,
edumazet, kuba, pabeni, saeedm, leon, tariqt, louis.peens,
hkallweit1, linux, kabel, W_Armin, hdegoede, ilpo.jarvinen,
alexandre.belloni, krzk, jonathan.cameron, zhanjie9, zhenglifeng1,
liuyonglong, lihuisong
The type of 'config' in struct hwmon_channel_info has been fixed to u64.
Modify the related code in driver to avoid compiling failure.
Signed-off-by: Huisong Li <lihuisong@huawei.com>
---
drivers/hwmon/asus_wmi_sensors.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/hwmon/asus_wmi_sensors.c b/drivers/hwmon/asus_wmi_sensors.c
index c2dd7ff882f2..9593674fc5df 100644
--- a/drivers/hwmon/asus_wmi_sensors.c
+++ b/drivers/hwmon/asus_wmi_sensors.c
@@ -126,7 +126,7 @@ static enum hwmon_sensor_types asus_data_types[] = {
[WATER_FLOW] = hwmon_fan,
};
-static u32 hwmon_attributes[hwmon_max] = {
+static u64 hwmon_attributes[hwmon_max] = {
[hwmon_chip] = HWMON_C_REGISTER_TZ,
[hwmon_temp] = HWMON_T_INPUT | HWMON_T_LABEL,
[hwmon_in] = HWMON_I_INPUT | HWMON_I_LABEL,
@@ -248,9 +248,9 @@ static int asus_wmi_get_item_count(u32 *count)
static int asus_wmi_hwmon_add_chan_info(struct hwmon_channel_info *asus_wmi_hwmon_chan,
struct device *dev, int num,
- enum hwmon_sensor_types type, u32 config)
+ enum hwmon_sensor_types type, u64 config)
{
- u32 *cfg;
+ u64 *cfg;
cfg = devm_kcalloc(dev, num + 1, sizeof(*cfg), GFP_KERNEL);
if (!cfg)
@@ -258,7 +258,7 @@ static int asus_wmi_hwmon_add_chan_info(struct hwmon_channel_info *asus_wmi_hwmo
asus_wmi_hwmon_chan->type = type;
asus_wmi_hwmon_chan->config = cfg;
- memset32(cfg, config, num);
+ memset64(cfg, config, num);
return 0;
}
--
2.22.0
^ permalink raw reply related [flat|nested] 40+ messages in thread* [PATCH v1 12/21] hwmon: (hp-wmi-sensors) Fix type of 'config' in struct hwmon_channel_info to u64
2025-01-21 6:44 [PATCH v1 00/21] hwmon: Fix the type of 'config' in struct hwmon_channel_info to u64 Huisong Li
` (10 preceding siblings ...)
2025-01-21 6:45 ` [PATCH v1 11/21] hwmon: (asus_wmi_sensors) Fix type of 'config' in struct hwmon_channel_info to u64 Huisong Li
@ 2025-01-21 6:45 ` Huisong Li
2025-01-21 6:45 ` [PATCH v1 13/21] hwmon: (mr75203) Fix the " Huisong Li
` (10 subsequent siblings)
22 siblings, 0 replies; 40+ messages in thread
From: Huisong Li @ 2025-01-21 6:45 UTC (permalink / raw)
To: linux-hwmon
Cc: linux-kernel, linux-media, linux-arm-kernel, arm-scmi, netdev,
linux-rtc, oss-drivers, linux-rdma, platform-driver-x86, linuxarm,
linux, jdelvare, kernel, pauk.denis, james, sudeep.holla,
cristian.marussi, matt, mchehab, irusskikh, andrew+netdev, davem,
edumazet, kuba, pabeni, saeedm, leon, tariqt, louis.peens,
hkallweit1, linux, kabel, W_Armin, hdegoede, ilpo.jarvinen,
alexandre.belloni, krzk, jonathan.cameron, zhanjie9, zhenglifeng1,
liuyonglong, lihuisong
The type of 'config' in struct hwmon_channel_info has been fixed to u64.
Modify the related code in driver to avoid compiling failure.
Signed-off-by: Huisong Li <lihuisong@huawei.com>
---
drivers/hwmon/hp-wmi-sensors.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/hwmon/hp-wmi-sensors.c b/drivers/hwmon/hp-wmi-sensors.c
index d6bdad26feb1..b0d7c7de0565 100644
--- a/drivers/hwmon/hp-wmi-sensors.c
+++ b/drivers/hwmon/hp-wmi-sensors.c
@@ -1921,8 +1921,8 @@ static int make_chip_info(struct hp_wmi_sensors *state, bool has_events)
struct device *dev = &state->wdev->dev;
enum hwmon_sensor_types type;
u8 type_count = 0;
- u32 *config;
- u32 attr;
+ u64 *config;
+ u64 attr;
u8 count;
u8 i;
@@ -1961,7 +1961,7 @@ static int make_chip_info(struct hp_wmi_sensors *state, bool has_events)
attr = hp_wmi_hwmon_attributes[type];
channel_info->type = type;
channel_info->config = config;
- memset32(config, attr, count);
+ memset64(config, attr, count);
*ptr_channel_info++ = channel_info++;
--
2.22.0
^ permalink raw reply related [flat|nested] 40+ messages in thread* [PATCH v1 13/21] hwmon: (mr75203) Fix the type of 'config' in struct hwmon_channel_info to u64
2025-01-21 6:44 [PATCH v1 00/21] hwmon: Fix the type of 'config' in struct hwmon_channel_info to u64 Huisong Li
` (11 preceding siblings ...)
2025-01-21 6:45 ` [PATCH v1 12/21] hwmon: (hp-wmi-sensors) " Huisong Li
@ 2025-01-21 6:45 ` Huisong Li
2025-01-21 6:45 ` [PATCH v1 14/21] hwmon: (pwm-fan) " Huisong Li
` (9 subsequent siblings)
22 siblings, 0 replies; 40+ messages in thread
From: Huisong Li @ 2025-01-21 6:45 UTC (permalink / raw)
To: linux-hwmon
Cc: linux-kernel, linux-media, linux-arm-kernel, arm-scmi, netdev,
linux-rtc, oss-drivers, linux-rdma, platform-driver-x86, linuxarm,
linux, jdelvare, kernel, pauk.denis, james, sudeep.holla,
cristian.marussi, matt, mchehab, irusskikh, andrew+netdev, davem,
edumazet, kuba, pabeni, saeedm, leon, tariqt, louis.peens,
hkallweit1, linux, kabel, W_Armin, hdegoede, ilpo.jarvinen,
alexandre.belloni, krzk, jonathan.cameron, zhanjie9, zhenglifeng1,
liuyonglong, lihuisong
The type of 'config' in struct hwmon_channel_info has been fixed to u64.
Modify the related code in driver to avoid compiling failure.
Signed-off-by: Huisong Li <lihuisong@huawei.com>
---
drivers/hwmon/mr75203.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/hwmon/mr75203.c b/drivers/hwmon/mr75203.c
index 7848198f8996..82d399b719a9 100644
--- a/drivers/hwmon/mr75203.c
+++ b/drivers/hwmon/mr75203.c
@@ -769,7 +769,7 @@ static int mr75203_probe(struct platform_device *pdev)
u32 ts_num, vm_num, pd_num, ch_num, val, index, i;
const struct hwmon_channel_info **pvt_info;
struct device *dev = &pdev->dev;
- u32 *temp_config, *in_config;
+ u64 *temp_config, *in_config;
struct device *hwmon_dev;
struct pvt_device *pvt;
int ret;
@@ -837,7 +837,7 @@ static int mr75203_probe(struct platform_device *pdev)
if (!temp_config)
return -ENOMEM;
- memset32(temp_config, HWMON_T_INPUT, ts_num);
+ memset64(temp_config, HWMON_T_INPUT, ts_num);
pvt_temp.config = temp_config;
pvt_info[index++] = &pvt_temp;
@@ -888,7 +888,7 @@ static int mr75203_probe(struct platform_device *pdev)
if (!in_config)
return -ENOMEM;
- memset32(in_config, HWMON_I_INPUT, pvt->vm_channels.total);
+ memset64(in_config, HWMON_I_INPUT, pvt->vm_channels.total);
in_config[pvt->vm_channels.total] = 0;
pvt_in.config = in_config;
--
2.22.0
^ permalink raw reply related [flat|nested] 40+ messages in thread* [PATCH v1 14/21] hwmon: (pwm-fan) Fix the type of 'config' in struct hwmon_channel_info to u64
2025-01-21 6:44 [PATCH v1 00/21] hwmon: Fix the type of 'config' in struct hwmon_channel_info to u64 Huisong Li
` (12 preceding siblings ...)
2025-01-21 6:45 ` [PATCH v1 13/21] hwmon: (mr75203) Fix the " Huisong Li
@ 2025-01-21 6:45 ` Huisong Li
2025-01-21 6:45 ` [PATCH v1 15/21] hwmon: (scmi-hwmon) " Huisong Li
` (8 subsequent siblings)
22 siblings, 0 replies; 40+ messages in thread
From: Huisong Li @ 2025-01-21 6:45 UTC (permalink / raw)
To: linux-hwmon
Cc: linux-kernel, linux-media, linux-arm-kernel, arm-scmi, netdev,
linux-rtc, oss-drivers, linux-rdma, platform-driver-x86, linuxarm,
linux, jdelvare, kernel, pauk.denis, james, sudeep.holla,
cristian.marussi, matt, mchehab, irusskikh, andrew+netdev, davem,
edumazet, kuba, pabeni, saeedm, leon, tariqt, louis.peens,
hkallweit1, linux, kabel, W_Armin, hdegoede, ilpo.jarvinen,
alexandre.belloni, krzk, jonathan.cameron, zhanjie9, zhenglifeng1,
liuyonglong, lihuisong
The type of 'config' in struct hwmon_channel_info has been fixed to u64.
Modify the related code in driver to avoid compiling failure.
Signed-off-by: Huisong Li <lihuisong@huawei.com>
---
drivers/hwmon/pwm-fan.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/hwmon/pwm-fan.c b/drivers/hwmon/pwm-fan.c
index 579d31bb9ac7..91bb6d590a36 100644
--- a/drivers/hwmon/pwm-fan.c
+++ b/drivers/hwmon/pwm-fan.c
@@ -498,7 +498,7 @@ static int pwm_fan_probe(struct platform_device *pdev)
int ret;
const struct hwmon_channel_info **channels;
u32 initial_pwm, pwm_min_from_stopped = 0;
- u32 *fan_channel_config;
+ u64 *fan_channel_config;
int channel_count = 1; /* We always have a PWM channel. */
int i;
@@ -586,7 +586,7 @@ static int pwm_fan_probe(struct platform_device *pdev)
ctx->fan_channel.type = hwmon_fan;
fan_channel_config = devm_kcalloc(dev, ctx->tach_count + 1,
- sizeof(u32), GFP_KERNEL);
+ sizeof(u64), GFP_KERNEL);
if (!fan_channel_config)
return -ENOMEM;
ctx->fan_channel.config = fan_channel_config;
--
2.22.0
^ permalink raw reply related [flat|nested] 40+ messages in thread* [PATCH v1 15/21] hwmon: (scmi-hwmon) Fix the type of 'config' in struct hwmon_channel_info to u64
2025-01-21 6:44 [PATCH v1 00/21] hwmon: Fix the type of 'config' in struct hwmon_channel_info to u64 Huisong Li
` (13 preceding siblings ...)
2025-01-21 6:45 ` [PATCH v1 14/21] hwmon: (pwm-fan) " Huisong Li
@ 2025-01-21 6:45 ` Huisong Li
2025-01-21 6:45 ` [PATCH v1 16/21] hwmon: (tmp401) " Huisong Li
` (7 subsequent siblings)
22 siblings, 0 replies; 40+ messages in thread
From: Huisong Li @ 2025-01-21 6:45 UTC (permalink / raw)
To: linux-hwmon
Cc: linux-kernel, linux-media, linux-arm-kernel, arm-scmi, netdev,
linux-rtc, oss-drivers, linux-rdma, platform-driver-x86, linuxarm,
linux, jdelvare, kernel, pauk.denis, james, sudeep.holla,
cristian.marussi, matt, mchehab, irusskikh, andrew+netdev, davem,
edumazet, kuba, pabeni, saeedm, leon, tariqt, louis.peens,
hkallweit1, linux, kabel, W_Armin, hdegoede, ilpo.jarvinen,
alexandre.belloni, krzk, jonathan.cameron, zhanjie9, zhenglifeng1,
liuyonglong, lihuisong
The type of 'config' in struct hwmon_channel_info has been fixed to u64.
Modify the related code in driver to avoid compiling failure.
Signed-off-by: Huisong Li <lihuisong@huawei.com>
---
drivers/hwmon/scmi-hwmon.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/hwmon/scmi-hwmon.c b/drivers/hwmon/scmi-hwmon.c
index 364199b332c0..b4b43e200d2a 100644
--- a/drivers/hwmon/scmi-hwmon.c
+++ b/drivers/hwmon/scmi-hwmon.c
@@ -157,10 +157,10 @@ static const struct thermal_zone_device_ops scmi_hwmon_thermal_ops = {
static int scmi_hwmon_add_chan_info(struct hwmon_channel_info *scmi_hwmon_chan,
struct device *dev, int num,
- enum hwmon_sensor_types type, u32 config)
+ enum hwmon_sensor_types type, u64 config)
{
int i;
- u32 *cfg = devm_kcalloc(dev, num + 1, sizeof(*cfg), GFP_KERNEL);
+ u64 *cfg = devm_kcalloc(dev, num + 1, sizeof(*cfg), GFP_KERNEL);
if (!cfg)
return -ENOMEM;
@@ -181,7 +181,7 @@ static enum hwmon_sensor_types scmi_types[] = {
[ENERGY] = hwmon_energy,
};
-static u32 hwmon_attributes[hwmon_max] = {
+static u64 hwmon_attributes[hwmon_max] = {
[hwmon_temp] = HWMON_T_INPUT | HWMON_T_LABEL,
[hwmon_in] = HWMON_I_INPUT | HWMON_I_LABEL,
[hwmon_curr] = HWMON_C_INPUT | HWMON_C_LABEL,
--
2.22.0
^ permalink raw reply related [flat|nested] 40+ messages in thread* [PATCH v1 16/21] hwmon: (tmp401) Fix the type of 'config' in struct hwmon_channel_info to u64
2025-01-21 6:44 [PATCH v1 00/21] hwmon: Fix the type of 'config' in struct hwmon_channel_info to u64 Huisong Li
` (14 preceding siblings ...)
2025-01-21 6:45 ` [PATCH v1 15/21] hwmon: (scmi-hwmon) " Huisong Li
@ 2025-01-21 6:45 ` Huisong Li
2025-01-21 6:45 ` [PATCH v1 17/21] hwmon: (tmp421) " Huisong Li
` (6 subsequent siblings)
22 siblings, 0 replies; 40+ messages in thread
From: Huisong Li @ 2025-01-21 6:45 UTC (permalink / raw)
To: linux-hwmon
Cc: linux-kernel, linux-media, linux-arm-kernel, arm-scmi, netdev,
linux-rtc, oss-drivers, linux-rdma, platform-driver-x86, linuxarm,
linux, jdelvare, kernel, pauk.denis, james, sudeep.holla,
cristian.marussi, matt, mchehab, irusskikh, andrew+netdev, davem,
edumazet, kuba, pabeni, saeedm, leon, tariqt, louis.peens,
hkallweit1, linux, kabel, W_Armin, hdegoede, ilpo.jarvinen,
alexandre.belloni, krzk, jonathan.cameron, zhanjie9, zhenglifeng1,
liuyonglong, lihuisong
The type of 'config' in struct hwmon_channel_info has been fixed to u64.
Modify the related code in driver to avoid compiling failure.
Signed-off-by: Huisong Li <lihuisong@huawei.com>
---
drivers/hwmon/tmp401.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/hwmon/tmp401.c b/drivers/hwmon/tmp401.c
index 02c5a3bb1071..e62df28a6e50 100644
--- a/drivers/hwmon/tmp401.c
+++ b/drivers/hwmon/tmp401.c
@@ -113,9 +113,9 @@ struct tmp401_data {
bool extended_range;
/* hwmon API configuration data */
- u32 chip_channel_config[4];
+ u64 chip_channel_config[4];
struct hwmon_channel_info chip_info;
- u32 temp_channel_config[4];
+ u64 temp_channel_config[4];
struct hwmon_channel_info temp_info;
const struct hwmon_channel_info *info[3];
struct hwmon_chip_info chip;
--
2.22.0
^ permalink raw reply related [flat|nested] 40+ messages in thread* [PATCH v1 17/21] hwmon: (tmp421) Fix the type of 'config' in struct hwmon_channel_info to u64
2025-01-21 6:44 [PATCH v1 00/21] hwmon: Fix the type of 'config' in struct hwmon_channel_info to u64 Huisong Li
` (15 preceding siblings ...)
2025-01-21 6:45 ` [PATCH v1 16/21] hwmon: (tmp401) " Huisong Li
@ 2025-01-21 6:45 ` Huisong Li
2025-01-21 6:45 ` [PATCH v1 18/21] net/mlx5: " Huisong Li
` (5 subsequent siblings)
22 siblings, 0 replies; 40+ messages in thread
From: Huisong Li @ 2025-01-21 6:45 UTC (permalink / raw)
To: linux-hwmon
Cc: linux-kernel, linux-media, linux-arm-kernel, arm-scmi, netdev,
linux-rtc, oss-drivers, linux-rdma, platform-driver-x86, linuxarm,
linux, jdelvare, kernel, pauk.denis, james, sudeep.holla,
cristian.marussi, matt, mchehab, irusskikh, andrew+netdev, davem,
edumazet, kuba, pabeni, saeedm, leon, tariqt, louis.peens,
hkallweit1, linux, kabel, W_Armin, hdegoede, ilpo.jarvinen,
alexandre.belloni, krzk, jonathan.cameron, zhanjie9, zhenglifeng1,
liuyonglong, lihuisong
The type of 'config' in struct hwmon_channel_info has been fixed to u64.
Modify the related code in driver to avoid compiling failure.
Signed-off-by: Huisong Li <lihuisong@huawei.com>
---
drivers/hwmon/tmp421.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/hwmon/tmp421.c b/drivers/hwmon/tmp421.c
index 9537727aad9a..45bd04ec03b8 100644
--- a/drivers/hwmon/tmp421.c
+++ b/drivers/hwmon/tmp421.c
@@ -100,7 +100,7 @@ struct tmp421_channel {
struct tmp421_data {
struct i2c_client *client;
struct mutex update_lock;
- u32 temp_config[MAX_CHANNELS + 1];
+ u64 temp_config[MAX_CHANNELS + 1];
struct hwmon_channel_info temp_info;
const struct hwmon_channel_info *info[2];
struct hwmon_chip_info chip;
--
2.22.0
^ permalink raw reply related [flat|nested] 40+ messages in thread* [PATCH v1 18/21] net/mlx5: Fix the type of 'config' in struct hwmon_channel_info to u64
2025-01-21 6:44 [PATCH v1 00/21] hwmon: Fix the type of 'config' in struct hwmon_channel_info to u64 Huisong Li
` (16 preceding siblings ...)
2025-01-21 6:45 ` [PATCH v1 17/21] hwmon: (tmp421) " Huisong Li
@ 2025-01-21 6:45 ` Huisong Li
2025-01-21 6:45 ` [PATCH v1 19/21] platform/x86: dell-ddv: " Huisong Li
` (4 subsequent siblings)
22 siblings, 0 replies; 40+ messages in thread
From: Huisong Li @ 2025-01-21 6:45 UTC (permalink / raw)
To: linux-hwmon
Cc: linux-kernel, linux-media, linux-arm-kernel, arm-scmi, netdev,
linux-rtc, oss-drivers, linux-rdma, platform-driver-x86, linuxarm,
linux, jdelvare, kernel, pauk.denis, james, sudeep.holla,
cristian.marussi, matt, mchehab, irusskikh, andrew+netdev, davem,
edumazet, kuba, pabeni, saeedm, leon, tariqt, louis.peens,
hkallweit1, linux, kabel, W_Armin, hdegoede, ilpo.jarvinen,
alexandre.belloni, krzk, jonathan.cameron, zhanjie9, zhenglifeng1,
liuyonglong, lihuisong
The type of 'config' in struct hwmon_channel_info has been fixed to u64.
Modify the related code in driver to avoid compiling failure.
Signed-off-by: Huisong Li <lihuisong@huawei.com>
---
drivers/net/ethernet/mellanox/mlx5/core/hwmon.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/hwmon.c b/drivers/net/ethernet/mellanox/mlx5/core/hwmon.c
index 353f81dccd1c..fe39b97d214e 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/hwmon.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/hwmon.c
@@ -30,9 +30,9 @@ struct mlx5_hwmon {
struct mlx5_core_dev *mdev;
struct device *hwmon_dev;
struct hwmon_channel_info chip_info;
- u32 chip_channel_config[CHIP_CONFIG_NUM + 1];
+ u64 chip_channel_config[CHIP_CONFIG_NUM + 1];
struct hwmon_channel_info temp_info;
- u32 *temp_channel_config;
+ u64 *temp_channel_config;
const struct hwmon_channel_info *channel_info[CHANNELS_TYPE_NUM + 1];
struct hwmon_chip_info chip;
struct temp_channel_desc *temp_channel_desc;
@@ -233,14 +233,14 @@ static void mlx5_hwmon_channel_info_init(struct mlx5_hwmon *hwmon)
hwmon->channel_info[1] = &hwmon->temp_info;
hwmon->chip_channel_config[0] = HWMON_C_REGISTER_TZ;
- hwmon->chip_info.config = (const u32 *)hwmon->chip_channel_config;
+ hwmon->chip_info.config = (const u64 *)hwmon->chip_channel_config;
hwmon->chip_info.type = hwmon_chip;
for (i = 0; i < hwmon->asic_platform_scount + hwmon->module_scount; i++)
hwmon->temp_channel_config[i] = HWMON_T_INPUT | HWMON_T_HIGHEST | HWMON_T_CRIT |
HWMON_T_RESET_HISTORY | HWMON_T_LABEL;
- hwmon->temp_info.config = (const u32 *)hwmon->temp_channel_config;
+ hwmon->temp_info.config = (const u64 *)hwmon->temp_channel_config;
hwmon->temp_info.type = hwmon_temp;
}
--
2.22.0
^ permalink raw reply related [flat|nested] 40+ messages in thread* [PATCH v1 19/21] platform/x86: dell-ddv: Fix the type of 'config' in struct hwmon_channel_info to u64
2025-01-21 6:44 [PATCH v1 00/21] hwmon: Fix the type of 'config' in struct hwmon_channel_info to u64 Huisong Li
` (17 preceding siblings ...)
2025-01-21 6:45 ` [PATCH v1 18/21] net/mlx5: " Huisong Li
@ 2025-01-21 6:45 ` Huisong Li
2025-01-21 12:18 ` Ilpo Järvinen
2025-01-21 6:45 ` [PATCH v1 20/21] hwmon: (asus-ec-sensors) " Huisong Li
` (3 subsequent siblings)
22 siblings, 1 reply; 40+ messages in thread
From: Huisong Li @ 2025-01-21 6:45 UTC (permalink / raw)
To: linux-hwmon
Cc: linux-kernel, linux-media, linux-arm-kernel, arm-scmi, netdev,
linux-rtc, oss-drivers, linux-rdma, platform-driver-x86, linuxarm,
linux, jdelvare, kernel, pauk.denis, james, sudeep.holla,
cristian.marussi, matt, mchehab, irusskikh, andrew+netdev, davem,
edumazet, kuba, pabeni, saeedm, leon, tariqt, louis.peens,
hkallweit1, linux, kabel, W_Armin, hdegoede, ilpo.jarvinen,
alexandre.belloni, krzk, jonathan.cameron, zhanjie9, zhenglifeng1,
liuyonglong, lihuisong
The type of 'config' in struct hwmon_channel_info has been fixed to u64.
Modify the related code in driver to avoid compiling failure.
Signed-off-by: Huisong Li <lihuisong@huawei.com>
---
drivers/platform/x86/dell/dell-wmi-ddv.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/platform/x86/dell/dell-wmi-ddv.c b/drivers/platform/x86/dell/dell-wmi-ddv.c
index e75cd6e1efe6..efb2278aabb9 100644
--- a/drivers/platform/x86/dell/dell-wmi-ddv.c
+++ b/drivers/platform/x86/dell/dell-wmi-ddv.c
@@ -86,7 +86,7 @@ struct thermal_sensor_entry {
struct combined_channel_info {
struct hwmon_channel_info info;
- u32 config[];
+ u64 config[];
};
struct combined_chip_info {
@@ -500,7 +500,7 @@ static const struct hwmon_ops dell_wmi_ddv_ops = {
static struct hwmon_channel_info *dell_wmi_ddv_channel_create(struct device *dev, u64 count,
enum hwmon_sensor_types type,
- u32 config)
+ u64 config)
{
struct combined_channel_info *cinfo;
int i;
@@ -543,7 +543,7 @@ static struct hwmon_channel_info *dell_wmi_ddv_channel_init(struct wmi_device *w
struct dell_wmi_ddv_sensors *sensors,
size_t entry_size,
enum hwmon_sensor_types type,
- u32 config)
+ u64 config)
{
struct hwmon_channel_info *info;
int ret;
--
2.22.0
^ permalink raw reply related [flat|nested] 40+ messages in thread* Re: [PATCH v1 19/21] platform/x86: dell-ddv: Fix the type of 'config' in struct hwmon_channel_info to u64
2025-01-21 6:45 ` [PATCH v1 19/21] platform/x86: dell-ddv: " Huisong Li
@ 2025-01-21 12:18 ` Ilpo Järvinen
2025-01-22 5:57 ` lihuisong (C)
0 siblings, 1 reply; 40+ messages in thread
From: Ilpo Järvinen @ 2025-01-21 12:18 UTC (permalink / raw)
To: Huisong Li
Cc: linux-hwmon, LKML, linux-media, linux-arm-kernel, arm-scmi,
Netdev, linux-rtc, oss-drivers, linux-rdma, platform-driver-x86,
linuxarm, linux, jdelvare, kernel, pauk.denis, james,
sudeep.holla, cristian.marussi, matt, mchehab, irusskikh,
andrew+netdev, davem, edumazet, kuba, pabeni, saeedm, leon,
tariqt, louis.peens, hkallweit1, linux, kabel, W_Armin,
Hans de Goede, alexandre.belloni, krzk, jonathan.cameron,
zhanjie9, zhenglifeng1, liuyonglong
On Tue, 21 Jan 2025, Huisong Li wrote:
> The type of 'config' in struct hwmon_channel_info has been fixed to u64.
> Modify the related code in driver to avoid compiling failure.
Does this mean that after applying part of your series but not yet this
patch, compile would fail? If so, it's unacceptable. At no point in a
patch series are you allowed to cause a compile failure because it hinders
'git bisect' that is an important troubleshooting tool.
So you might have to combine changes to drivers and API if you make an
API change that breaks driver build until driver too is changed. Note that
it will impact a lot how quickly your patches can be accepted as much
higher level of coordination is usually required if your patch is touching
things all over the place, but it cannot be avoided at times. And
requirement of doing minimal change only will be much much higher in such
a large scale change.
--
i.
> Signed-off-by: Huisong Li <lihuisong@huawei.com>
> ---
> drivers/platform/x86/dell/dell-wmi-ddv.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/platform/x86/dell/dell-wmi-ddv.c b/drivers/platform/x86/dell/dell-wmi-ddv.c
> index e75cd6e1efe6..efb2278aabb9 100644
> --- a/drivers/platform/x86/dell/dell-wmi-ddv.c
> +++ b/drivers/platform/x86/dell/dell-wmi-ddv.c
> @@ -86,7 +86,7 @@ struct thermal_sensor_entry {
>
> struct combined_channel_info {
> struct hwmon_channel_info info;
> - u32 config[];
> + u64 config[];
> };
>
> struct combined_chip_info {
> @@ -500,7 +500,7 @@ static const struct hwmon_ops dell_wmi_ddv_ops = {
>
> static struct hwmon_channel_info *dell_wmi_ddv_channel_create(struct device *dev, u64 count,
> enum hwmon_sensor_types type,
> - u32 config)
> + u64 config)
> {
> struct combined_channel_info *cinfo;
> int i;
> @@ -543,7 +543,7 @@ static struct hwmon_channel_info *dell_wmi_ddv_channel_init(struct wmi_device *w
> struct dell_wmi_ddv_sensors *sensors,
> size_t entry_size,
> enum hwmon_sensor_types type,
> - u32 config)
> + u64 config)
> {
> struct hwmon_channel_info *info;
> int ret;
>
^ permalink raw reply [flat|nested] 40+ messages in thread* Re: [PATCH v1 19/21] platform/x86: dell-ddv: Fix the type of 'config' in struct hwmon_channel_info to u64
2025-01-21 12:18 ` Ilpo Järvinen
@ 2025-01-22 5:57 ` lihuisong (C)
0 siblings, 0 replies; 40+ messages in thread
From: lihuisong (C) @ 2025-01-22 5:57 UTC (permalink / raw)
To: Ilpo Järvinen
Cc: linux-hwmon, LKML, linux-media, linux-arm-kernel, arm-scmi,
Netdev, linux-rtc, oss-drivers, linux-rdma, platform-driver-x86,
linuxarm, linux, jdelvare, kernel, pauk.denis, james,
sudeep.holla, cristian.marussi, matt, mchehab, irusskikh,
andrew+netdev, davem, edumazet, kuba, pabeni, saeedm, leon,
tariqt, louis.peens, hkallweit1, linux, kabel, W_Armin,
Hans de Goede, alexandre.belloni, krzk, jonathan.cameron,
zhanjie9, zhenglifeng1, liuyonglong
在 2025/1/21 20:18, Ilpo Järvinen 写道:
> On Tue, 21 Jan 2025, Huisong Li wrote:
>
>> The type of 'config' in struct hwmon_channel_info has been fixed to u64.
>> Modify the related code in driver to avoid compiling failure.
> Does this mean that after applying part of your series but not yet this
> patch, compile would fail? If so, it's unacceptable. At no point in a
> patch series are you allowed to cause a compile failure because it hinders
> 'git bisect' that is an important troubleshooting tool.
>
> So you might have to combine changes to drivers and API if you make an
> API change that breaks driver build until driver too is changed. Note that
> it will impact a lot how quickly your patches can be accepted as much
> higher level of coordination is usually required if your patch is touching
> things all over the place, but it cannot be avoided at times. And
> requirement of doing minimal change only will be much much higher in such
> a large scale change.
>
Ack. Thanks for your reply.
>
>> Signed-off-by: Huisong Li <lihuisong@huawei.com>
>> ---
>> drivers/platform/x86/dell/dell-wmi-ddv.c | 6 +++---
>> 1 file changed, 3 insertions(+), 3 deletions(-)
>>
>> diff --git a/drivers/platform/x86/dell/dell-wmi-ddv.c b/drivers/platform/x86/dell/dell-wmi-ddv.c
>> index e75cd6e1efe6..efb2278aabb9 100644
>> --- a/drivers/platform/x86/dell/dell-wmi-ddv.c
>> +++ b/drivers/platform/x86/dell/dell-wmi-ddv.c
>> @@ -86,7 +86,7 @@ struct thermal_sensor_entry {
>>
>> struct combined_channel_info {
>> struct hwmon_channel_info info;
>> - u32 config[];
>> + u64 config[];
>> };
>>
>> struct combined_chip_info {
>> @@ -500,7 +500,7 @@ static const struct hwmon_ops dell_wmi_ddv_ops = {
>>
>> static struct hwmon_channel_info *dell_wmi_ddv_channel_create(struct device *dev, u64 count,
>> enum hwmon_sensor_types type,
>> - u32 config)
>> + u64 config)
>> {
>> struct combined_channel_info *cinfo;
>> int i;
>> @@ -543,7 +543,7 @@ static struct hwmon_channel_info *dell_wmi_ddv_channel_init(struct wmi_device *w
>> struct dell_wmi_ddv_sensors *sensors,
>> size_t entry_size,
>> enum hwmon_sensor_types type,
>> - u32 config)
>> + u64 config)
>> {
>> struct hwmon_channel_info *info;
>> int ret;
>>
> .
^ permalink raw reply [flat|nested] 40+ messages in thread
* [PATCH v1 20/21] hwmon: (asus-ec-sensors) Fix the type of 'config' in struct hwmon_channel_info to u64
2025-01-21 6:44 [PATCH v1 00/21] hwmon: Fix the type of 'config' in struct hwmon_channel_info to u64 Huisong Li
` (18 preceding siblings ...)
2025-01-21 6:45 ` [PATCH v1 19/21] platform/x86: dell-ddv: " Huisong Li
@ 2025-01-21 6:45 ` Huisong Li
2025-01-21 6:45 ` [PATCH v1 21/21] hwmon: (lm90) " Huisong Li
` (2 subsequent siblings)
22 siblings, 0 replies; 40+ messages in thread
From: Huisong Li @ 2025-01-21 6:45 UTC (permalink / raw)
To: linux-hwmon
Cc: linux-kernel, linux-media, linux-arm-kernel, arm-scmi, netdev,
linux-rtc, oss-drivers, linux-rdma, platform-driver-x86, linuxarm,
linux, jdelvare, kernel, pauk.denis, james, sudeep.holla,
cristian.marussi, matt, mchehab, irusskikh, andrew+netdev, davem,
edumazet, kuba, pabeni, saeedm, leon, tariqt, louis.peens,
hkallweit1, linux, kabel, W_Armin, hdegoede, ilpo.jarvinen,
alexandre.belloni, krzk, jonathan.cameron, zhanjie9, zhenglifeng1,
liuyonglong, lihuisong
The type of 'config' in struct hwmon_channel_info has been fixed to u64.
Modify the related code in driver to avoid compiling failure.
Signed-off-by: Huisong Li <lihuisong@huawei.com>
---
drivers/hwmon/asus-ec-sensors.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/hwmon/asus-ec-sensors.c b/drivers/hwmon/asus-ec-sensors.c
index 43e54dc513da..a4e0a2975a3a 100644
--- a/drivers/hwmon/asus-ec-sensors.c
+++ b/drivers/hwmon/asus-ec-sensors.c
@@ -77,7 +77,7 @@ typedef union {
.value = (size << 16) + (bank << 8) + index \
}
-static u32 hwmon_attributes[hwmon_max] = {
+static u64 hwmon_attributes[hwmon_max] = {
[hwmon_chip] = HWMON_C_REGISTER_TZ,
[hwmon_temp] = HWMON_T_INPUT | HWMON_T_LABEL,
[hwmon_in] = HWMON_I_INPUT | HWMON_I_LABEL,
@@ -940,10 +940,10 @@ static umode_t asus_ec_hwmon_is_visible(const void *drvdata,
static int
asus_ec_hwmon_add_chan_info(struct hwmon_channel_info *asus_ec_hwmon_chan,
struct device *dev, int num,
- enum hwmon_sensor_types type, u32 config)
+ enum hwmon_sensor_types type, u64 config)
{
int i;
- u32 *cfg = devm_kcalloc(dev, num + 1, sizeof(*cfg), GFP_KERNEL);
+ u64 *cfg = devm_kcalloc(dev, num + 1, sizeof(*cfg), GFP_KERNEL);
if (!cfg)
return -ENOMEM;
--
2.22.0
^ permalink raw reply related [flat|nested] 40+ messages in thread* [PATCH v1 21/21] hwmon: (lm90) Fix the type of 'config' in struct hwmon_channel_info to u64
2025-01-21 6:44 [PATCH v1 00/21] hwmon: Fix the type of 'config' in struct hwmon_channel_info to u64 Huisong Li
` (19 preceding siblings ...)
2025-01-21 6:45 ` [PATCH v1 20/21] hwmon: (asus-ec-sensors) " Huisong Li
@ 2025-01-21 6:45 ` Huisong Li
2025-01-21 7:47 ` [PATCH v1 00/21] hwmon: " Krzysztof Kozlowski
2025-01-21 14:12 ` Armin Wolf
22 siblings, 0 replies; 40+ messages in thread
From: Huisong Li @ 2025-01-21 6:45 UTC (permalink / raw)
To: linux-hwmon
Cc: linux-kernel, linux-media, linux-arm-kernel, arm-scmi, netdev,
linux-rtc, oss-drivers, linux-rdma, platform-driver-x86, linuxarm,
linux, jdelvare, kernel, pauk.denis, james, sudeep.holla,
cristian.marussi, matt, mchehab, irusskikh, andrew+netdev, davem,
edumazet, kuba, pabeni, saeedm, leon, tariqt, louis.peens,
hkallweit1, linux, kabel, W_Armin, hdegoede, ilpo.jarvinen,
alexandre.belloni, krzk, jonathan.cameron, zhanjie9, zhenglifeng1,
liuyonglong, lihuisong
The type of 'config' in struct hwmon_channel_info has been fixed to u64.
Modify the related code in driver to avoid compiling failure.
Signed-off-by: Huisong Li <lihuisong@huawei.com>
---
drivers/hwmon/lm90.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/hwmon/lm90.c b/drivers/hwmon/lm90.c
index 511d95a0efb3..dbb9d976284f 100644
--- a/drivers/hwmon/lm90.c
+++ b/drivers/hwmon/lm90.c
@@ -685,8 +685,8 @@ enum lm90_temp_reg_index {
struct lm90_data {
struct i2c_client *client;
struct device *hwmon_dev;
- u32 chip_config[2];
- u32 channel_config[MAX_CHANNELS + 1];
+ u64 chip_config[2];
+ u64 channel_config[MAX_CHANNELS + 1];
const char *channel_label[MAX_CHANNELS];
struct hwmon_channel_info chip_info;
struct hwmon_channel_info temp_info;
--
2.22.0
^ permalink raw reply related [flat|nested] 40+ messages in thread* Re: [PATCH v1 00/21] hwmon: Fix the type of 'config' in struct hwmon_channel_info to u64
2025-01-21 6:44 [PATCH v1 00/21] hwmon: Fix the type of 'config' in struct hwmon_channel_info to u64 Huisong Li
` (20 preceding siblings ...)
2025-01-21 6:45 ` [PATCH v1 21/21] hwmon: (lm90) " Huisong Li
@ 2025-01-21 7:47 ` Krzysztof Kozlowski
2025-01-21 8:14 ` lihuisong (C)
2025-01-21 14:12 ` Armin Wolf
22 siblings, 1 reply; 40+ messages in thread
From: Krzysztof Kozlowski @ 2025-01-21 7:47 UTC (permalink / raw)
To: Huisong Li, linux-hwmon
Cc: linux-kernel, linux-media, linux-arm-kernel, arm-scmi, netdev,
linux-rtc, oss-drivers, linux-rdma, platform-driver-x86, linuxarm,
linux, jdelvare, kernel, pauk.denis, james, sudeep.holla,
cristian.marussi, matt, mchehab, irusskikh, andrew+netdev, davem,
edumazet, kuba, pabeni, saeedm, leon, tariqt, louis.peens,
hkallweit1, linux, kabel, W_Armin, hdegoede, ilpo.jarvinen,
alexandre.belloni, jonathan.cameron, zhanjie9, zhenglifeng1,
liuyonglong
On 21/01/2025 07:44, Huisong Li wrote:
> The hwmon_device_register() is deprecated. When I try to repace it with
> hwmon_device_register_with_info() for acpi_power_meter driver, I found that
> the power channel attribute in linux/hwmon.h have to extend and is more
> than 32 after this replacement.
>
> However, the maximum number of hwmon channel attributes is 32 which is
> limited by current hwmon codes. This is not good to add new channel
> attribute for some hwmon sensor type and support more channel attribute.
>
> This series are aimed to do this. And also make sure that acpi_power_meter
> driver can successfully replace the deprecated hwmon_device_register()
> later.
Avoid combining independent patches into one patch bomb. Or explain the
dependencies and how is it supposed to be merged - that's why you have
cover letter here.
Best regards,
Krzysztof
^ permalink raw reply [flat|nested] 40+ messages in thread* Re: [PATCH v1 00/21] hwmon: Fix the type of 'config' in struct hwmon_channel_info to u64
2025-01-21 7:47 ` [PATCH v1 00/21] hwmon: " Krzysztof Kozlowski
@ 2025-01-21 8:14 ` lihuisong (C)
2025-01-22 7:51 ` Krzysztof Kozlowski
0 siblings, 1 reply; 40+ messages in thread
From: lihuisong (C) @ 2025-01-21 8:14 UTC (permalink / raw)
To: Krzysztof Kozlowski, linux-hwmon
Cc: linux-kernel, linux-media, linux-arm-kernel, arm-scmi, netdev,
linux-rtc, oss-drivers, linux-rdma, platform-driver-x86, linuxarm,
linux, jdelvare, kernel, pauk.denis, james, sudeep.holla,
cristian.marussi, matt, mchehab, irusskikh, andrew+netdev, davem,
edumazet, kuba, pabeni, saeedm, leon, tariqt, louis.peens,
hkallweit1, linux, kabel, W_Armin, hdegoede, ilpo.jarvinen,
alexandre.belloni, jonathan.cameron, zhanjie9, zhenglifeng1,
liuyonglong
在 2025/1/21 15:47, Krzysztof Kozlowski 写道:
> On 21/01/2025 07:44, Huisong Li wrote:
>> The hwmon_device_register() is deprecated. When I try to repace it with
>> hwmon_device_register_with_info() for acpi_power_meter driver, I found that
>> the power channel attribute in linux/hwmon.h have to extend and is more
>> than 32 after this replacement.
>>
>> However, the maximum number of hwmon channel attributes is 32 which is
>> limited by current hwmon codes. This is not good to add new channel
>> attribute for some hwmon sensor type and support more channel attribute.
>>
>> This series are aimed to do this. And also make sure that acpi_power_meter
>> driver can successfully replace the deprecated hwmon_device_register()
>> later.
> Avoid combining independent patches into one patch bomb. Or explain the
> dependencies and how is it supposed to be merged - that's why you have
> cover letter here.
These patches having a title ('Use HWMON_CHANNEL_INFO macro to simplify
code') are also for this series.
Or we need to modify the type of the 'xxx_config' array in these patches.
If we directly use the macro HWMON_CHANNEL_INFO, the type of 'config'
has been modifyed in patch 1/21 and these driver don't need to care this
change.
/Huisong
>
>
> .
^ permalink raw reply [flat|nested] 40+ messages in thread* Re: [PATCH v1 00/21] hwmon: Fix the type of 'config' in struct hwmon_channel_info to u64
2025-01-21 8:14 ` lihuisong (C)
@ 2025-01-22 7:51 ` Krzysztof Kozlowski
2025-01-22 14:36 ` Guenter Roeck
0 siblings, 1 reply; 40+ messages in thread
From: Krzysztof Kozlowski @ 2025-01-22 7:51 UTC (permalink / raw)
To: lihuisong (C), linux-hwmon
Cc: linux-kernel, linux-media, linux-arm-kernel, arm-scmi, netdev,
linux-rtc, oss-drivers, linux-rdma, platform-driver-x86, linuxarm,
linux, jdelvare, kernel, pauk.denis, james, sudeep.holla,
cristian.marussi, matt, mchehab, irusskikh, andrew+netdev, davem,
edumazet, kuba, pabeni, saeedm, leon, tariqt, louis.peens,
hkallweit1, linux, kabel, W_Armin, hdegoede, ilpo.jarvinen,
alexandre.belloni, jonathan.cameron, zhanjie9, zhenglifeng1,
liuyonglong
On 21/01/2025 09:14, lihuisong (C) wrote:
>
> 在 2025/1/21 15:47, Krzysztof Kozlowski 写道:
>> On 21/01/2025 07:44, Huisong Li wrote:
>>> The hwmon_device_register() is deprecated. When I try to repace it with
>>> hwmon_device_register_with_info() for acpi_power_meter driver, I found that
>>> the power channel attribute in linux/hwmon.h have to extend and is more
>>> than 32 after this replacement.
>>>
>>> However, the maximum number of hwmon channel attributes is 32 which is
>>> limited by current hwmon codes. This is not good to add new channel
>>> attribute for some hwmon sensor type and support more channel attribute.
>>>
>>> This series are aimed to do this. And also make sure that acpi_power_meter
>>> driver can successfully replace the deprecated hwmon_device_register()
>>> later.
>> Avoid combining independent patches into one patch bomb. Or explain the
>> dependencies and how is it supposed to be merged - that's why you have
>> cover letter here.
> These patches having a title ('Use HWMON_CHANNEL_INFO macro to simplify
> code') are also for this series.
> Or we need to modify the type of the 'xxx_config' array in these patches.
> If we directly use the macro HWMON_CHANNEL_INFO, the type of 'config'
> has been modifyed in patch 1/21 and these driver don't need to care this
> change.
None of above addresses my concern. I am dropping the series from my
inbox/to-review box.
Best regards,
Krzysztof
^ permalink raw reply [flat|nested] 40+ messages in thread* Re: [PATCH v1 00/21] hwmon: Fix the type of 'config' in struct hwmon_channel_info to u64
2025-01-22 7:51 ` Krzysztof Kozlowski
@ 2025-01-22 14:36 ` Guenter Roeck
0 siblings, 0 replies; 40+ messages in thread
From: Guenter Roeck @ 2025-01-22 14:36 UTC (permalink / raw)
To: Krzysztof Kozlowski, lihuisong (C), linux-hwmon
Cc: linux-kernel, linux-media, linux-arm-kernel, arm-scmi, netdev,
linux-rtc, oss-drivers, linux-rdma, platform-driver-x86, linuxarm,
jdelvare, kernel, pauk.denis, james, sudeep.holla,
cristian.marussi, matt, mchehab, irusskikh, andrew+netdev, davem,
edumazet, kuba, pabeni, saeedm, leon, tariqt, louis.peens,
hkallweit1, linux, kabel, W_Armin, hdegoede, ilpo.jarvinen,
alexandre.belloni, jonathan.cameron, zhanjie9, zhenglifeng1,
liuyonglong
On 1/21/25 23:51, Krzysztof Kozlowski wrote:
> On 21/01/2025 09:14, lihuisong (C) wrote:
>>
>> 在 2025/1/21 15:47, Krzysztof Kozlowski 写道:
>>> On 21/01/2025 07:44, Huisong Li wrote:
>>>> The hwmon_device_register() is deprecated. When I try to repace it with
>>>> hwmon_device_register_with_info() for acpi_power_meter driver, I found that
>>>> the power channel attribute in linux/hwmon.h have to extend and is more
>>>> than 32 after this replacement.
>>>>
>>>> However, the maximum number of hwmon channel attributes is 32 which is
>>>> limited by current hwmon codes. This is not good to add new channel
>>>> attribute for some hwmon sensor type and support more channel attribute.
>>>>
>>>> This series are aimed to do this. And also make sure that acpi_power_meter
>>>> driver can successfully replace the deprecated hwmon_device_register()
>>>> later.
>>> Avoid combining independent patches into one patch bomb. Or explain the
>>> dependencies and how is it supposed to be merged - that's why you have
>>> cover letter here.
>> These patches having a title ('Use HWMON_CHANNEL_INFO macro to simplify
>> code') are also for this series.
>> Or we need to modify the type of the 'xxx_config' array in these patches.
>> If we directly use the macro HWMON_CHANNEL_INFO, the type of 'config'
>> has been modifyed in patch 1/21 and these driver don't need to care this
>> change.
>
> None of above addresses my concern. I am dropping the series from my
> inbox/to-review box.
>
If you need help with that, and if it wasn't obvious:
NACK for the series
Guenter
^ permalink raw reply [flat|nested] 40+ messages in thread
* Re: [PATCH v1 00/21] hwmon: Fix the type of 'config' in struct hwmon_channel_info to u64
2025-01-21 6:44 [PATCH v1 00/21] hwmon: Fix the type of 'config' in struct hwmon_channel_info to u64 Huisong Li
` (21 preceding siblings ...)
2025-01-21 7:47 ` [PATCH v1 00/21] hwmon: " Krzysztof Kozlowski
@ 2025-01-21 14:12 ` Armin Wolf
2025-01-21 14:50 ` Guenter Roeck
2025-01-22 2:34 ` lihuisong (C)
22 siblings, 2 replies; 40+ messages in thread
From: Armin Wolf @ 2025-01-21 14:12 UTC (permalink / raw)
To: Huisong Li, linux-hwmon
Cc: linux-kernel, linux-media, linux-arm-kernel, arm-scmi, netdev,
linux-rtc, oss-drivers, linux-rdma, platform-driver-x86, linuxarm,
linux, jdelvare, kernel, pauk.denis, james, sudeep.holla,
cristian.marussi, matt, mchehab, irusskikh, andrew+netdev, davem,
edumazet, kuba, pabeni, saeedm, leon, tariqt, louis.peens,
hkallweit1, linux, kabel, hdegoede, ilpo.jarvinen,
alexandre.belloni, krzk, jonathan.cameron, zhanjie9, zhenglifeng1,
liuyonglong
Am 21.01.25 um 07:44 schrieb Huisong Li:
> The hwmon_device_register() is deprecated. When I try to repace it with
> hwmon_device_register_with_info() for acpi_power_meter driver, I found that
> the power channel attribute in linux/hwmon.h have to extend and is more
> than 32 after this replacement.
>
> However, the maximum number of hwmon channel attributes is 32 which is
> limited by current hwmon codes. This is not good to add new channel
> attribute for some hwmon sensor type and support more channel attribute.
>
> This series are aimed to do this. And also make sure that acpi_power_meter
> driver can successfully replace the deprecated hwmon_device_register()
> later.
Hi,
what kind of new power attributes do you want to add to the hwmon API?
AFAIK the acpi-power-meter driver supports the following attributes:
power1_accuracy -> HWMON_P_ACCURACY
power1_cap_min -> HWMON_P_CAP_MIN
power1_cap_max -> HWMON_P_CAP_MAX
power1_cap_hyst -> HWMON_P_CAP_HYST
power1_cap -> HWMON_P_CAP
power1_average -> HWMON_P_AVERAGE
power1_average_min -> HWMON_P_AVERAGE_MIN
power1_average_max -> HWMON_P_AVERAGE_MAX
power1_average_interval -> HWMON_P_AVERAGE_INTERVAL
power1_average_interval_min -> HWMON_P_AVERAGE_INTERVAL_MIN
power1_average_interval_max -> HWMON_P_AVERAGE_INTERVAL_MAX
power1_alarm -> HWMON_P_ALARM
power1_model_number
power1_oem_info
power1_serial_number
power1_is_battery
name -> handled by hwmon core
The remaining attributes are in my opinion not generic enough to add them to the generic
hwmon power attributes. I think you should implement them as a attribute_group which can
be passed to hwmon_device_register_with_info() using the "extra_groups" parameter.
Thanks,
Armin Wolf
>
> Huisong Li (21):
> hwmon: Fix the type of 'config' in struct hwmon_channel_info to u64
> media: video-i2c: Use HWMON_CHANNEL_INFO macro to simplify code
> net: aquantia: Use HWMON_CHANNEL_INFO macro to simplify code
> net: nfp: Use HWMON_CHANNEL_INFO macro to simplify code
> net: phy: marvell: Use HWMON_CHANNEL_INFO macro to simplify code
> net: phy: marvell10g: Use HWMON_CHANNEL_INFO macro to simplify code
> rtc: ab-eoz9: Use HWMON_CHANNEL_INFO macro to simplify code
> rtc: ds3232: Use HWMON_CHANNEL_INFO macro to simplify code
> w1: w1_therm: w1: Use HWMON_CHANNEL_INFO macro to simplify code
> net: phy: aquantia: Use HWMON_CHANNEL_INFO macro to simplify code
> hwmon: (asus_wmi_sensors) Fix type of 'config' in struct
> hwmon_channel_info to u64
> hwmon: (hp-wmi-sensors) Fix type of 'config' in struct
> hwmon_channel_info to u64
> hwmon: (mr75203) Fix the type of 'config' in struct hwmon_channel_info
> to u64
> hwmon: (pwm-fan) Fix the type of 'config' in struct hwmon_channel_info
> to u64
> hwmon: (scmi-hwmon) Fix the type of 'config' in struct
> hwmon_channel_info to u64
> hwmon: (tmp401) Fix the type of 'config' in struct hwmon_channel_info
> to u64
> hwmon: (tmp421) Fix the type of 'config' in struct hwmon_channel_info
> to u64
> net/mlx5: Fix the type of 'config' in struct hwmon_channel_info to u64
> platform/x86: dell-ddv: Fix the type of 'config' in struct
> hwmon_channel_info to u64
> hwmon: (asus-ec-sensors) Fix the type of 'config' in struct
> hwmon_channel_info to u64
> hwmon: (lm90) Fix the type of 'config' in struct hwmon_channel_info to
> u64
>
> drivers/hwmon/asus-ec-sensors.c | 6 +-
> drivers/hwmon/asus_wmi_sensors.c | 8 +-
> drivers/hwmon/hp-wmi-sensors.c | 6 +-
> drivers/hwmon/hwmon.c | 4 +-
> drivers/hwmon/lm90.c | 4 +-
> drivers/hwmon/mr75203.c | 6 +-
> drivers/hwmon/pwm-fan.c | 4 +-
> drivers/hwmon/scmi-hwmon.c | 6 +-
> drivers/hwmon/tmp401.c | 4 +-
> drivers/hwmon/tmp421.c | 2 +-
> drivers/media/i2c/video-i2c.c | 12 +-
> .../ethernet/aquantia/atlantic/aq_drvinfo.c | 14 +-
> .../net/ethernet/mellanox/mlx5/core/hwmon.c | 8 +-
> .../net/ethernet/netronome/nfp/nfp_hwmon.c | 40 +--
> drivers/net/phy/aquantia/aquantia_hwmon.c | 32 +-
> drivers/net/phy/marvell.c | 24 +-
> drivers/net/phy/marvell10g.c | 24 +-
> drivers/platform/x86/dell/dell-wmi-ddv.c | 6 +-
> drivers/rtc/rtc-ab-eoz9.c | 24 +-
> drivers/rtc/rtc-ds3232.c | 24 +-
> drivers/w1/slaves/w1_therm.c | 12 +-
> include/linux/hwmon.h | 300 +++++++++---------
> 22 files changed, 205 insertions(+), 365 deletions(-)
>
^ permalink raw reply [flat|nested] 40+ messages in thread* Re: [PATCH v1 00/21] hwmon: Fix the type of 'config' in struct hwmon_channel_info to u64
2025-01-21 14:12 ` Armin Wolf
@ 2025-01-21 14:50 ` Guenter Roeck
2025-01-21 17:20 ` Russell King (Oracle)
2025-01-22 2:52 ` lihuisong (C)
2025-01-22 2:34 ` lihuisong (C)
1 sibling, 2 replies; 40+ messages in thread
From: Guenter Roeck @ 2025-01-21 14:50 UTC (permalink / raw)
To: Armin Wolf, Huisong Li, linux-hwmon
Cc: linux-kernel, linux-media, linux-arm-kernel, arm-scmi, netdev,
linux-rtc, oss-drivers, linux-rdma, platform-driver-x86, linuxarm,
jdelvare, kernel, pauk.denis, james, sudeep.holla,
cristian.marussi, matt, mchehab, irusskikh, andrew+netdev, davem,
edumazet, kuba, pabeni, saeedm, leon, tariqt, louis.peens,
hkallweit1, linux, kabel, hdegoede, ilpo.jarvinen,
alexandre.belloni, krzk, jonathan.cameron, zhanjie9, zhenglifeng1,
liuyonglong
On 1/21/25 06:12, Armin Wolf wrote:
> Am 21.01.25 um 07:44 schrieb Huisong Li:
>
>> The hwmon_device_register() is deprecated. When I try to repace it with
>> hwmon_device_register_with_info() for acpi_power_meter driver, I found that
>> the power channel attribute in linux/hwmon.h have to extend and is more
>> than 32 after this replacement.
>>
>> However, the maximum number of hwmon channel attributes is 32 which is
>> limited by current hwmon codes. This is not good to add new channel
>> attribute for some hwmon sensor type and support more channel attribute.
>>
>> This series are aimed to do this. And also make sure that acpi_power_meter
>> driver can successfully replace the deprecated hwmon_device_register()
>> later.
>
This explanation completely misses the point. The series tries to make space
for additional "standard" attributes. Such a change should be independent
of a driver conversion and be discussed on its own, not in the context
of a new driver or a driver conversion.
> Hi,
>
> what kind of new power attributes do you want to add to the hwmon API?
>
> AFAIK the acpi-power-meter driver supports the following attributes:
>
> power1_accuracy -> HWMON_P_ACCURACY
> power1_cap_min -> HWMON_P_CAP_MIN
> power1_cap_max -> HWMON_P_CAP_MAX
> power1_cap_hyst -> HWMON_P_CAP_HYST
> power1_cap -> HWMON_P_CAP
> power1_average -> HWMON_P_AVERAGE
> power1_average_min -> HWMON_P_AVERAGE_MIN
> power1_average_max -> HWMON_P_AVERAGE_MAX
> power1_average_interval -> HWMON_P_AVERAGE_INTERVAL
> power1_average_interval_min -> HWMON_P_AVERAGE_INTERVAL_MIN
> power1_average_interval_max -> HWMON_P_AVERAGE_INTERVAL_MAX
> power1_alarm -> HWMON_P_ALARM
> power1_model_number
> power1_oem_info
> power1_serial_number
> power1_is_battery
> name -> handled by hwmon core
>
> The remaining attributes are in my opinion not generic enough to add them to the generic
> hwmon power attributes. I think you should implement them as a attribute_group which can
> be passed to hwmon_device_register_with_info() using the "extra_groups" parameter.
>
I absolutely agree. More specifically, it looks like this is about the following
attributes.
> power1_model_number
> power1_oem_info
> power1_serial_number
> power1_is_battery
Those are not hwmon attributes and should not be (or have been) exposed
as sysfs attributes in the first place, but (if really wanted/needed)
through debugfs files. Even _if_ exposed as sysfs attributes they should
not have the power1_ prefix (except maybe for the last one).
On top of that, doubling the size of configuration bits for everything
because one sensor type needs more than 32 bits seems excessive.
If we ever get to that point I think I'd rather introduce a second
sensor type for power sensor attributes.
Guenter
^ permalink raw reply [flat|nested] 40+ messages in thread
* Re: [PATCH v1 00/21] hwmon: Fix the type of 'config' in struct hwmon_channel_info to u64
2025-01-21 14:50 ` Guenter Roeck
@ 2025-01-21 17:20 ` Russell King (Oracle)
2025-01-21 17:37 ` Guenter Roeck
2025-01-22 4:06 ` lihuisong (C)
2025-01-22 2:52 ` lihuisong (C)
1 sibling, 2 replies; 40+ messages in thread
From: Russell King (Oracle) @ 2025-01-21 17:20 UTC (permalink / raw)
To: Guenter Roeck
Cc: Armin Wolf, Huisong Li, linux-hwmon, linux-kernel, linux-media,
linux-arm-kernel, arm-scmi, netdev, linux-rtc, oss-drivers,
linux-rdma, platform-driver-x86, linuxarm, jdelvare, kernel,
pauk.denis, james, sudeep.holla, cristian.marussi, matt, mchehab,
irusskikh, andrew+netdev, davem, edumazet, kuba, pabeni, saeedm,
leon, tariqt, louis.peens, hkallweit1, kabel, hdegoede,
ilpo.jarvinen, alexandre.belloni, krzk, jonathan.cameron,
zhanjie9, zhenglifeng1, liuyonglong
On Tue, Jan 21, 2025 at 06:50:00AM -0800, Guenter Roeck wrote:
> On 1/21/25 06:12, Armin Wolf wrote:
> > Am 21.01.25 um 07:44 schrieb Huisong Li:
> > > The hwmon_device_register() is deprecated. When I try to repace it with
> > > hwmon_device_register_with_info() for acpi_power_meter driver, I found that
> > > the power channel attribute in linux/hwmon.h have to extend and is more
> > > than 32 after this replacement.
> > >
> > > However, the maximum number of hwmon channel attributes is 32 which is
> > > limited by current hwmon codes. This is not good to add new channel
> > > attribute for some hwmon sensor type and support more channel attribute.
> > >
> > > This series are aimed to do this. And also make sure that acpi_power_meter
> > > driver can successfully replace the deprecated hwmon_device_register()
> > > later.
>
> This explanation completely misses the point. The series tries to make space
> for additional "standard" attributes. Such a change should be independent
> of a driver conversion and be discussed on its own, not in the context
> of a new driver or a driver conversion.
I think something needs to budge here, because I think what you're
asking is actually impossible!
One can't change the type of struct hwmon_channel_info.config to be a
u64 without also updating every hwmon driver that assigns to that
member.
This is not possible:
struct hwmon_channel_info {
enum hwmon_sensor_types type;
- const u32 *config;
+ const u64 *config;
};
static u32 marvell_hwmon_chip_config[] = {
...
};
static const struct hwmon_channel_info marvell_hwmon_chip = {
.type = hwmon_chip,
.config = marvell_hwmon_chip_config,
};
This assignment to .config will cause a warning/error with the above
change. If instead we do:
- .config = marvell_hwmon_chip_config,
+ .config = (u64 *)marvell_hwmon_chip_config,
which would have to happen to every driver, then no, this also doesn't
work, because config[1] now points beyond the bounds of
marvell_hwmon_chip_config, which only has two u32 entries.
You can't just change the type of struct hwmon_channel_info.config
without patching every driver that assigns to
struct hwmon_channel_info.config as things currently stand.
The only way out of that would be:
1. convert *all* drivers that defines a config array to be defined by
their own macro in hwmon.h, and then switch that macro to make the
definitions be a u64 array at the same time as switching struct
hwmon_channel_info.config
2. convert *all* drivers to use HWMON_CHANNEL_INFO() unconditionally,
and switch that along with struct hwmon_channel_info.config.
3. add a new member to struct hwmon_channel_info such as
"const u64 *config64" and then gradually convert drivers to use it.
Once everyone is converted over, then remove "const u32 *config",
optionally rename "config64" back to "config" and then re-patch all
drivers. That'll be joyful, with multiple patches to drivers that
need to be merged in sync with hwmon changes - and last over several
kernel release cycles.
This is not going to be an easy change!
--
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!
^ permalink raw reply [flat|nested] 40+ messages in thread* Re: [PATCH v1 00/21] hwmon: Fix the type of 'config' in struct hwmon_channel_info to u64
2025-01-21 17:20 ` Russell King (Oracle)
@ 2025-01-21 17:37 ` Guenter Roeck
2025-01-22 4:06 ` lihuisong (C)
1 sibling, 0 replies; 40+ messages in thread
From: Guenter Roeck @ 2025-01-21 17:37 UTC (permalink / raw)
To: Russell King (Oracle)
Cc: Armin Wolf, Huisong Li, linux-hwmon, linux-kernel, linux-media,
linux-arm-kernel, arm-scmi, netdev, linux-rtc, oss-drivers,
linux-rdma, platform-driver-x86, linuxarm, jdelvare, kernel,
pauk.denis, james, sudeep.holla, cristian.marussi, matt, mchehab,
irusskikh, andrew+netdev, davem, edumazet, kuba, pabeni, saeedm,
leon, tariqt, louis.peens, hkallweit1, kabel, hdegoede,
ilpo.jarvinen, alexandre.belloni, krzk, jonathan.cameron,
zhanjie9, zhenglifeng1, liuyonglong
On 1/21/25 09:20, Russell King (Oracle) wrote:
[ ... ]
>
> 1. convert *all* drivers that defines a config array to be defined by
> their own macro in hwmon.h, and then switch that macro to make the
> definitions be a u64 array at the same time as switching struct
> hwmon_channel_info.config
>
> 2. convert *all* drivers to use HWMON_CHANNEL_INFO() unconditionally,
> and switch that along with struct hwmon_channel_info.config.
>
> 3. add a new member to struct hwmon_channel_info such as
> "const u64 *config64" and then gradually convert drivers to use it.
> Once everyone is converted over, then remove "const u32 *config",
> optionally rename "config64" back to "config" and then re-patch all
> drivers. That'll be joyful, with multiple patches to drivers that
> need to be merged in sync with hwmon changes - and last over several
> kernel release cycles.
>
Alternatively, add another sensor type for the overflowing field, such as
hwmon_power_2 (or whatever), and use it for the additional attributes.
> This is not going to be an easy change!
>
Neither is it necessary at this time.
Guenter
^ permalink raw reply [flat|nested] 40+ messages in thread
* Re: [PATCH v1 00/21] hwmon: Fix the type of 'config' in struct hwmon_channel_info to u64
2025-01-21 17:20 ` Russell King (Oracle)
2025-01-21 17:37 ` Guenter Roeck
@ 2025-01-22 4:06 ` lihuisong (C)
1 sibling, 0 replies; 40+ messages in thread
From: lihuisong (C) @ 2025-01-22 4:06 UTC (permalink / raw)
To: Russell King (Oracle), Guenter Roeck
Cc: Armin Wolf, linux-hwmon, linux-kernel, linux-media,
linux-arm-kernel, arm-scmi, netdev, linux-rtc, oss-drivers,
linux-rdma, platform-driver-x86, linuxarm, jdelvare, kernel,
pauk.denis, james, sudeep.holla, cristian.marussi, matt, mchehab,
irusskikh, andrew+netdev, davem, edumazet, kuba, pabeni, saeedm,
leon, tariqt, louis.peens, hkallweit1, kabel, hdegoede,
ilpo.jarvinen, alexandre.belloni, krzk, jonathan.cameron,
zhanjie9, zhenglifeng1, liuyonglong
Hi
在 2025/1/22 1:20, Russell King (Oracle) 写道:
> On Tue, Jan 21, 2025 at 06:50:00AM -0800, Guenter Roeck wrote:
>> On 1/21/25 06:12, Armin Wolf wrote:
>>> Am 21.01.25 um 07:44 schrieb Huisong Li:
>>>> The hwmon_device_register() is deprecated. When I try to repace it with
>>>> hwmon_device_register_with_info() for acpi_power_meter driver, I found that
>>>> the power channel attribute in linux/hwmon.h have to extend and is more
>>>> than 32 after this replacement.
>>>>
>>>> However, the maximum number of hwmon channel attributes is 32 which is
>>>> limited by current hwmon codes. This is not good to add new channel
>>>> attribute for some hwmon sensor type and support more channel attribute.
>>>>
>>>> This series are aimed to do this. And also make sure that acpi_power_meter
>>>> driver can successfully replace the deprecated hwmon_device_register()
>>>> later.
>> This explanation completely misses the point. The series tries to make space
>> for additional "standard" attributes. Such a change should be independent
>> of a driver conversion and be discussed on its own, not in the context
>> of a new driver or a driver conversion.
> I think something needs to budge here, because I think what you're
> asking is actually impossible!
>
> One can't change the type of struct hwmon_channel_info.config to be a
> u64 without also updating every hwmon driver that assigns to that
> member.
>
> This is not possible:
>
> struct hwmon_channel_info {
> enum hwmon_sensor_types type;
> - const u32 *config;
> + const u64 *config;
> };
>
> static u32 marvell_hwmon_chip_config[] = {
> ...
> };
>
> static const struct hwmon_channel_info marvell_hwmon_chip = {
> .type = hwmon_chip,
> .config = marvell_hwmon_chip_config,
> };
>
> This assignment to .config will cause a warning/error with the above
> change. If instead we do:
>
> - .config = marvell_hwmon_chip_config,
> + .config = (u64 *)marvell_hwmon_chip_config,
>
> which would have to happen to every driver, then no, this also doesn't
> work, because config[1] now points beyond the bounds of
> marvell_hwmon_chip_config, which only has two u32 entries.
>
> You can't just change the type of struct hwmon_channel_info.config
> without patching every driver that assigns to
> struct hwmon_channel_info.config as things currently stand.
>
> The only way out of that would be:
>
> 1. convert *all* drivers that defines a config array to be defined by
> their own macro in hwmon.h, and then switch that macro to make the
> definitions be a u64 array at the same time as switching struct
> hwmon_channel_info.config
>
> 2. convert *all* drivers to use HWMON_CHANNEL_INFO() unconditionally,
> and switch that along with struct hwmon_channel_info.config.
>
> 3. add a new member to struct hwmon_channel_info such as
> "const u64 *config64" and then gradually convert drivers to use it.
> Once everyone is converted over, then remove "const u32 *config",
> optionally rename "config64" back to "config" and then re-patch all
> drivers. That'll be joyful, with multiple patches to drivers that
> need to be merged in sync with hwmon changes - and last over several
> kernel release cycles.
>
> This is not going to be an easy change!
Yeah, it's a very time-consuming method and not easy to change.
Although some attributes of acpi_power_meter, like power1_model_number,
can not add to the generic hwmon power attributes,
I still don't think the maximum attribute number of one sensor type
doesn't need to limit to 32.
We can not make sure that the current generic attributes can fully
satisfy the useage in furture.
I got an idea. it may just need one patch in hwmon core, like the following:
-->
struct hwmon_channel_info {
enum hwmon_sensor_types type;
- const u32 *config;
+ union {
+ const u32 *config;
+ const u64 *config64;
+ }
};
#define HWMON_CHANNEL_INFO(stype, ...) \
@@ -444,12 +447,22 @@ struct hwmon_channel_info {
} \
})
+#define HWMON_CHANNEL_INFO64(stype, ...) \
+ (&(const struct hwmon_channel_info) { \
+ .type = hwmon_##stype, \
+ .config64 = (const u64 []) { \
+ __VA_ARGS__, 0 \
+ } \
+ })
+
+
/**
* struct hwmon_chip_info - Chip configuration
* @ops: Pointer to hwmon operations.
* @info: Null-terminated list of channel information.
*/
struct hwmon_chip_info {
+ bool hwmon_attribute_bit64; // use config64 pointer if it is true.
const struct hwmon_ops *ops;
const struct hwmon_channel_info * const *info;
};
For hwmon core code, we can use the 'config' or 'confit64' and compute
attribute number based on the 'hwmon_attribute_bit64' value.
New driver can use HWMON_CHANNEL_INFO64 macro. Old drivers are not
supposed to need to have any modification.
/Huisong
>
^ permalink raw reply [flat|nested] 40+ messages in thread
* Re: [PATCH v1 00/21] hwmon: Fix the type of 'config' in struct hwmon_channel_info to u64
2025-01-21 14:50 ` Guenter Roeck
2025-01-21 17:20 ` Russell King (Oracle)
@ 2025-01-22 2:52 ` lihuisong (C)
2025-01-22 3:19 ` Guenter Roeck
1 sibling, 1 reply; 40+ messages in thread
From: lihuisong (C) @ 2025-01-22 2:52 UTC (permalink / raw)
To: Guenter Roeck, Armin Wolf, linux-hwmon
Cc: linux-kernel, linux-media, linux-arm-kernel, arm-scmi, netdev,
linux-rtc, oss-drivers, linux-rdma, platform-driver-x86, linuxarm,
jdelvare, kernel, pauk.denis, james, sudeep.holla,
cristian.marussi, matt, mchehab, irusskikh, andrew+netdev, davem,
edumazet, kuba, pabeni, saeedm, leon, tariqt, louis.peens,
hkallweit1, linux, kabel, hdegoede, ilpo.jarvinen,
alexandre.belloni, krzk, jonathan.cameron, zhanjie9, zhenglifeng1,
liuyonglong
Hi Guenter,
在 2025/1/21 22:50, Guenter Roeck 写道:
> On 1/21/25 06:12, Armin Wolf wrote:
>> Am 21.01.25 um 07:44 schrieb Huisong Li:
>>
>>> The hwmon_device_register() is deprecated. When I try to repace it with
>>> hwmon_device_register_with_info() for acpi_power_meter driver, I
>>> found that
>>> the power channel attribute in linux/hwmon.h have to extend and is more
>>> than 32 after this replacement.
>>>
>>> However, the maximum number of hwmon channel attributes is 32 which is
>>> limited by current hwmon codes. This is not good to add new channel
>>> attribute for some hwmon sensor type and support more channel
>>> attribute.
>>>
>>> This series are aimed to do this. And also make sure that
>>> acpi_power_meter
>>> driver can successfully replace the deprecated hwmon_device_register()
>>> later.
>>
>
> This explanation completely misses the point. The series tries to make
> space
> for additional "standard" attributes. Such a change should be independent
> of a driver conversion and be discussed on its own, not in the context
> of a new driver or a driver conversion.
Making space for new attributes later.
After all hwmon core have ability to do that.
>
>> Hi,
>>
>> what kind of new power attributes do you want to add to the hwmon API?
>>
>> AFAIK the acpi-power-meter driver supports the following attributes:
>>
>> power1_accuracy -> HWMON_P_ACCURACY
>> power1_cap_min -> HWMON_P_CAP_MIN
>> power1_cap_max -> HWMON_P_CAP_MAX
>> power1_cap_hyst -> HWMON_P_CAP_HYST
>> power1_cap -> HWMON_P_CAP
>> power1_average -> HWMON_P_AVERAGE
>> power1_average_min -> HWMON_P_AVERAGE_MIN
>> power1_average_max -> HWMON_P_AVERAGE_MAX
>> power1_average_interval -> HWMON_P_AVERAGE_INTERVAL
>> power1_average_interval_min -> HWMON_P_AVERAGE_INTERVAL_MIN
>> power1_average_interval_max -> HWMON_P_AVERAGE_INTERVAL_MAX
>> power1_alarm -> HWMON_P_ALARM
>> power1_model_number
>> power1_oem_info
>> power1_serial_number
>> power1_is_battery
>> name -> handled by hwmon core
>>
>> The remaining attributes are in my opinion not generic enough to add
>> them to the generic
>> hwmon power attributes. I think you should implement them as a
>> attribute_group which can
>> be passed to hwmon_device_register_with_info() using the
>> "extra_groups" parameter.
>>
>
> I absolutely agree. More specifically, it looks like this is about the
> following
> attributes.
>
> > power1_model_number
> > power1_oem_info
> > power1_serial_number
> > power1_is_battery
>
> Those are not hwmon attributes and should not be (or have been) exposed
> as sysfs attributes in the first place, but (if really wanted/needed)
> through debugfs files. Even _if_ exposed as sysfs attributes they should
> not have the power1_ prefix (except maybe for the last one).
I plan to accept the suggestion Armin proposed that acpi_power_meter can
use the "extra_groups" parameter for these "not generic hwmon power
attributes".
Should we drop the power1_ prefix? But this will lead to the change of
these attributes.
Do you mean 'power1_is_battery' can be added to hwmon power attributes
in hwmon.h?
>
> On top of that, doubling the size of configuration bits for everything
> because one sensor type needs more than 32 bits seems excessive.
> If we ever get to that point I think I'd rather introduce a second
> sensor type for power sensor attributes.
>
The bigest obstacle is that drivers which not use HWMON_CHANNEL_INFO
hwmon provided need to be modifyed.🙁
>
> .
^ permalink raw reply [flat|nested] 40+ messages in thread
* Re: [PATCH v1 00/21] hwmon: Fix the type of 'config' in struct hwmon_channel_info to u64
2025-01-22 2:52 ` lihuisong (C)
@ 2025-01-22 3:19 ` Guenter Roeck
2025-01-22 3:36 ` lihuisong (C)
0 siblings, 1 reply; 40+ messages in thread
From: Guenter Roeck @ 2025-01-22 3:19 UTC (permalink / raw)
To: lihuisong (C), Armin Wolf, linux-hwmon
Cc: linux-kernel, linux-media, linux-arm-kernel, arm-scmi, netdev,
linux-rtc, oss-drivers, linux-rdma, platform-driver-x86, linuxarm,
jdelvare, kernel, pauk.denis, james, sudeep.holla,
cristian.marussi, matt, mchehab, irusskikh, andrew+netdev, davem,
edumazet, kuba, pabeni, saeedm, leon, tariqt, louis.peens,
hkallweit1, linux, kabel, hdegoede, ilpo.jarvinen,
alexandre.belloni, krzk, jonathan.cameron, zhanjie9, zhenglifeng1,
liuyonglong
On 1/21/25 18:52, lihuisong (C) wrote:
>> Those are not hwmon attributes and should not be (or have been) exposed
>> as sysfs attributes in the first place, but (if really wanted/needed)
>> through debugfs files. Even _if_ exposed as sysfs attributes they should
>> not have the power1_ prefix (except maybe for the last one).
> I plan to accept the suggestion Armin proposed that acpi_power_meter can use the "extra_groups" parameter for these "not generic hwmon power attributes".
> Should we drop the power1_ prefix? But this will lead to the change of these attributes.
> Do you mean 'power1_is_battery' can be added to hwmon power attributes in hwmon.h?
No; power1_is_battery is still not a hardware monitoring attribute,
much less one to standardize. Also, don't change any attribute names.
They are wrong, but they are the ABI for this driver.
Guenter
^ permalink raw reply [flat|nested] 40+ messages in thread
* Re: [PATCH v1 00/21] hwmon: Fix the type of 'config' in struct hwmon_channel_info to u64
2025-01-22 3:19 ` Guenter Roeck
@ 2025-01-22 3:36 ` lihuisong (C)
0 siblings, 0 replies; 40+ messages in thread
From: lihuisong (C) @ 2025-01-22 3:36 UTC (permalink / raw)
To: Guenter Roeck, Armin Wolf, linux-hwmon
Cc: linux-kernel, linux-media, linux-arm-kernel, arm-scmi, netdev,
linux-rtc, oss-drivers, linux-rdma, platform-driver-x86, linuxarm,
jdelvare, kernel, pauk.denis, james, sudeep.holla,
cristian.marussi, matt, mchehab, irusskikh, andrew+netdev, davem,
edumazet, kuba, pabeni, saeedm, leon, tariqt, louis.peens,
hkallweit1, linux, kabel, hdegoede, ilpo.jarvinen,
alexandre.belloni, krzk, jonathan.cameron, zhanjie9, zhenglifeng1,
liuyonglong
在 2025/1/22 11:19, Guenter Roeck 写道:
> On 1/21/25 18:52, lihuisong (C) wrote:
>
>>> Those are not hwmon attributes and should not be (or have been) exposed
>>> as sysfs attributes in the first place, but (if really wanted/needed)
>>> through debugfs files. Even _if_ exposed as sysfs attributes they
>>> should
>>> not have the power1_ prefix (except maybe for the last one).
>> I plan to accept the suggestion Armin proposed that acpi_power_meter
>> can use the "extra_groups" parameter for these "not generic hwmon
>> power attributes".
>> Should we drop the power1_ prefix? But this will lead to the change
>> of these attributes.
>> Do you mean 'power1_is_battery' can be added to hwmon power
>> attributes in hwmon.h?
>
> No; power1_is_battery is still not a hardware monitoring attribute,
> much less one to standardize. Also, don't change any attribute names.
> They are wrong, but they are the ABI for this driver.
>
Ok, it's clear now.
> .
^ permalink raw reply [flat|nested] 40+ messages in thread
* Re: [PATCH v1 00/21] hwmon: Fix the type of 'config' in struct hwmon_channel_info to u64
2025-01-21 14:12 ` Armin Wolf
2025-01-21 14:50 ` Guenter Roeck
@ 2025-01-22 2:34 ` lihuisong (C)
1 sibling, 0 replies; 40+ messages in thread
From: lihuisong (C) @ 2025-01-22 2:34 UTC (permalink / raw)
To: Armin Wolf
Cc: linux-hwmon, linux-kernel, linux-media, linux-arm-kernel,
arm-scmi, netdev, linux-rtc, oss-drivers, linux-rdma,
platform-driver-x86, linuxarm, linux, jdelvare, kernel,
pauk.denis, james, sudeep.holla, cristian.marussi, matt, mchehab,
irusskikh, andrew+netdev, davem, edumazet, kuba, pabeni, saeedm,
leon, tariqt, louis.peens, hkallweit1, linux, kabel, hdegoede,
ilpo.jarvinen, alexandre.belloni, krzk, jonathan.cameron,
zhanjie9, zhenglifeng1, liuyonglong
在 2025/1/21 22:12, Armin Wolf 写道:
> Am 21.01.25 um 07:44 schrieb Huisong Li:
>
>> The hwmon_device_register() is deprecated. When I try to repace it with
>> hwmon_device_register_with_info() for acpi_power_meter driver, I
>> found that
>> the power channel attribute in linux/hwmon.h have to extend and is more
>> than 32 after this replacement.
>>
>> However, the maximum number of hwmon channel attributes is 32 which is
>> limited by current hwmon codes. This is not good to add new channel
>> attribute for some hwmon sensor type and support more channel attribute.
>>
>> This series are aimed to do this. And also make sure that
>> acpi_power_meter
>> driver can successfully replace the deprecated hwmon_device_register()
>> later.
>
> Hi,
>
> what kind of new power attributes do you want to add to the hwmon API?
The attributes you list is right.
>
> AFAIK the acpi-power-meter driver supports the following attributes:
>
> power1_accuracy -> HWMON_P_ACCURACY
> power1_cap_min -> HWMON_P_CAP_MIN
> power1_cap_max -> HWMON_P_CAP_MAX
> power1_cap_hyst -> HWMON_P_CAP_HYST
> power1_cap -> HWMON_P_CAP
> power1_average -> HWMON_P_AVERAGE
> power1_average_min -> HWMON_P_AVERAGE_MIN
> power1_average_max -> HWMON_P_AVERAGE_MAX
> power1_average_interval -> HWMON_P_AVERAGE_INTERVAL
> power1_average_interval_min -> HWMON_P_AVERAGE_INTERVAL_MIN
> power1_average_interval_max -> HWMON_P_AVERAGE_INTERVAL_MAX
> power1_alarm -> HWMON_P_ALARM
> power1_model_number
> power1_oem_info
> power1_serial_number
> power1_is_battery
> name -> handled by hwmon core
>
> The remaining attributes are in my opinion not generic enough to add
> them to the generic
> hwmon power attributes. I think you should implement them as a
> attribute_group which can
> be passed to hwmon_device_register_with_info() using the
> "extra_groups" parameter.
>
This is a good idea. Thanks.
>
>>
>> Huisong Li (21):
>> hwmon: Fix the type of 'config' in struct hwmon_channel_info to u64
>> media: video-i2c: Use HWMON_CHANNEL_INFO macro to simplify code
>> net: aquantia: Use HWMON_CHANNEL_INFO macro to simplify code
>> net: nfp: Use HWMON_CHANNEL_INFO macro to simplify code
>> net: phy: marvell: Use HWMON_CHANNEL_INFO macro to simplify code
>> net: phy: marvell10g: Use HWMON_CHANNEL_INFO macro to simplify code
>> rtc: ab-eoz9: Use HWMON_CHANNEL_INFO macro to simplify code
>> rtc: ds3232: Use HWMON_CHANNEL_INFO macro to simplify code
>> w1: w1_therm: w1: Use HWMON_CHANNEL_INFO macro to simplify code
>> net: phy: aquantia: Use HWMON_CHANNEL_INFO macro to simplify code
>> hwmon: (asus_wmi_sensors) Fix type of 'config' in struct
>> hwmon_channel_info to u64
>> hwmon: (hp-wmi-sensors) Fix type of 'config' in struct
>> hwmon_channel_info to u64
>> hwmon: (mr75203) Fix the type of 'config' in struct
>> hwmon_channel_info
>> to u64
>> hwmon: (pwm-fan) Fix the type of 'config' in struct
>> hwmon_channel_info
>> to u64
>> hwmon: (scmi-hwmon) Fix the type of 'config' in struct
>> hwmon_channel_info to u64
>> hwmon: (tmp401) Fix the type of 'config' in struct hwmon_channel_info
>> to u64
>> hwmon: (tmp421) Fix the type of 'config' in struct hwmon_channel_info
>> to u64
>> net/mlx5: Fix the type of 'config' in struct hwmon_channel_info to
>> u64
>> platform/x86: dell-ddv: Fix the type of 'config' in struct
>> hwmon_channel_info to u64
>> hwmon: (asus-ec-sensors) Fix the type of 'config' in struct
>> hwmon_channel_info to u64
>> hwmon: (lm90) Fix the type of 'config' in struct
>> hwmon_channel_info to
>> u64
>>
>> drivers/hwmon/asus-ec-sensors.c | 6 +-
>> drivers/hwmon/asus_wmi_sensors.c | 8 +-
>> drivers/hwmon/hp-wmi-sensors.c | 6 +-
>> drivers/hwmon/hwmon.c | 4 +-
>> drivers/hwmon/lm90.c | 4 +-
>> drivers/hwmon/mr75203.c | 6 +-
>> drivers/hwmon/pwm-fan.c | 4 +-
>> drivers/hwmon/scmi-hwmon.c | 6 +-
>> drivers/hwmon/tmp401.c | 4 +-
>> drivers/hwmon/tmp421.c | 2 +-
>> drivers/media/i2c/video-i2c.c | 12 +-
>> .../ethernet/aquantia/atlantic/aq_drvinfo.c | 14 +-
>> .../net/ethernet/mellanox/mlx5/core/hwmon.c | 8 +-
>> .../net/ethernet/netronome/nfp/nfp_hwmon.c | 40 +--
>> drivers/net/phy/aquantia/aquantia_hwmon.c | 32 +-
>> drivers/net/phy/marvell.c | 24 +-
>> drivers/net/phy/marvell10g.c | 24 +-
>> drivers/platform/x86/dell/dell-wmi-ddv.c | 6 +-
>> drivers/rtc/rtc-ab-eoz9.c | 24 +-
>> drivers/rtc/rtc-ds3232.c | 24 +-
>> drivers/w1/slaves/w1_therm.c | 12 +-
>> include/linux/hwmon.h | 300 +++++++++---------
>> 22 files changed, 205 insertions(+), 365 deletions(-)
>>
> .
^ permalink raw reply [flat|nested] 40+ messages in thread