History

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.

Heiner Kallweit committed 6 years ago

Commit bbbf8431 parent 3231e5d2 files · +14 −3Browse files

Unified · Split

2 files
  1. drivers/net/phy/phy.c +13 −3
  2. include/linux/phy.h +1 −0
drivers/net/phy/phy.c+13−3
@@ -433,18 +433,28 @@ int phy_mii_ioctl(struct phy_device *phydev, struct ifreq *ifr, int cmd) · 432 unmodified lines
433EXPORT_SYMBOL(phy_mii_ioctl);433EXPORT_SYMBOL(phy_mii_ioctl);
434 434
435/**435/**
436 * phy_do_ioctl_running - generic ndo_do_ioctl implementation436 * phy_do_ioctl - generic ndo_do_ioctl implementation
437 * @dev: the net_device struct437 * @dev: the net_device struct
438 * @ifr: &struct ifreq for socket ioctl's438 * @ifr: &struct ifreq for socket ioctl's
439 * @cmd: ioctl cmd to execute439 * @cmd: ioctl cmd to execute
440 */440 */
441int phy_do_ioctl_running(struct net_device *dev, struct ifreq *ifr, int cmd)441int phy_do_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
442{442{
443 if (!netif_running(dev) || !dev->phydev)443 if (!dev->phydev)
444 return -ENODEV;444 return -ENODEV;
445 445
446 return phy_mii_ioctl(dev->phydev, ifr, cmd);446 return phy_mii_ioctl(dev->phydev, ifr, cmd);
447}447}
448EXPORT_SYMBOL(phy_do_ioctl);
449
450/* same as phy_do_ioctl, but ensures that net_device is running */
451int phy_do_ioctl_running(struct net_device *dev, struct ifreq *ifr, int cmd)
452{
453 if (!netif_running(dev))
454 return -ENODEV;
455
456 return phy_do_ioctl(dev, ifr, cmd);
457}
448EXPORT_SYMBOL(phy_do_ioctl_running);458EXPORT_SYMBOL(phy_do_ioctl_running);
449 459
450void phy_queue_state_machine(struct phy_device *phydev, unsigned long jiffies)460void phy_queue_state_machine(struct phy_device *phydev, unsigned long jiffies)
include/linux/phy.h+1−0
@@ -1242,6 +1242,7 @@ void phy_ethtool_ksettings_get(struct phy_device *phydev, · 1241 unmodified lines
1242int phy_ethtool_ksettings_set(struct phy_device *phydev,1242int phy_ethtool_ksettings_set(struct phy_device *phydev,
1243 const struct ethtool_link_ksettings *cmd);1243 const struct ethtool_link_ksettings *cmd);
1244int phy_mii_ioctl(struct phy_device *phydev, struct ifreq *ifr, int cmd);1244int phy_mii_ioctl(struct phy_device *phydev, struct ifreq *ifr, int cmd);
1245int phy_do_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd);
1245int phy_do_ioctl_running(struct net_device *dev, struct ifreq *ifr, int cmd);1246int phy_do_ioctl_running(struct net_device *dev, struct ifreq *ifr, int cmd);
1246void phy_request_interrupt(struct phy_device *phydev);1247void phy_request_interrupt(struct phy_device *phydev);
1247void phy_free_interrupt(struct phy_device *phydev);1248void phy_free_interrupt(struct phy_device *phydev);