All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] net: sfp: use simplified HWMON_CHANNEL_INFO macro
@ 2022-08-13 20:46 Beniamin Sandu
  2022-08-17 15:54 ` Jakub Kicinski
  2022-08-17 17:30 ` patchwork-bot+netdevbpf
  0 siblings, 2 replies; 9+ messages in thread
From: Beniamin Sandu @ 2022-08-13 20:46 UTC (permalink / raw)
  To: linux, andrew, hkallweit1, davem, edumazet, kuba, pabeni
  Cc: netdev, linux-kernel, Beniamin Sandu

This makes the code look cleaner and easier to read.

Signed-off-by: Beniamin Sandu <beniaminsandu@gmail.com>
---
 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


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH] net: sfp: use simplified HWMON_CHANNEL_INFO macro
  2022-08-13 20:46 [PATCH] net: sfp: use simplified HWMON_CHANNEL_INFO macro Beniamin Sandu
@ 2022-08-17 15:54 ` Jakub Kicinski
  2022-08-17 16:12   ` Russell King (Oracle)
  2022-08-17 17:30 ` patchwork-bot+netdevbpf
  1 sibling, 1 reply; 9+ messages in thread
From: Jakub Kicinski @ 2022-08-17 15:54 UTC (permalink / raw)
  To: linux
  Cc: Beniamin Sandu, andrew, hkallweit1, davem, edumazet, pabeni,
	netdev, linux-kernel

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..

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] net: sfp: use simplified HWMON_CHANNEL_INFO macro
  2022-08-17 15:54 ` Jakub Kicinski
@ 2022-08-17 16:12   ` Russell King (Oracle)
  2022-08-17 17:19     ` Jakub Kicinski
  0 siblings, 1 reply; 9+ messages in thread
From: Russell King (Oracle) @ 2022-08-17 16:12 UTC (permalink / raw)
  To: Jakub Kicinski
  Cc: Beniamin Sandu, andrew, hkallweit1, davem, edumazet, pabeni,
	netdev, linux-kernel

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!

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] net: sfp: use simplified HWMON_CHANNEL_INFO macro
  2022-08-17 16:12   ` Russell King (Oracle)
@ 2022-08-17 17:19     ` Jakub Kicinski
  2022-08-18  1:21       ` Andrew Lunn
  0 siblings, 1 reply; 9+ messages in thread
From: Jakub Kicinski @ 2022-08-17 17:19 UTC (permalink / raw)
  To: Russell King (Oracle)
  Cc: Beniamin Sandu, andrew, hkallweit1, davem, edumazet, pabeni,
	netdev, linux-kernel

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.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] net: sfp: use simplified HWMON_CHANNEL_INFO macro
  2022-08-13 20:46 [PATCH] net: sfp: use simplified HWMON_CHANNEL_INFO macro Beniamin Sandu
  2022-08-17 15:54 ` Jakub Kicinski
@ 2022-08-17 17:30 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 9+ messages in thread
From: patchwork-bot+netdevbpf @ 2022-08-17 17:30 UTC (permalink / raw)
  To: Beniamin Sandu
  Cc: linux, andrew, hkallweit1, davem, edumazet, kuba, pabeni, netdev,
	linux-kernel

Hello:

This patch was applied to netdev/net-next.git (master)
by Jakub Kicinski <kuba@kernel.org>:

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 <beniaminsandu@gmail.com>
> ---
>  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



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] net: sfp: use simplified HWMON_CHANNEL_INFO macro
  2022-08-17 17:19     ` Jakub Kicinski
@ 2022-08-18  1:21       ` Andrew Lunn
  2022-08-18  2:19         ` Jakub Kicinski
  0 siblings, 1 reply; 9+ messages in thread
From: Andrew Lunn @ 2022-08-18  1:21 UTC (permalink / raw)
  To: Jakub Kicinski
  Cc: Russell King (Oracle),
	Beniamin Sandu, hkallweit1, davem, edumazet, pabeni, netdev,
	linux-kernel

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

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] net: sfp: use simplified HWMON_CHANNEL_INFO macro
  2022-08-18  1:21       ` Andrew Lunn
@ 2022-08-18  2:19         ` Jakub Kicinski
  2022-08-18 16:58           ` Guenter Roeck
  0 siblings, 1 reply; 9+ messages in thread
From: Jakub Kicinski @ 2022-08-18  2:19 UTC (permalink / raw)
  To: Andrew Lunn
  Cc: Russell King (Oracle),
	Beniamin Sandu, hkallweit1, davem, edumazet, pabeni, netdev,
	linux-kernel, linux-hwmon

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.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] net: sfp: use simplified HWMON_CHANNEL_INFO macro
  2022-08-18  2:19         ` Jakub Kicinski
@ 2022-08-18 16:58           ` Guenter Roeck
  2022-08-18 17:14             ` Jakub Kicinski
  0 siblings, 1 reply; 9+ messages in thread
From: Guenter Roeck @ 2022-08-18 16:58 UTC (permalink / raw)
  To: Jakub Kicinski
  Cc: Andrew Lunn, Russell King (Oracle),
	Beniamin Sandu, hkallweit1, davem, edumazet, pabeni, netdev,
	linux-kernel, linux-hwmon

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

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] net: sfp: use simplified HWMON_CHANNEL_INFO macro
  2022-08-18 16:58           ` Guenter Roeck
@ 2022-08-18 17:14             ` Jakub Kicinski
  0 siblings, 0 replies; 9+ messages in thread
From: Jakub Kicinski @ 2022-08-18 17:14 UTC (permalink / raw)
  To: Guenter Roeck
  Cc: Andrew Lunn, Russell King (Oracle),
	Beniamin Sandu, hkallweit1, davem, edumazet, pabeni, netdev,
	linux-kernel, linux-hwmon

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/20220818165856.GC923105@roeck-us.net/

Speaking of expectations tho, I would expect you to not ask me
rhetorical passive aggressive questions.

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2022-08-18 17:18 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-13 20:46 [PATCH] net: sfp: use simplified HWMON_CHANNEL_INFO macro Beniamin Sandu
2022-08-17 15:54 ` Jakub Kicinski
2022-08-17 16:12   ` Russell King (Oracle)
2022-08-17 17:19     ` Jakub Kicinski
2022-08-18  1:21       ` Andrew Lunn
2022-08-18  2:19         ` Jakub Kicinski
2022-08-18 16:58           ` Guenter Roeck
2022-08-18 17:14             ` Jakub Kicinski
2022-08-17 17:30 ` patchwork-bot+netdevbpf

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.