From bbbf8430afe6906abbf879352fe10d24d380e588 Mon Sep 17 00:00:00 2001 From: Heiner Kallweit Date: Mon, 20 Jan 2020 22:17:11 +0100 Subject: net: phy: add new version of phy_do_ioctl Add a new version of phy_do_ioctl that doesn't check whether net_device is running. It will typically be used if suitable drivers attach the PHY in probe already. Signed-off-by: Heiner Kallweit Reviewed-by: Florian Fainelli Reviewed-by: Andrew Lunn Signed-off-by: David S. Miller --- drivers/net/phy/phy.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'drivers/net/phy') diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c index cf25fa3be123..d76e038cf2cb 100644 --- a/drivers/net/phy/phy.c +++ b/drivers/net/phy/phy.c @@ -433,18 +433,28 @@ int phy_mii_ioctl(struct phy_device *phydev, struct ifreq *ifr, int cmd) EXPORT_SYMBOL(phy_mii_ioctl); /** - * phy_do_ioctl_running - generic ndo_do_ioctl implementation + * phy_do_ioctl - generic ndo_do_ioctl implementation * @dev: the net_device struct * @ifr: &struct ifreq for socket ioctl's * @cmd: ioctl cmd to execute */ -int phy_do_ioctl_running(struct net_device *dev, struct ifreq *ifr, int cmd) +int phy_do_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) { - if (!netif_running(dev) || !dev->phydev) + if (!dev->phydev) return -ENODEV; return phy_mii_ioctl(dev->phydev, ifr, cmd); } +EXPORT_SYMBOL(phy_do_ioctl); + +/* same as phy_do_ioctl, but ensures that net_device is running */ +int phy_do_ioctl_running(struct net_device *dev, struct ifreq *ifr, int cmd) +{ + if (!netif_running(dev)) + return -ENODEV; + + return phy_do_ioctl(dev, ifr, cmd); +} EXPORT_SYMBOL(phy_do_ioctl_running); void phy_queue_state_machine(struct phy_device *phydev, unsigned long jiffies) -- cgit v1.2.3-59-g8ed1b