Skip to contentSkip to conversation

r8169: remove redundant hwmon support

PATCH Applied Heiner Kallweit 3 participants 6 messages Jan 9, 2025 – Jan 14, 2025

Subsystems (3)
lore
Share & tools
lore

Heiner Kallweit

author maintainer
#0 lore raw

PATCH v2 1/1 r8169: remove redundant hwmon support

The temperature sensor is actually part of the integrated PHY and available also on the standalone versions of the PHY. Therefore hwmon support will be added to the Realtek PHY driver and can be removed here.

Fixes 1ffcc8d41306 ("r8169: add support for the temperature sensor being available from RTL8125B")

---
v2:
- rebase patch on net

---
 drivers/net/ethernet/realtek/r8169_main.c | 44 -----------------------
 1 file changed, 44 deletions(-)
drivers/net/ethernet/realtek/r8169_main.c +0 -44
index 739707a7b..8a3959bb2 100644
@@ -16,7 +16,6 @@
 #include <linux/clk.h>
 #include <linux/delay.h>
 #include <linux/ethtool.h>
-#include <linux/hwmon.h>
 #include <linux/phy.h>
 #include <linux/if_vlan.h>
 #include <linux/in.h>
@@ -5347,43 +5346,6 @@ static bool rtl_aspm_is_safe(struct rtl8169_private *tp)
 	return false;
 }
 
-static umode_t r8169_hwmon_is_visible(const void *drvdata,
-				      enum hwmon_sensor_types type,
-				      u32 attr, int channel)
-{
-	return 0444;
-}
-
-static int r8169_hwmon_read(struct device *dev, enum hwmon_sensor_types type,
-			    u32 attr, int channel, long *val)
-{
-	struct rtl8169_private *tp = dev_get_drvdata(dev);
-	int val_raw;
-
-	val_raw = phy_read_paged(tp->phydev, 0xbd8, 0x12) & 0x3ff;
-	if (val_raw >= 512)
-		val_raw -= 1024;
-
-	*val = 1000 * val_raw / 2;
-
-	return 0;
-}
-
-static const struct hwmon_ops r8169_hwmon_ops = {
-	.is_visible =  r8169_hwmon_is_visible,
-	.read = r8169_hwmon_read,
-};
-
-static const struct hwmon_channel_info * const r8169_hwmon_info[] = {
-	HWMON_CHANNEL_INFO(temp, HWMON_T_INPUT),
-	NULL
-};
-
-static const struct hwmon_chip_info r8169_hwmon_chip_info = {
-	.ops = &r8169_hwmon_ops,
-	.info = r8169_hwmon_info,
-};
-
 static int rtl_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
 {
 	struct rtl8169_private *tp;
@@ -5563,12 +5525,6 @@ static int rtl_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
 	if (rc)
 		return rc;
 
-	/* The temperature sensor is available from RTl8125B */
-	if (IS_REACHABLE(CONFIG_HWMON) && tp->mac_version >= RTL_GIGA_MAC_VER_63)
-		/* ignore errors */
-		devm_hwmon_device_register_with_info(&pdev->dev, "nic_temp", tp,
-						     &r8169_hwmon_chip_info,
-						     NULL);
 	rc = register_netdev(dev);
 	if (rc)
 		return rc;
Signature · 1 line
2.47.1
#1 lore raw
Quoted 9 lines · Heiner Kallweit

The temperature sensor is actually part of the integrated PHY and available also on the standalone versions of the PHY. Therefore hwmon support will be added to the Realtek PHY driver and can be removed here.

Fixes 1ffcc8d41306 ("r8169: add support for the temperature sensor being available from RTL8125B")

---
v2:
- rebase patch on net

In the future, please avoid re-sending within 24 hours:

https://docs.kernel.org/process/maintainer-netdev.html#resending-after-review

Thanks,
Jake

#2 lore raw
In reply to Heiner Kallweit
Quoted 7 lines · Heiner Kallweit

The temperature sensor is actually part of the integrated PHY and available also on the standalone versions of the PHY. Therefore hwmon support will be added to the Realtek PHY driver and can be removed here.

Fixes 1ffcc8d41306 ("r8169: add support for the temperature sensor being available from RTL8125B")

---

Can you explain what user-facing issues this fixes? Do we get conflicts when multiple hwmon sensors are registered? I'm not sure this counts as a 'net' fix, unless we can identify the user-facing behavior that is problematic?

author maintainer
#3 lore raw
Quoted 7 lines · Jacob Keller
Quoted 4 lines · Heiner Kallweit

The temperature sensor is actually part of the integrated PHY and available also on the standalone versions of the PHY. Therefore hwmon support will be added to the Realtek PHY driver and can be removed here.

Quoted 8 lines
Quoted 3 lines
Fixes 1ffcc8d41306 ("r8169: add support for the temperature sensor being available from RTL8125B")

---

Can you explain what user-facing issues this fixes? Do we get conflicts when multiple hwmon sensors are registered? I'm not sure this counts as a 'net' fix, unless we can identify the user-facing behavior that is problematic?

The same sensor would be exposed twice, by the MAC and the PHY driver. Support in the MAC driver was added for 6.13, so it's still in the rc version only and not yet part of a released kernel version.

Reviewed-by
#4 lore raw
Quoted 12 lines · Heiner Kallweit
Quoted 11 lines · Jacob Keller
Quoted 7 lines · Heiner Kallweit

The temperature sensor is actually part of the integrated PHY and available also on the standalone versions of the PHY. Therefore hwmon support will be added to the Realtek PHY driver and can be removed here.

Fixes 1ffcc8d41306 ("r8169: add support for the temperature sensor being available from RTL8125B")

---

Quoted 9 lines
Quoted 4 lines

Can you explain what user-facing issues this fixes? Do we get conflicts when multiple hwmon sensors are registered? I'm not sure this counts as a 'net' fix, unless we can identify the user-facing behavior that is problematic?

The same sensor would be exposed twice, by the MAC and the PHY driver. Support in the MAC driver was added for 6.13, so it's still in the rc version only and not yet part of a released kernel version.

I guess I'm failing to understand what the user repercussions of having multiple sensors would be?

I suppose that it is confusing and could lead to issues when userspace is checking or controlling the sensor, and fixing this via net before it makes it into a full release is good.

#5 lore raw
In reply to Heiner Kallweit
This patch was applied to netdev/net.git (main) by Jakub Kicinski <[email protected]>:

Hello:

This patch was applied to netdev/net.git (main)
by Jakub Kicinski <[email protected]>:

Quoted 8 lines · On Thu, 9 Jan 2025 23:43:12 +0100 you wrote:

The temperature sensor is actually part of the integrated PHY and available also on the standalone versions of the PHY. Therefore hwmon support will be added to the Realtek PHY driver and can be removed here.

Fixes 1ffcc8d41306 ("r8169: add support for the temperature sensor being available from RTL8125B")

[...]

Here is the summary with links:
- [v2,net] r8169: remove redundant hwmon support

    https://git.kernel.org/netdev/net/c/1f691a1fc4be

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html