@@ -1183,7 +1183,8 @@ static int vsc9959_mdio_bus_alloc(struct ocelot *ocelot)
if (ocelot_port->phy_mode == PHY_INTERFACE_MODE_USXGMII)
is_c45 = true;
- pcs = get_phy_device(felix->imdio, port, is_c45);
+ pcs = phy_device_create(felix->imdio, port,
+ PHY_ID_NONE, is_c45);
if (IS_ERR(pcs))
continue;
@@ -1017,8 +1017,9 @@ static int xgbe_phy_find_phy_device(struct xgbe_prv_data *pdata)
}
/* Create and connect to the PHY device */
- phydev = get_phy_device(phy_data->mii, phy_data->mdio_addr,
- (phy_data->phydev_mode == XGBE_MDIO_MODE_CL45));
+ phydev = phy_device_create(phy_data->mii, phy_data->mdio_addr,
+ PHY_ID_NONE,
+ phy_data->phydev_mode == XGBE_MDIO_MODE_CL45);
if (IS_ERR(phydev)) {
netdev_err(pdata->netdev, "get_phy_device failed\n");
return -ENODEV;
@@ -703,7 +703,7 @@ hns_mac_register_phydev(struct mii_bus *mdio, struct hns_mac_cb *mac_cb,
else
return -ENODATA;
- phy = get_phy_device(mdio, addr, is_c45);
+ phy = phy_device_create(mdio, addr, PHY_ID_NONE, is_c45);
if (!phy || IS_ERR(phy))
return -EIO;
@@ -1935,7 +1935,8 @@ static int netsec_register_mdio(struct netsec_priv *priv, u32 phy_addr)
return ret;
}
- priv->phydev = get_phy_device(bus, phy_addr, false);
+ priv->phydev = phy_device_create(bus, phy_addr,
+ PHY_ID_NONE, false);
if (IS_ERR(priv->phydev)) {
ret = PTR_ERR(priv->phydev);
dev_err(priv->dev, "get_phy_device err(%d)\n", ret);
@@ -254,7 +254,7 @@ static struct phy_device *__fixed_phy_register(unsigned int irq,
return ERR_PTR(ret);
}
- phy = get_phy_device(fmb->mii_bus, phy_addr, false);
+ phy = phy_device_create(fmb->mii_bus, phy_addr, PHY_ID_NONE, false);
if (IS_ERR(phy)) {
fixed_phy_del(phy_addr);
return ERR_PTR(-EINVAL);
@@ -264,7 +264,7 @@ struct phy_device *xgene_enet_phy_register(struct mii_bus *bus, int phy_addr)
{
struct phy_device *phy_dev;
- phy_dev = get_phy_device(bus, phy_addr, false);
+ phy_dev = phy_device_create(bus, phy_addr, PHY_ID_NONE, false);
if (!phy_dev || IS_ERR(phy_dev))
return NULL;
@@ -742,7 +742,7 @@ struct phy_device *mdiobus_scan(struct mii_bus *bus, int addr)
struct phy_device *phydev;
int err;
- phydev = get_phy_device(bus, addr, false);
+ phydev = phy_device_create(bus, addr, PHY_ID_NONE, false);
if (IS_ERR(phydev))
return phydev;
@@ -817,20 +817,6 @@ static int phy_device_read_id(struct phy_device *phydev)
phydev->is_c45, &phydev->c45_ids);
}
-/**
- * get_phy_device - create a phy_device withoug PHY ID
- * @bus: the target MII bus
- * @addr: PHY address on the MII bus
- * @is_c45: If true the PHY uses the 802.3 clause 45 protocol
- *
- * Allocates a new phy_device for @addr on the @bus.
- */
-struct phy_device *get_phy_device(struct mii_bus *bus, int addr, bool is_c45)
-{
- return phy_device_create(bus, addr, PHY_ID_NONE, is_c45);
-}
-EXPORT_SYMBOL(get_phy_device);
-
/**
* phy_device_register - Register the phy device on the MDIO bus
* @phydev: phy_device structure to be added to the MDIO bus
@@ -1431,7 +1431,7 @@ static int sfp_sm_probe_phy(struct sfp *sfp, bool is_c45)
struct phy_device *phy;
int err;
- phy = get_phy_device(sfp->i2c_mii, SFP_PHY_ADDR, is_c45);
+ phy = phy_device_create(sfp->i2c_mii, SFP_PHY_ADDR, PHY_ID_NONE, is_c45);
if (phy == ERR_PTR(-ENODEV))
return PTR_ERR(phy);
if (IS_ERR(phy)) {
@@ -120,10 +120,13 @@ static int of_mdiobus_register_phy(struct mii_bus *mdio,
is_c45 = of_device_is_compatible(child,
"ethernet-phy-ieee802.3-c45");
- if (!is_c45 && !of_get_phy_id(child, &phy_id))
- phy = phy_device_create(mdio, addr, phy_id, 0);
- else
- phy = get_phy_device(mdio, addr, is_c45);
+ if (!is_c45) {
+ rc = of_get_phy_id(child, &phy_id);
+ if (rc)
+ phy_id = PHY_ID_NONE;
+ }
+
+ phy = phy_device_create(mdio, addr, phy_id, is_c45);
if (IS_ERR(phy)) {
if (mii_ts)
unregister_mii_timestamper(mii_ts);
@@ -1215,16 +1215,9 @@ int phy_modify_paged(struct phy_device *phydev, int page, u32 regnum,
struct phy_device *phy_device_create(struct mii_bus *bus, int addr, u32 phy_id,
bool is_c45);
#if IS_ENABLED(CONFIG_PHYLIB)
-struct phy_device *get_phy_device(struct mii_bus *bus, int addr, bool is_c45);
int phy_device_register(struct phy_device *phy);
void phy_device_free(struct phy_device *phydev);
#else
-static inline
-struct phy_device *get_phy_device(struct mii_bus *bus, int addr, bool is_c45)
-{
- return NULL;
-}
-
static inline int phy_device_register(struct phy_device *phy)
{
return 0;