Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f9a8f83b authored by Florian Fainelli's avatar Florian Fainelli Committed by David S. Miller
Browse files

net: phy: remove flags argument from phy_{attach, connect, connect_direct}



The flags argument of the phy_{attach,connect,connect_direct} functions
is then used to assign a struct phy_device dev_flags with its value.
All callers but the tg3 driver pass the flag 0, which results in the
underlying PHY drivers in drivers/net/phy/ not being able to actually
use any of the flags they would set in dev_flags. This patch gets rid of
the flags argument, and passes phydev->dev_flags to the internal PHY
library call phy_attach_direct() such that drivers which actually modify
a phy device dev_flags get the value preserved for use by the underlying
phy driver.

Acked-by: default avatarKosta Zertsekel <konszert@marvell.com>
Signed-off-by: default avatarFlorian Fainelli <florian@openwrt.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent c1b52739
Loading
Loading
Loading
Loading
+6 −5
Original line number Diff line number Diff line
@@ -103,7 +103,7 @@ Letting the PHY Abstraction Layer do Everything
 
 Now, to connect, just call this function:
 
   phydev = phy_connect(dev, phy_name, &adjust_link, flags, interface);
   phydev = phy_connect(dev, phy_name, &adjust_link, interface);

 phydev is a pointer to the phy_device structure which represents the PHY.  If
 phy_connect is successful, it will return the pointer.  dev, here, is the
@@ -113,7 +113,9 @@ Letting the PHY Abstraction Layer do Everything
 current state, though the PHY will not yet be truly operational at this
 point.

 flags is a u32 which can optionally contain phy-specific flags.
 PHY-specific flags should be set in phydev->dev_flags prior to the call
 to phy_connect() such that the underlying PHY driver can check for flags
 and perform specific operations based on them.
 This is useful if the system has put hardware restrictions on
 the PHY/controller, of which the PHY needs to be aware.

@@ -185,11 +187,10 @@ Doing it all yourself
   start, or disables then frees them for stop.

 struct phy_device * phy_attach(struct net_device *dev, const char *phy_id,
		 u32 flags, phy_interface_t interface);
		 phy_interface_t interface);

   Attaches a network device to a particular PHY, binding the PHY to a generic
   driver if none was found during bus initialization.  Passes in
   any phy-specific flags as needed.
   driver if none was found during bus initialization.

 int phy_start_aneg(struct phy_device *phydev);
   
+1 −1
Original line number Diff line number Diff line
@@ -358,7 +358,7 @@ static int ax_mii_probe(struct net_device *dev)
		return -ENODEV;
	}

	ret = phy_connect_direct(dev, phy_dev, ax_handle_link_change, 0,
	ret = phy_connect_direct(dev, phy_dev, ax_handle_link_change,
				 PHY_INTERFACE_MODE_MII);
	if (ret) {
		netdev_err(dev, "Could not attach to PHY\n");
+2 −2
Original line number Diff line number Diff line
@@ -425,8 +425,8 @@ static int mii_probe(struct net_device *dev, int phy_mode)
		return -EINVAL;
	}

	phydev = phy_connect(dev, dev_name(&phydev->dev), &bfin_mac_adjust_link,
			0, phy_mode);
	phydev = phy_connect(dev, dev_name(&phydev->dev),
			     &bfin_mac_adjust_link, phy_mode);

	if (IS_ERR(phydev)) {
		netdev_err(dev, "could not attach PHY\n");
+1 −3
Original line number Diff line number Diff line
@@ -1288,9 +1288,7 @@ static int greth_mdio_probe(struct net_device *dev)
	}

	ret = phy_connect_direct(dev, phy, &greth_link_change,
			0, greth->gbit_mac ?
			PHY_INTERFACE_MODE_GMII :
			PHY_INTERFACE_MODE_MII);
				 greth->gbit_mac ? PHY_INTERFACE_MODE_GMII : PHY_INTERFACE_MODE_MII);
	if (ret) {
		if (netif_msg_ifup(greth))
			dev_err(&dev->dev, "could not attach to PHY\n");
+2 −2
Original line number Diff line number Diff line
@@ -437,8 +437,8 @@ static int au1000_mii_probe(struct net_device *dev)
	/* now we are supposed to have a proper phydev, to attach to... */
	BUG_ON(phydev->attached_dev);

	phydev = phy_connect(dev, dev_name(&phydev->dev), &au1000_adjust_link,
			0, PHY_INTERFACE_MODE_MII);
	phydev = phy_connect(dev, dev_name(&phydev->dev),
			     &au1000_adjust_link, PHY_INTERFACE_MODE_MII);

	if (IS_ERR(phydev)) {
		netdev_err(dev, "Could not attach to PHY\n");
Loading