net: sfp: use simplified HWMON_CHANNEL_INFO macro
Subsystems (5)
PATCH 1/1 net: sfp: use simplified HWMON_CHANNEL_INFO macro
This makes the code look cleaner and easier to read.
--- drivers/net/phy/sfp.c | 121 +++++++++++++----------------------------- 1 file changed, 38 insertions(+), 83 deletions(-)
drivers/net/phy/sfp.c +38 -83
@@ -1195,90 +1195,45 @@ static const struct hwmon_ops sfp_hwmon_ops = { .read_string = sfp_hwmon_read_string, }; -static u32 sfp_hwmon_chip_config[] = { -HWMON_C_REGISTER_TZ , -0 , -}; - -static const struct hwmon_channel_info sfp_hwmon_chip = { - .type = hwmon_chip, - .config = sfp_hwmon_chip_config, -}; - -static u32 sfp_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 | -HWMON_T_LABEL , -0 , -}; - -static const struct hwmon_channel_info sfp_hwmon_temp_channel_info = { - .type = hwmon_temp, - .config = sfp_hwmon_temp_config, -}; - -static u32 sfp_hwmon_vcc_config[] = { -HWMON_I_INPUT | -HWMON_I_MAX |HWMON_I_MIN | -HWMON_I_MAX_ALARM |HWMON_I_MIN_ALARM | -HWMON_I_CRIT |HWMON_I_LCRIT | -HWMON_I_CRIT_ALARM |HWMON_I_LCRIT_ALARM | -HWMON_I_LABEL , -0 , -}; - -static const struct hwmon_channel_info sfp_hwmon_vcc_channel_info = { - .type = hwmon_in, - .config = sfp_hwmon_vcc_config, -}; - -static u32 sfp_hwmon_bias_config[] = { -HWMON_C_INPUT | -HWMON_C_MAX |HWMON_C_MIN | -HWMON_C_MAX_ALARM |HWMON_C_MIN_ALARM | -HWMON_C_CRIT |HWMON_C_LCRIT | -HWMON_C_CRIT_ALARM |HWMON_C_LCRIT_ALARM | -HWMON_C_LABEL , -0 , -}; - -static const struct hwmon_channel_info sfp_hwmon_bias_channel_info = { - .type = hwmon_curr, - .config = sfp_hwmon_bias_config, -}; - -static u32 sfp_hwmon_power_config[] = { -/* Transmit power */ -HWMON_P_INPUT | -HWMON_P_MAX |HWMON_P_MIN | -HWMON_P_MAX_ALARM |HWMON_P_MIN_ALARM | -HWMON_P_CRIT |HWMON_P_LCRIT | -HWMON_P_CRIT_ALARM |HWMON_P_LCRIT_ALARM | -HWMON_P_LABEL , -/* Receive power */ -HWMON_P_INPUT | -HWMON_P_MAX |HWMON_P_MIN | -HWMON_P_MAX_ALARM |HWMON_P_MIN_ALARM | -HWMON_P_CRIT |HWMON_P_LCRIT | -HWMON_P_CRIT_ALARM |HWMON_P_LCRIT_ALARM | -HWMON_P_LABEL , -0 , -}; - -static const struct hwmon_channel_info sfp_hwmon_power_channel_info = { - .type = hwmon_power, - .config = sfp_hwmon_power_config, -}; -static const struct hwmon_channel_info *sfp_hwmon_info[] = { - &sfp_hwmon_chip, - &sfp_hwmon_vcc_channel_info, - &sfp_hwmon_temp_channel_info, - &sfp_hwmon_bias_channel_info, - &sfp_hwmon_power_channel_info, +HWMON_CHANNEL_INFO (chip, +HWMON_C_REGISTER_TZ ), +HWMON_CHANNEL_INFO (in, +HWMON_I_INPUT | +HWMON_I_MAX |HWMON_I_MIN | +HWMON_I_MAX_ALARM |HWMON_I_MIN_ALARM | +HWMON_I_CRIT |HWMON_I_LCRIT | +HWMON_I_CRIT_ALARM |HWMON_I_LCRIT_ALARM | +HWMON_I_LABEL ), +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 | +HWMON_T_LABEL ), +HWMON_CHANNEL_INFO (curr, +HWMON_C_INPUT | +HWMON_C_MAX |HWMON_C_MIN | +HWMON_C_MAX_ALARM |HWMON_C_MIN_ALARM | +HWMON_C_CRIT |HWMON_C_LCRIT | +HWMON_C_CRIT_ALARM |HWMON_C_LCRIT_ALARM | +HWMON_C_LABEL ), +HWMON_CHANNEL_INFO (power, +/* Transmit power */ +HWMON_P_INPUT | +HWMON_P_MAX |HWMON_P_MIN | +HWMON_P_MAX_ALARM |HWMON_P_MIN_ALARM | +HWMON_P_CRIT |HWMON_P_LCRIT | +HWMON_P_CRIT_ALARM |HWMON_P_LCRIT_ALARM | +HWMON_P_LABEL , +/* Receive power */ +HWMON_P_INPUT | +HWMON_P_MAX |HWMON_P_MIN | +HWMON_P_MAX_ALARM |HWMON_P_MIN_ALARM | +HWMON_P_CRIT |HWMON_P_LCRIT | +HWMON_P_CRIT_ALARM |HWMON_P_LCRIT_ALARM | +HWMON_P_LABEL ),NULL , };
Signature · 1 line
2.25.1
Jakub Kicinski
maintainerQuoted 1 line · On Sat, 13 Aug 2022 23:46:58 +0300 Beniamin Sandu wrote:
This makes the code look cleaner and easier to read.
Last call for reviews..
Russell King (Oracle)
maintainerQuoted 4 lines · Jakub Kicinski
Quoted 1 line · On Sat, 13 Aug 2022 23:46:58 +0300 Beniamin Sandu wrote:
This makes the code look cleaner and easier to read.
Last call for reviews..
I had a quick look and couldn't see anything obviously wrong, but then I'm no expert with the hwmon code. I build-tested it, and I'm not likely to any time soon. I think Andrew added the hwmon code for this PHY originally.
Signature · 2 lines
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/ FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!
Jakub Kicinski
maintainerQuoted 8 lines · On Wed, 17 Aug 2022 17:12:24 +0100 Russell King (Oracle) wrote:
Quoted 4 lines · Jakub Kicinski
Quoted 1 line · On Sat, 13 Aug 2022 23:46:58 +0300 Beniamin Sandu wrote:
This makes the code look cleaner and easier to read.
Last call for reviews..
I had a quick look and couldn't see anything obviously wrong, but then I'm no expert with the hwmon code.
That makes two of us, good enough! :) Thanks for taking a look.
Quoted 2 lines
I build-tested it, and I'm not likely to any time soon. I think Andrew added the hwmon code for this PHY originally.
Andrew Lunn
maintainerQuoted 11 lines · Jakub Kicinski
Quoted 8 lines · On Wed, 17 Aug 2022 17:12:24 +0100 Russell King (Oracle) wrote:
Quoted 4 lines · Jakub Kicinski
Quoted 1 line · On Sat, 13 Aug 2022 23:46:58 +0300 Beniamin Sandu wrote:
This makes the code look cleaner and easier to read.
Last call for reviews..
I had a quick look and couldn't see anything obviously wrong, but then I'm no expert with the hwmon code.
That makes two of us, good enough! :) Thanks for taking a look.
It would of been nice to Cc: the HWMON maintainer. His input would of been just as valuable as a PHY Maintainer.
Andrew
Jakub Kicinski
maintainerQuoted 7 lines · On Thu, 18 Aug 2022 03:21:53 +0200 Andrew Lunn wrote:
Quoted 4 lines
Quoted 2 lines
I had a quick look and couldn't see anything obviously wrong, but then I'm no expert with the hwmon code.
That makes two of us, good enough! :) Thanks for taking a look.
It would of been nice to Cc: the HWMON maintainer. His input would of been just as valuable as a PHY Maintainer.
Fair point, I lazy'd out and only checked that everyone get_maintainers asks for was CCed. Perhaps it'd be worth extending the hwmon's keyword match to trigger on the structs or the constants if it matters. Adding hwmon@ to CC just in case.
Guenter Roeck
maintainerQuoted 6 lines · Jakub Kicinski
Quoted 5 lines · On Thu, 18 Aug 2022 03:21:53 +0200 Andrew Lunn wrote:
Quoted 4 lines
Quoted 2 lines
I had a quick look and couldn't see anything obviously wrong, but then I'm no expert with the hwmon code.
That makes two of us, good enough! :) Thanks for taking a look.
Quoted 7 lines
Quoted 2 lines
It would of been nice to Cc: the HWMON maintainer. His input would of been just as valuable as a PHY Maintainer.
Fair point, I lazy'd out and only checked that everyone
get_maintainersasks for was CCed. Perhaps it'd be worth extending the hwmon's keyword match to trigger on the structs or the constants if it matters. Adding hwmon@ to CC just in case.
And you expect me to dig up the actual patch ?
Guenter
Jakub Kicinski
maintainerQuoted 1 line · On Thu, 18 Aug 2022 09:58:56 -0700 Guenter Roeck wrote:
And you expect me to dig up the actual patch ?
Sorry, I assumed we all have some form of fast lore access built into our email setups. Here's the link to your reply and therefore the thread:
https://lore.kernel.org/all/[email protected]/
Speaking of expectations tho, I would expect you to not ask me rhetorical passive aggressive questions.
This patch was applied to netdev/net-next.git (master) by Jakub Kicinski <[email protected]>:
Hello:
This patch was applied to netdev/net-next.git (master) by Jakub Kicinski <[email protected]>:
Quoted 6 lines · On Sat, 13 Aug 2022 23:46:58 +0300 you wrote:
This makes the code look cleaner and easier to read.
Signed-off-by Beniamin Sandu <[email protected]>--- drivers/net/phy/sfp.c | 121 +++++++++++++----------------------------- 1 file changed, 38 insertions(+), 83 deletions(-)
Here is the summary with links:
- net: sfp: use simplified HWMON_CHANNEL_INFO macro
https://git.kernel.org/netdev/net-next/c/815f5f574144
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html