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(-)
diff --git a/drivers/net/phy/sfp.c b/drivers/net/phy/sfp.c
index 63f90fe9a4d2..a12f7b599da2 100644
--- a/drivers/net/phy/sfp.c
+++ b/drivers/net/phy/sfp.c
@@ -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,
};
--
2.25.1
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..
On Wed, Aug 17, 2022 at 08:54:29AM -0700, Jakub Kicinski wrote:
> 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.
--
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!
On Wed, 17 Aug 2022 17:12:24 +0100 Russell King (Oracle) wrote:
> On Wed, Aug 17, 2022 at 08:54:29AM -0700, Jakub Kicinski wrote:
> > 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.
> I build-tested it, and I'm not likely to any time soon. I think
> Andrew added the hwmon code for this PHY originally.
Hello:
This patch was applied to netdev/net-next.git (master)
by Jakub Kicinski <[email protected]>:
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!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
On Wed, Aug 17, 2022 at 10:19:16AM -0700, Jakub Kicinski wrote:
> On Wed, 17 Aug 2022 17:12:24 +0100 Russell King (Oracle) wrote:
> > On Wed, Aug 17, 2022 at 08:54:29AM -0700, Jakub Kicinski wrote:
> > > 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
On Thu, 18 Aug 2022 03:21:53 +0200 Andrew Lunn wrote:
> > > 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.
On Wed, Aug 17, 2022 at 07:19:16PM -0700, Jakub Kicinski wrote:
> On Thu, 18 Aug 2022 03:21:53 +0200 Andrew Lunn wrote:
> > > > 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.
And you expect me to dig up the actual patch ?
Guenter
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.