r8169: remove redundant hwmon support
Subsystems (4)
Heiner Kallweit
maintainerPATCH 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.
--- drivers/net/ethernet/realtek/r8169_main.c | 37 ----------------------- 1 file changed, 37 deletions(-)
drivers/net/ethernet/realtek/r8169_main.c +0 -37
@@ -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>
@@ -5338,36 +5337,6 @@ static bool rtl_aspm_is_safe(struct rtl8169_private *tp)return false; } -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 = { - .visible =0444 , - .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;
@@ -5547,12 +5516,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
+ Jean Delvare, linux-hwmon, [email protected]
Quoted 6 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")Signed-off-by Heiner Kallweit <[email protected]>
Quoted 69 lines
--- drivers/net/ethernet/realtek/r8169_main.c | 37 ----------------------- 1 file changed, 37 deletions(-)drivers/net/ethernet/realtek/r8169_main.c +0
-37@@ -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> @@ -5338,36 +5337,6 @@ static bool rtl_aspm_is_safe(struct rtl8169_private *tp)return false; } -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 = { - .visible =0444 , - .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;@@ -5547,12 +5516,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
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.
Fixes 1ffcc8d41306 ("r8169: add support for the temperature sensor being available from RTL8125B")
So this patch is for net, because 1ffcc8d41306 is in
v6.13-rc1
v6.13-rc2
v6.13-rc3
v6.13-rc4
v6.13-rc5
but not a released kernel. So there are no ABI issues with removing it from the MAC driver and putting it in the PHY driver where it belongs.
Andrew