Commit de0eabf8 authored by Philippe Reynes's avatar Philippe Reynes Committed by David S. Miller

net: ethernet: ax88796: use phydev from struct net_device

The private structure contain a pointer to phydev, but the structure
net_device already contain such pointer. So we can remove the pointer
phydev in the private structure, and update the driver to use the
one contained in struct net_device.
Signed-off-by: default avatarPhilippe Reynes <tremyfr@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent b4eccef8
...@@ -84,7 +84,6 @@ static u32 ax_msg_enable; ...@@ -84,7 +84,6 @@ static u32 ax_msg_enable;
struct ax_device { struct ax_device {
struct mii_bus *mii_bus; struct mii_bus *mii_bus;
struct mdiobb_ctrl bb_ctrl; struct mdiobb_ctrl bb_ctrl;
struct phy_device *phy_dev;
void __iomem *addr_memr; void __iomem *addr_memr;
u8 reg_memr; u8 reg_memr;
int link; int link;
...@@ -320,7 +319,7 @@ static void ax_block_output(struct net_device *dev, int count, ...@@ -320,7 +319,7 @@ static void ax_block_output(struct net_device *dev, int count,
static void ax_handle_link_change(struct net_device *dev) static void ax_handle_link_change(struct net_device *dev)
{ {
struct ax_device *ax = to_ax_dev(dev); struct ax_device *ax = to_ax_dev(dev);
struct phy_device *phy_dev = ax->phy_dev; struct phy_device *phy_dev = dev->phydev;
int status_change = 0; int status_change = 0;
if (phy_dev->link && ((ax->speed != phy_dev->speed) || if (phy_dev->link && ((ax->speed != phy_dev->speed) ||
...@@ -369,8 +368,6 @@ static int ax_mii_probe(struct net_device *dev) ...@@ -369,8 +368,6 @@ static int ax_mii_probe(struct net_device *dev)
phy_dev->supported &= PHY_BASIC_FEATURES; phy_dev->supported &= PHY_BASIC_FEATURES;
phy_dev->advertising = phy_dev->supported; phy_dev->advertising = phy_dev->supported;
ax->phy_dev = phy_dev;
netdev_info(dev, "PHY driver [%s] (mii_bus:phy_addr=%s, irq=%d)\n", netdev_info(dev, "PHY driver [%s] (mii_bus:phy_addr=%s, irq=%d)\n",
phy_dev->drv->name, phydev_name(phy_dev), phy_dev->irq); phy_dev->drv->name, phydev_name(phy_dev), phy_dev->irq);
...@@ -410,7 +407,7 @@ static int ax_open(struct net_device *dev) ...@@ -410,7 +407,7 @@ static int ax_open(struct net_device *dev)
ret = ax_mii_probe(dev); ret = ax_mii_probe(dev);
if (ret) if (ret)
goto failed_mii_probe; goto failed_mii_probe;
phy_start(ax->phy_dev); phy_start(dev->phydev);
ret = ax_ei_open(dev); ret = ax_ei_open(dev);
if (ret) if (ret)
...@@ -421,7 +418,7 @@ static int ax_open(struct net_device *dev) ...@@ -421,7 +418,7 @@ static int ax_open(struct net_device *dev)
return 0; return 0;
failed_ax_ei_open: failed_ax_ei_open:
phy_disconnect(ax->phy_dev); phy_disconnect(dev->phydev);
failed_mii_probe: failed_mii_probe:
ax_phy_switch(dev, 0); ax_phy_switch(dev, 0);
free_irq(dev->irq, dev); free_irq(dev->irq, dev);
...@@ -442,7 +439,7 @@ static int ax_close(struct net_device *dev) ...@@ -442,7 +439,7 @@ static int ax_close(struct net_device *dev)
/* turn the phy off */ /* turn the phy off */
ax_phy_switch(dev, 0); ax_phy_switch(dev, 0);
phy_disconnect(ax->phy_dev); phy_disconnect(dev->phydev);
free_irq(dev->irq, dev); free_irq(dev->irq, dev);
return 0; return 0;
...@@ -450,8 +447,7 @@ static int ax_close(struct net_device *dev) ...@@ -450,8 +447,7 @@ static int ax_close(struct net_device *dev)
static int ax_ioctl(struct net_device *dev, struct ifreq *req, int cmd) static int ax_ioctl(struct net_device *dev, struct ifreq *req, int cmd)
{ {
struct ax_device *ax = to_ax_dev(dev); struct phy_device *phy_dev = dev->phydev;
struct phy_device *phy_dev = ax->phy_dev;
if (!netif_running(dev)) if (!netif_running(dev))
return -EINVAL; return -EINVAL;
...@@ -476,8 +472,7 @@ static void ax_get_drvinfo(struct net_device *dev, ...@@ -476,8 +472,7 @@ static void ax_get_drvinfo(struct net_device *dev,
static int ax_get_settings(struct net_device *dev, struct ethtool_cmd *cmd) static int ax_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
{ {
struct ax_device *ax = to_ax_dev(dev); struct phy_device *phy_dev = dev->phydev;
struct phy_device *phy_dev = ax->phy_dev;
if (!phy_dev) if (!phy_dev)
return -ENODEV; return -ENODEV;
...@@ -487,8 +482,7 @@ static int ax_get_settings(struct net_device *dev, struct ethtool_cmd *cmd) ...@@ -487,8 +482,7 @@ static int ax_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
static int ax_set_settings(struct net_device *dev, struct ethtool_cmd *cmd) static int ax_set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
{ {
struct ax_device *ax = to_ax_dev(dev); struct phy_device *phy_dev = dev->phydev;
struct phy_device *phy_dev = ax->phy_dev;
if (!phy_dev) if (!phy_dev)
return -ENODEV; return -ENODEV;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment