Use HWMON_CHANNEL_INFO macro to simplify code
Subsystems (6)
v2 cover Use HWMON_CHANNEL_INFO macro to simplify code
The HWMON_CHANNEL_INFO macro is provided by hwmon.h and used widely by many other drivers. This series use HWMON_CHANNEL_INFO macro to simplify code in net subsystem.
Note: These patches do not depend on each other. Put them togeter just for belonging to the same subsystem.
---
-v2:
* detach these patches from the series[1]
[1] https://lore.kernel.org/lkml/[email protected]/T/
Huisong Li (5):
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
net: phy: aquantia: Use HWMON_CHANNEL_INFO macro to simplify code
.../ethernet/aquantia/atlantic/aq_drvinfo.c | 14 +------ .../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 +---------- 5 files changed, 17 insertions(+), 117 deletions(-)
Signature · 1 line
2.22.0
PATCH v2 1/5 net: aquantia: Use HWMON_CHANNEL_INFO macro to simplify code
Use HWMON_CHANNEL_INFO macro to simplify code.
--- .../net/ethernet/aquantia/atlantic/aq_drvinfo.c | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-)
drivers/net/ethernet/aquantia/atlantic/aq_drvinfo.c +2 -12
@@ -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 , };
Signature · 1 line
2.22.0
PATCH v2 2/5 net: nfp: Use HWMON_CHANNEL_INFO macro to simplify code
In reply to Huisong LiUse HWMON_CHANNEL_INFO macro to simplify code.
--- .../net/ethernet/netronome/nfp/nfp_hwmon.c | 40 +++---------------- 1 file changed, 5 insertions(+), 35 deletions(-)
drivers/net/ethernet/netronome/nfp/nfp_hwmon.c +5 -35
@@ -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 };
Signature · 1 line
2.22.0
PATCH v2 3/5 net: phy: marvell: Use HWMON_CHANNEL_INFO macro to simplify code
In reply to Huisong LiUse HWMON_CHANNEL_INFO macro to simplify code.
--- drivers/net/phy/marvell.c | 24 ++---------------------- 1 file changed, 2 insertions(+), 22 deletions(-)
drivers/net/phy/marvell.c +2 -22
@@ -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 };
Signature · 1 line
2.22.0
PATCH v2 4/5 net: phy: marvell10g: Use HWMON_CHANNEL_INFO macro to simplify code
In reply to Huisong LiUse HWMON_CHANNEL_INFO macro to simplify code.
--- drivers/net/phy/marvell10g.c | 24 ++---------------------- 1 file changed, 2 insertions(+), 22 deletions(-)
drivers/net/phy/marvell10g.c +2 -22
@@ -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 , };
Signature · 1 line
2.22.0
PATCH v2 5/5 net: phy: aquantia: Use HWMON_CHANNEL_INFO macro to simplify code
In reply to Huisong LiUse HWMON_CHANNEL_INFO macro to simplify code.
--- drivers/net/phy/aquantia/aquantia_hwmon.c | 32 +++++------------------ 1 file changed, 6 insertions(+), 26 deletions(-)
drivers/net/phy/aquantia/aquantia_hwmon.c +6 -26
@@ -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 , };
Signature · 1 line
2.22.0
This series was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:
Hello:
This series was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:
Quoted 8 lines · On Mon, 10 Feb 2025 13:47:05 +0800 you wrote:
The
HWMON_CHANNEL_INFOmacro is provided byhwmon.hand used widely by many other drivers. This series useHWMON_CHANNEL_INFOmacro to simplify code in net subsystem.Note: These patches do not depend on each other. Put them togeter just for belonging to the same subsystem.
[...]
Here is the summary with links:
- [v2,1/5] net: aquantia: Use HWMON_CHANNEL_INFO macro to simplify code
https://git.kernel.org/netdev/net-next/c/43a0d7f26ad7 - [v2,2/5] net: nfp: Use HWMON_CHANNEL_INFO macro to simplify code https://git.kernel.org/netdev/net-next/c/e05427c4d138 - [v2,3/5] net: phy: marvell: Use HWMON_CHANNEL_INFO macro to simplify code https://git.kernel.org/netdev/net-next/c/0cb595e80edc - [v2,4/5] net: phy: marvell10g: Use HWMON_CHANNEL_INFO macro to simplify code https://git.kernel.org/netdev/net-next/c/4798f4834b2e - [v2,5/5] net: phy: aquantia: Use HWMON_CHANNEL_INFO macro to simplify code https://git.kernel.org/netdev/net-next/c/d6085a23b3b4
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html