[net-next,v5,02/16] net: phy: Remove the call to phy_mii_ioctl in phy_hwstamp_get/set

Message ID 20231009155138.86458-3-kory.maincent@bootlin.com
State New
Headers
Series net: Make timestamping selectable |

Commit Message

Köry Maincent Oct. 9, 2023, 3:51 p.m. UTC
  From: Kory Maincent <kory.maincent@bootlin.com>

__phy_hwtstamp_set function were calling the phy_mii_ioctl function
which will then use the ifreq pointer to call the hwtstamp callback.
Now that ifreq has been removed from the hwstamp callback parameters
it seems more logical to not go through the phy_mii_ioctl function and pass
directly kernel_hwtstamp_config parameter to the hwtstamp callback.

Lets do the same for __phy_hwtstamp_get function and return directly
EOPNOTSUPP as SIOCGHWTSTAMP is not supported for now for the PHYs.

Signed-off-by: Kory Maincent <kory.maincent@bootlin.com>
---
 drivers/net/phy/phy.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
  

Comments

Florian Fainelli Oct. 9, 2023, 9:04 p.m. UTC | #1
On 10/9/23 08:51, Köry Maincent wrote:
> From: Kory Maincent <kory.maincent@bootlin.com>
> 
> __phy_hwtstamp_set function were calling the phy_mii_ioctl function
> which will then use the ifreq pointer to call the hwtstamp callback.
> Now that ifreq has been removed from the hwstamp callback parameters
> it seems more logical to not go through the phy_mii_ioctl function and pass
> directly kernel_hwtstamp_config parameter to the hwtstamp callback.
> 
> Lets do the same for __phy_hwtstamp_get function and return directly
> EOPNOTSUPP as SIOCGHWTSTAMP is not supported for now for the PHYs.
> 
> Signed-off-by: Kory Maincent <kory.maincent@bootlin.com>

Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com>
  

Patch

diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
index d058316666ba..3376e58e2b88 100644
--- a/drivers/net/phy/phy.c
+++ b/drivers/net/phy/phy.c
@@ -486,7 +486,7 @@  int __phy_hwtstamp_get(struct phy_device *phydev,
 	if (!phydev)
 		return -ENODEV;
 
-	return phy_mii_ioctl(phydev, config->ifr, SIOCGHWTSTAMP);
+	return -EOPNOTSUPP;
 }
 
 /**
@@ -503,7 +503,10 @@  int __phy_hwtstamp_set(struct phy_device *phydev,
 	if (!phydev)
 		return -ENODEV;
 
-	return phy_mii_ioctl(phydev, config->ifr, SIOCSHWTSTAMP);
+	if (phydev->mii_ts && phydev->mii_ts->hwtstamp)
+		return phydev->mii_ts->hwtstamp(phydev->mii_ts, config, extack);
+
+	return -EOPNOTSUPP;
 }
 
 /**