phy: add phydev_name() wrapper
authorAndrew Lunn <andrew@lunn.ch>
Wed, 6 Jan 2016 19:11:10 +0000 (20:11 +0100)
committerDavid S. Miller <davem@davemloft.net>
Thu, 7 Jan 2016 19:31:25 +0000 (14:31 -0500)
Add a phydev_name() function, to help with moving some structure members
from phy_device.

Signed-off-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
26 files changed:
drivers/net/ethernet/8390/ax88796.c
drivers/net/ethernet/adi/bfin_mac.c
drivers/net/ethernet/agere/et131x.c
drivers/net/ethernet/amd/au1000_eth.c
drivers/net/ethernet/broadcom/b44.c
drivers/net/ethernet/broadcom/tg3.c
drivers/net/ethernet/cadence/macb.c
drivers/net/ethernet/dnet.c
drivers/net/ethernet/faraday/ftgmac100.c
drivers/net/ethernet/lantiq_etop.c
drivers/net/ethernet/nxp/lpc_eth.c
drivers/net/ethernet/rdc/r6040.c
drivers/net/ethernet/renesas/ravb_main.c
drivers/net/ethernet/renesas/sh_eth.c
drivers/net/ethernet/samsung/sxgbe/sxgbe_mdio.c
drivers/net/ethernet/smsc/smsc911x.c
drivers/net/ethernet/smsc/smsc9420.c
drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c
drivers/net/ethernet/ti/davinci_emac.c
drivers/net/ethernet/ti/davinci_mdio.c
drivers/net/ethernet/ti/netcp_ethss.c
drivers/net/ethernet/toshiba/tc35815.c
drivers/net/phy/bcm7xxx.c
drivers/net/phy/phy_device.c
drivers/staging/netlogic/xlr_net.c
include/linux/phy.h

index 0443654f03398d1f50fb45e2f0e5524fd7be1330..90b540a4a5615b0fa813aed7f5cb06b52bacb4e7 100644 (file)
@@ -372,7 +372,7 @@ static int ax_mii_probe(struct net_device *dev)
        ax->phy_dev = phy_dev;
 
        netdev_info(dev, "PHY driver [%s] (mii_bus:phy_addr=%s, irq=%d)\n",
-                   phy_dev->drv->name, dev_name(&phy_dev->dev), phy_dev->irq);
+                   phy_dev->drv->name, phydev_name(phy_dev), phy_dev->irq);
 
        return 0;
 }
index e0e95a15cab08bd973bddb7e1d6134ccf9163372..5f8a5182b8dc6ca12da50d6e03a464631d459282 100644 (file)
@@ -419,7 +419,7 @@ static int mii_probe(struct net_device *dev, int phy_mode)
                return -EINVAL;
        }
 
-       phydev = phy_connect(dev, dev_name(&phydev->dev),
+       phydev = phy_connect(dev, phydev_name(phydev),
                             &bfin_mac_adjust_link, phy_mode);
 
        if (IS_ERR(phydev)) {
@@ -446,7 +446,7 @@ static int mii_probe(struct net_device *dev, int phy_mode)
 
        pr_info("attached PHY driver [%s] "
                "(mii_bus:phy_addr=%s, irq=%d, mdc_clk=%dHz(mdc_div=%d)@sclk=%dMHz)\n",
-               phydev->drv->name, dev_name(&phydev->dev), phydev->irq,
+               phydev->drv->name, phydev_name(phydev), phydev->irq,
                MDC_CLK, mdc_div, sclk/1000000);
 
        return 0;
index e0f3d197e7f226ba693eb641ead31b948376fae8..80b706f0fc9755e6c1e53c4d591640cda5855089 100644 (file)
@@ -3265,7 +3265,7 @@ static int et131x_mii_probe(struct net_device *netdev)
                return -ENODEV;
        }
 
-       phydev = phy_connect(netdev, dev_name(&phydev->dev),
+       phydev = phy_connect(netdev, phydev_name(phydev),
                             &et131x_adjust_link, PHY_INTERFACE_MODE_MII);
 
        if (IS_ERR(phydev)) {
@@ -3291,7 +3291,7 @@ static int et131x_mii_probe(struct net_device *netdev)
 
        dev_info(&adapter->pdev->dev,
                 "attached PHY driver [%s] (mii_bus:phy_addr=%s)\n",
-                phydev->drv->name, dev_name(&phydev->dev));
+                phydev->drv->name, phydev_name(phydev));
 
        return 0;
 }
index 5330bcb8a9448a39c35331d38d4d23dbd3581543..8a8d6f2a0f6feb88bf3cfe2c45727de7011e18b9 100644 (file)
@@ -558,7 +558,7 @@ 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),
+       phydev = phy_connect(dev, phydev_name(phydev),
                             &au1000_adjust_link, PHY_INTERFACE_MODE_MII);
 
        if (IS_ERR(phydev)) {
@@ -585,7 +585,7 @@ static int au1000_mii_probe(struct net_device *dev)
 
        netdev_info(dev, "attached PHY driver [%s] "
               "(mii_bus:phy_addr=%s, irq=%d)\n",
-              phydev->drv->name, dev_name(&phydev->dev), phydev->irq);
+              phydev->drv->name, phydev_name(phydev), phydev->irq);
 
        return 0;
 }
index a3b1c07ae0af0935f3026ba8a56e21512e238e36..928a2210e78880ee36a6332953a464ccb0e135c8 100644 (file)
@@ -2316,7 +2316,7 @@ static int b44_register_phy_one(struct b44 *bp)
        bp->phy_addr = phydev->addr;
 
        dev_info(sdev->dev, "attached PHY driver [%s] (mii_bus:phy_addr=%s)\n",
-                phydev->drv->name, dev_name(&phydev->dev));
+                phydev->drv->name, phydev_name(phydev));
 
        return 0;
 
index 79789d8e52da3e7aba39acdb4be1ddcae1baaa9e..69d84d67f09abe2f2874e78dd38c0e3be0c12dbb 100644 (file)
@@ -2096,7 +2096,7 @@ static int tg3_phy_init(struct tg3 *tp)
        phydev = tp->mdio_bus->phy_map[tp->phy_addr];
 
        /* Attach the MAC to the PHY. */
-       phydev = phy_connect(tp->dev, dev_name(&phydev->dev),
+       phydev = phy_connect(tp->dev, phydev_name(phydev),
                             tg3_adjust_link, phydev->interface);
        if (IS_ERR(phydev)) {
                dev_err(&tp->pdev->dev, "Could not attach to PHY\n");
@@ -17903,7 +17903,7 @@ static int tg3_init_one(struct pci_dev *pdev,
                phydev = tp->mdio_bus->phy_map[tp->phy_addr];
                netdev_info(dev,
                            "attached PHY driver [%s] (mii_bus:phy_addr=%s)\n",
-                           phydev->drv->name, dev_name(&phydev->dev));
+                           phydev->drv->name, phydev_name(phydev));
        } else {
                char *ethtype;
 
index 8b45bc9ac29e848f392ff343f793c6200e4547b9..001d60c5521c8f694c7640285abc88c90d27b214 100644 (file)
@@ -2951,7 +2951,7 @@ static int macb_probe(struct platform_device *pdev)
 
        phydev = bp->phy_dev;
        netdev_info(dev, "attached PHY driver [%s] (mii_bus:phy_addr=%s, irq=%d)\n",
-                   phydev->drv->name, dev_name(&phydev->dev), phydev->irq);
+                   phydev->drv->name, phydev_name(phydev), phydev->irq);
 
        return 0;
 
index 13d00a38a5bd60ed1e7af054f3a22b617e64317d..136b6010f704b80157d9dfa3af7ee86699423102 100644 (file)
@@ -274,11 +274,11 @@ static int dnet_mii_probe(struct net_device *dev)
 
        /* attach the mac to the phy */
        if (bp->capabilities & DNET_HAS_RMII) {
-               phydev = phy_connect(dev, dev_name(&phydev->dev),
+               phydev = phy_connect(dev, phydev_name(phydev),
                                     &dnet_handle_link_change,
                                     PHY_INTERFACE_MODE_RMII);
        } else {
-               phydev = phy_connect(dev, dev_name(&phydev->dev),
+               phydev = phy_connect(dev, phydev_name(phydev),
                                     &dnet_handle_link_change,
                                     PHY_INTERFACE_MODE_MII);
        }
@@ -894,7 +894,7 @@ static int dnet_probe(struct platform_device *pdev)
        phydev = bp->phy_dev;
        dev_info(&pdev->dev, "attached PHY driver [%s] "
               "(mii_bus:phy_addr=%s, irq=%d)\n",
-              phydev->drv->name, dev_name(&phydev->dev), phydev->irq);
+              phydev->drv->name, phydev_name(phydev), phydev->irq);
 
        return 0;
 
index 6d0c5d5eea6dd21dccd26445ee87addbfb606aa1..c2e2ac6a03131e779bbd8c6fdfa40ef49584458a 100644 (file)
@@ -854,7 +854,7 @@ static int ftgmac100_mii_probe(struct ftgmac100 *priv)
                return -ENODEV;
        }
 
-       phydev = phy_connect(netdev, dev_name(&phydev->dev),
+       phydev = phy_connect(netdev, phydev_name(phydev),
                             &ftgmac100_adjust_link, PHY_INTERFACE_MODE_GMII);
 
        if (IS_ERR(phydev)) {
index 581928c068f2796732f297ab7ef36910ef7c4e5d..274a3cec84c256ebcdaa424d2bfc34ac71e9a94d 100644 (file)
@@ -390,7 +390,7 @@ ltq_etop_mdio_probe(struct net_device *dev)
                return -ENODEV;
        }
 
-       phydev = phy_connect(dev, dev_name(&phydev->dev),
+       phydev = phy_connect(dev, phydev_name(phydev),
                             &ltq_etop_mdio_link, priv->pldata->mii_mode);
 
        if (IS_ERR(phydev)) {
@@ -410,7 +410,7 @@ ltq_etop_mdio_probe(struct net_device *dev)
        priv->phydev = phydev;
        pr_info("%s: attached PHY [%s] (phy_addr=%s, irq=%d)\n",
               dev->name, phydev->drv->name,
-              dev_name(&phydev->dev), phydev->irq);
+              phydev_name(phydev), phydev->irq);
 
        return 0;
 }
index 057665180f13f3d9980eac2b807793675df16021..5801aa197697ea9b98a29bbbfb81ada28ae21e77 100644 (file)
@@ -797,7 +797,7 @@ static int lpc_mii_probe(struct net_device *ndev)
                netdev_info(ndev, "using MII interface\n");
        else
                netdev_info(ndev, "using RMII interface\n");
-       phydev = phy_connect(ndev, dev_name(&phydev->dev),
+       phydev = phy_connect(ndev, phydev_name(phydev),
                             &lpc_handle_link_change,
                             lpc_phy_interface_mode(&pldat->pdev->dev));
 
@@ -818,7 +818,7 @@ static int lpc_mii_probe(struct net_device *ndev)
 
        netdev_info(ndev,
                "attached PHY driver [%s] (mii_bus:phy_addr=%s, irq=%d)\n",
-               phydev->drv->name, dev_name(&phydev->dev), phydev->irq);
+               phydev->drv->name, phydev_name(phydev), phydev->irq);
        return 0;
 }
 
index 9a37247cf4b8c00598f99cfe4b38441a9cab7c57..86a0887811c7ae292d0fc8c2143b37627924ac68 100644 (file)
@@ -1039,7 +1039,7 @@ static int r6040_mii_probe(struct net_device *dev)
                return -ENODEV;
        }
 
-       phydev = phy_connect(dev, dev_name(&phydev->dev), &r6040_adjust_link,
+       phydev = phy_connect(dev, phydev_name(phydev), &r6040_adjust_link,
                             PHY_INTERFACE_MODE_MII);
 
        if (IS_ERR(phydev)) {
@@ -1063,7 +1063,7 @@ static int r6040_mii_probe(struct net_device *dev)
 
        dev_info(&lp->pdev->dev, "attached PHY driver [%s] "
                "(mii_bus:phy_addr=%s)\n",
-               phydev->drv->name, dev_name(&phydev->dev));
+               phydev->drv->name, phydev_name(phydev));
 
        return 0;
 }
index 0e1ebb39ab46291d7ce3a8dde68c38f7fc71d1bb..2f6c974e4a6d6de16fcd914856c265923ded722c 100644 (file)
@@ -928,7 +928,7 @@ static int ravb_phy_init(struct net_device *ndev)
        phydev->supported &= ~PHY_10BT_FEATURES;
 
        netdev_info(ndev, "attached PHY %d (IRQ %d) to driver %s\n",
-                   phydev->addr, phydev->irq, phydev->drv->name);
+                   phydev->addr, phydev->irq, phydev_name(phydev));
 
        priv->phydev = phydev;
 
index baa81535a8fc1b497f38a38d1d4cc99569e81fd6..e14d28474b709836096e5054f22fb7abd5840518 100644 (file)
@@ -1827,7 +1827,7 @@ static int sh_eth_phy_init(struct net_device *ndev)
        }
 
        netdev_info(ndev, "attached PHY %d (IRQ %d) to driver %s\n",
-                   phydev->addr, phydev->irq, phydev->drv->name);
+                   phydev->addr, phydev->irq, phydev_name(phydev));
 
        mdp->phydev = phydev;
 
index 43ccb4a6de15a3fe2dedc9198a3866fd89143f47..5b13b8c11bef240f6c4a4b655509da29de9634be 100644 (file)
@@ -216,7 +216,7 @@ int sxgbe_mdio_register(struct net_device *ndev)
                        }
                        netdev_info(ndev, "PHY ID %08x at %d IRQ %s (%s)%s\n",
                                    phy->phy_id, phy_addr, irq_str,
-                                   dev_name(&phy->dev), act ? " active" : "");
+                                   phydev_name(phy), act ? " active" : "");
                        phy_found = true;
                }
        }
index 219a99b7a631d5216c0667e24ca5595b67e56289..067346d3209d0daf97d805fc904af43589757300 100644 (file)
@@ -1033,7 +1033,7 @@ static int smsc911x_mii_probe(struct net_device *dev)
 
        netdev_info(dev,
                    "attached PHY driver [%s] (mii_bus:phy_addr=%s, irq=%d)\n",
-                   phydev->drv->name, dev_name(&phydev->dev), phydev->irq);
+                   phydev->drv->name, phydev_name(phydev), phydev->irq);
 
        /* mask with MAC supported features */
        phydev->supported &= (PHY_BASIC_FEATURES | SUPPORTED_Pause |
index 4a90cdae5444fa36c54fc1fcd7f0e2158e346404..a02ed6b6306401b8c49915a16ee9c56cc709340c 100644 (file)
@@ -1167,7 +1167,7 @@ static int smsc9420_mii_probe(struct net_device *dev)
        netif_info(pd, probe, pd->dev, "PHY addr %d, phy_id 0x%08X\n",
                   phydev->addr, phydev->phy_id);
 
-       phydev = phy_connect(dev, dev_name(&phydev->dev),
+       phydev = phy_connect(dev, phydev_name(phydev),
                             smsc9420_phy_adjust_link, PHY_INTERFACE_MODE_MII);
 
        if (IS_ERR(phydev)) {
@@ -1176,7 +1176,7 @@ static int smsc9420_mii_probe(struct net_device *dev)
        }
 
        netdev_info(dev, "attached PHY driver [%s] (mii_bus:phy_addr=%s, irq=%d)\n",
-                   phydev->drv->name, dev_name(&phydev->dev), phydev->irq);
+                   phydev->drv->name, phydev_name(phydev), phydev->irq);
 
        /* mask with MAC supported features */
        phydev->supported &= (PHY_BASIC_FEATURES | SUPPORTED_Pause |
index 16c85ccd1762c00d55c21fc47ab398ec069367ea..05ba84118f37a7e83406765503b9dfe7e3161aca 100644 (file)
@@ -298,7 +298,7 @@ int stmmac_mdio_register(struct net_device *ndev)
                        }
                        pr_info("%s: PHY ID %08x at %d IRQ %s (%s)%s\n",
                                ndev->name, phydev->phy_id, addr,
-                               irq_str, dev_name(&phydev->dev),
+                               irq_str, phydev_name(phydev),
                                act ? " active" : "");
                        found = 1;
                }
index 33bd3b902304f3e737ad08c616d43d9b75c86dce..5a40b0256327c6840bed232b47df9d24a8971183 100644 (file)
@@ -1646,7 +1646,7 @@ static int emac_dev_open(struct net_device *ndev)
 
                dev_info(emac_dev, "attached PHY driver [%s] "
                        "(mii_bus:phy_addr=%s, id=%x)\n",
-                       priv->phydev->drv->name, dev_name(&priv->phydev->dev),
+                       priv->phydev->drv->name, phydev_name(priv->phydev),
                        priv->phydev->phy_id);
        }
 
index c00084d689f3ba99fe846c2e50f5b21daec73189..88e8e6055b9fa8282bb8a3a35f33e6d9e18fae27 100644 (file)
@@ -396,7 +396,7 @@ static int davinci_mdio_probe(struct platform_device *pdev)
                phy = data->bus->phy_map[addr];
                if (phy) {
                        dev_info(dev, "phy[%d]: device %s, driver %s\n",
-                                phy->addr, dev_name(&phy->dev),
+                                phy->addr, phydev_name(phy),
                                 phy->drv ? phy->drv->name : "unknown");
                }
        }
index 4e70e7586a0918a045008b7e54e807f0f11e2de9..d543298d6750a238162e27b6a8f1ddbe76c05431 100644 (file)
@@ -2178,7 +2178,7 @@ static int gbe_slave_open(struct gbe_intf *gbe_intf)
                        return -ENODEV;
                }
                dev_dbg(priv->dev, "phy found: id is: 0x%s\n",
-                       dev_name(&slave->phy->dev));
+                       phydev_name(slave->phy));
                phy_start(slave->phy);
                phy_read_status(slave->phy);
        }
@@ -2681,7 +2681,7 @@ static void init_secondary_ports(struct gbe_priv *gbe_dev,
                        slave->phy = NULL;
                } else {
                        dev_dbg(dev, "phy found: id is: 0x%s\n",
-                               dev_name(&slave->phy->dev));
+                               phydev_name(slave->phy));
                        phy_start(slave->phy);
                        phy_read_status(slave->phy);
                }
index 45ac38d29ed83eb3f7d9465fc8bcbf27db6e1903..8df6072ac78d14c77ea111a99986a5c00d622530 100644 (file)
@@ -631,7 +631,7 @@ static int tc_mii_probe(struct net_device *dev)
        }
 
        /* attach the mac to the phy */
-       phydev = phy_connect(dev, dev_name(&phydev->dev),
+       phydev = phy_connect(dev, phydev_name(phydev),
                             &tc_handle_link_change,
                             lp->chiptype == TC35815_TX4939 ? PHY_INTERFACE_MODE_RMII : PHY_INTERFACE_MODE_MII);
        if (IS_ERR(phydev)) {
@@ -640,7 +640,7 @@ static int tc_mii_probe(struct net_device *dev)
        }
        printk(KERN_INFO "%s: attached PHY driver [%s] "
                "(mii_bus:phy_addr=%s, id=%x)\n",
-               dev->name, phydev->drv->name, dev_name(&phydev->dev),
+               dev->name, phydev->drv->name, phydev_name(phydev),
                phydev->phy_id);
 
        /* mask with MAC supported features */
index d4083c381cd1bbe12e21f3230742719ccba1231b..9f4e6eb886af000735c811ca355467138c006fd3 100644 (file)
@@ -170,7 +170,7 @@ static int bcm7xxx_28nm_config_init(struct phy_device *phydev)
        int ret = 0;
 
        pr_info_once("%s: %s PHY revision: 0x%02x, patch: %d\n",
-                    dev_name(&phydev->dev), phydev->drv->name, rev, patch);
+                    phydev_name(phydev), phydev->drv->name, rev, patch);
 
        /* Dummy read to a register to workaround an issue upon reset where the
         * internal inverter may not allow the first MDIO transaction to pass
index 0bfbabad44316cc85f3a8497be222d545e34abfb..0f179709a289c9560db372e3f9853f580738bf36 100644 (file)
@@ -114,7 +114,7 @@ EXPORT_SYMBOL(phy_register_fixup_for_id);
  */
 static int phy_needs_fixup(struct phy_device *phydev, struct phy_fixup *fixup)
 {
-       if (strcmp(fixup->bus_id, dev_name(&phydev->dev)) != 0)
+       if (strcmp(fixup->bus_id, phydev_name(phydev)) != 0)
                if (strcmp(fixup->bus_id, PHY_ANY_ID) != 0)
                        return 0;
 
index 8ae01753b011a39cd015f9e050eebd3f9cbc17ef..b939c4b5f2295dedbe92447a7dbeead490cc3172 100644 (file)
@@ -838,8 +838,8 @@ static int xlr_mii_probe(struct xlr_net_priv *priv)
        }
 
        /* Attach MAC to PHY */
-       phydev = phy_connect(priv->ndev, dev_name(&phydev->dev),
-                       &xlr_gmac_link_adjust, priv->nd->phy_interface);
+       phydev = phy_connect(priv->ndev, phydev_name(phydev),
+                            &xlr_gmac_link_adjust, priv->nd->phy_interface);
 
        if (IS_ERR(phydev)) {
                pr_err("could not attach PHY\n");
@@ -855,7 +855,7 @@ static int xlr_mii_probe(struct xlr_net_priv *priv)
 
        phydev->advertising = phydev->supported;
        pr_info("attached PHY driver [%s] (mii_bus:phy_addr=%s\n",
-               phydev->drv->name, dev_name(&phydev->dev));
+               phydev->drv->name, phydev_name(phydev));
        return 0;
 }
 
index dbcf9fdd960ca2ffa064b78863e125b88b55134f..5f5cc3424b9ed7593973f0607b4f7ba4f0cbe8a6 100644 (file)
@@ -783,6 +783,11 @@ static inline int phy_read_status(struct phy_device *phydev)
 #define phydev_dbg(_phydev, format, args...)   \
        dev_dbg(&_phydev->dev, format, ##args)
 
+static inline const char *phydev_name(const struct phy_device *phydev)
+{
+       return dev_name(&phydev->dev);
+}
+
 int genphy_config_init(struct phy_device *phydev);
 int genphy_setup_forced(struct phy_device *phydev);
 int genphy_restart_aneg(struct phy_device *phydev);