* [PATCH v2 0/5] Use HWMON_CHANNEL_INFO macro to simplify code
@ 2025-02-10 5:47 Huisong Li
2025-02-10 5:47 ` [PATCH v2 1/5] net: aquantia: " Huisong Li
` (5 more replies)
0 siblings, 6 replies; 7+ messages in thread
From: Huisong Li @ 2025-02-10 5:47 UTC (permalink / raw)
To: netdev, linux-kernel, oss-drivers
Cc: irusskikh, andrew+netdev, davem, edumazet, kuba, pabeni,
louis.peens, hkallweit1, linux, kabel, zhanjie9, zhenglifeng1,
liuyonglong, lihuisong
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/20250124022635.16647-3-lihuisong@huawei.com/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(-)
--
2.22.0
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH v2 1/5] net: aquantia: Use HWMON_CHANNEL_INFO macro to simplify code
2025-02-10 5:47 [PATCH v2 0/5] Use HWMON_CHANNEL_INFO macro to simplify code Huisong Li
@ 2025-02-10 5:47 ` Huisong Li
2025-02-10 5:47 ` [PATCH v2 2/5] net: nfp: " Huisong Li
` (4 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: Huisong Li @ 2025-02-10 5:47 UTC (permalink / raw)
To: netdev, linux-kernel, oss-drivers
Cc: irusskikh, andrew+netdev, davem, edumazet, kuba, pabeni,
louis.peens, hkallweit1, linux, kabel, 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] 7+ messages in thread
* [PATCH v2 2/5] net: nfp: Use HWMON_CHANNEL_INFO macro to simplify code
2025-02-10 5:47 [PATCH v2 0/5] Use HWMON_CHANNEL_INFO macro to simplify code Huisong Li
2025-02-10 5:47 ` [PATCH v2 1/5] net: aquantia: " Huisong Li
@ 2025-02-10 5:47 ` Huisong Li
2025-02-10 5:47 ` [PATCH v2 3/5] net: phy: marvell: " Huisong Li
` (3 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: Huisong Li @ 2025-02-10 5:47 UTC (permalink / raw)
To: netdev, linux-kernel, oss-drivers
Cc: irusskikh, andrew+netdev, davem, edumazet, kuba, pabeni,
louis.peens, hkallweit1, linux, kabel, 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] 7+ messages in thread
* [PATCH v2 3/5] net: phy: marvell: Use HWMON_CHANNEL_INFO macro to simplify code
2025-02-10 5:47 [PATCH v2 0/5] Use HWMON_CHANNEL_INFO macro to simplify code Huisong Li
2025-02-10 5:47 ` [PATCH v2 1/5] net: aquantia: " Huisong Li
2025-02-10 5:47 ` [PATCH v2 2/5] net: nfp: " Huisong Li
@ 2025-02-10 5:47 ` Huisong Li
2025-02-10 5:47 ` [PATCH v2 4/5] net: phy: marvell10g: " Huisong Li
` (2 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: Huisong Li @ 2025-02-10 5:47 UTC (permalink / raw)
To: netdev, linux-kernel, oss-drivers
Cc: irusskikh, andrew+netdev, davem, edumazet, kuba, pabeni,
louis.peens, hkallweit1, linux, kabel, 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] 7+ messages in thread
* [PATCH v2 4/5] net: phy: marvell10g: Use HWMON_CHANNEL_INFO macro to simplify code
2025-02-10 5:47 [PATCH v2 0/5] Use HWMON_CHANNEL_INFO macro to simplify code Huisong Li
` (2 preceding siblings ...)
2025-02-10 5:47 ` [PATCH v2 3/5] net: phy: marvell: " Huisong Li
@ 2025-02-10 5:47 ` Huisong Li
2025-02-10 5:47 ` [PATCH v2 5/5] net: phy: aquantia: " Huisong Li
2025-02-12 2:00 ` [PATCH v2 0/5] " patchwork-bot+netdevbpf
5 siblings, 0 replies; 7+ messages in thread
From: Huisong Li @ 2025-02-10 5:47 UTC (permalink / raw)
To: netdev, linux-kernel, oss-drivers
Cc: irusskikh, andrew+netdev, davem, edumazet, kuba, pabeni,
louis.peens, hkallweit1, linux, kabel, 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] 7+ messages in thread
* [PATCH v2 5/5] net: phy: aquantia: Use HWMON_CHANNEL_INFO macro to simplify code
2025-02-10 5:47 [PATCH v2 0/5] Use HWMON_CHANNEL_INFO macro to simplify code Huisong Li
` (3 preceding siblings ...)
2025-02-10 5:47 ` [PATCH v2 4/5] net: phy: marvell10g: " Huisong Li
@ 2025-02-10 5:47 ` Huisong Li
2025-02-12 2:00 ` [PATCH v2 0/5] " patchwork-bot+netdevbpf
5 siblings, 0 replies; 7+ messages in thread
From: Huisong Li @ 2025-02-10 5:47 UTC (permalink / raw)
To: netdev, linux-kernel, oss-drivers
Cc: irusskikh, andrew+netdev, davem, edumazet, kuba, pabeni,
louis.peens, hkallweit1, linux, kabel, 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..1a714b56b765 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] 7+ messages in thread
* Re: [PATCH v2 0/5] Use HWMON_CHANNEL_INFO macro to simplify code
2025-02-10 5:47 [PATCH v2 0/5] Use HWMON_CHANNEL_INFO macro to simplify code Huisong Li
` (4 preceding siblings ...)
2025-02-10 5:47 ` [PATCH v2 5/5] net: phy: aquantia: " Huisong Li
@ 2025-02-12 2:00 ` patchwork-bot+netdevbpf
5 siblings, 0 replies; 7+ messages in thread
From: patchwork-bot+netdevbpf @ 2025-02-12 2:00 UTC (permalink / raw)
To: Huisong Li
Cc: netdev, linux-kernel, oss-drivers, irusskikh, andrew+netdev,
davem, edumazet, kuba, pabeni, louis.peens, hkallweit1, linux,
kabel, zhanjie9, zhenglifeng1, liuyonglong
Hello:
This series was applied to netdev/net-next.git (main)
by Jakub Kicinski <kuba@kernel.org>:
On Mon, 10 Feb 2025 13:47:05 +0800 you wrote:
> 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.
>
> [...]
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!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2025-02-12 2:00 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-02-10 5:47 [PATCH v2 0/5] Use HWMON_CHANNEL_INFO macro to simplify code Huisong Li
2025-02-10 5:47 ` [PATCH v2 1/5] net: aquantia: " Huisong Li
2025-02-10 5:47 ` [PATCH v2 2/5] net: nfp: " Huisong Li
2025-02-10 5:47 ` [PATCH v2 3/5] net: phy: marvell: " Huisong Li
2025-02-10 5:47 ` [PATCH v2 4/5] net: phy: marvell10g: " Huisong Li
2025-02-10 5:47 ` [PATCH v2 5/5] net: phy: aquantia: " Huisong Li
2025-02-12 2:00 ` [PATCH v2 0/5] " patchwork-bot+netdevbpf
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox