Skip to content

Commit d1e3a35

Browse files
Philippe Reynesdavem330
authored andcommitted
net: ethernet: lantiq_etop: 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 phy in the private structure, and update the driver to use the one contained in struct net_device. Signed-off-by: Philippe Reynes <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent f4400de commit d1e3a35

File tree

1 file changed

+7
-17
lines changed

1 file changed

+7
-17
lines changed

drivers/net/ethernet/lantiq_etop.c

Lines changed: 7 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,6 @@ struct ltq_etop_priv {
102102
struct resource *res;
103103

104104
struct mii_bus *mii_bus;
105-
struct phy_device *phydev;
106105

107106
struct ltq_etop_chan ch[MAX_DMA_CHAN];
108107
int tx_free[MAX_DMA_CHAN >> 1];
@@ -307,25 +306,19 @@ ltq_etop_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info)
307306
static int
308307
ltq_etop_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
309308
{
310-
struct ltq_etop_priv *priv = netdev_priv(dev);
311-
312-
return phy_ethtool_gset(priv->phydev, cmd);
309+
return phy_ethtool_gset(dev->phydev, cmd);
313310
}
314311

315312
static int
316313
ltq_etop_set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
317314
{
318-
struct ltq_etop_priv *priv = netdev_priv(dev);
319-
320-
return phy_ethtool_sset(priv->phydev, cmd);
315+
return phy_ethtool_sset(dev->phydev, cmd);
321316
}
322317

323318
static int
324319
ltq_etop_nway_reset(struct net_device *dev)
325320
{
326-
struct ltq_etop_priv *priv = netdev_priv(dev);
327-
328-
return phy_start_aneg(priv->phydev);
321+
return phy_start_aneg(dev->phydev);
329322
}
330323

331324
static const struct ethtool_ops ltq_etop_ethtool_ops = {
@@ -401,7 +394,6 @@ ltq_etop_mdio_probe(struct net_device *dev)
401394
| SUPPORTED_TP);
402395

403396
phydev->advertising = phydev->supported;
404-
priv->phydev = phydev;
405397
phy_attached_info(phydev);
406398

407399
return 0;
@@ -450,7 +442,7 @@ ltq_etop_mdio_cleanup(struct net_device *dev)
450442
{
451443
struct ltq_etop_priv *priv = netdev_priv(dev);
452444

453-
phy_disconnect(priv->phydev);
445+
phy_disconnect(dev->phydev);
454446
mdiobus_unregister(priv->mii_bus);
455447
mdiobus_free(priv->mii_bus);
456448
}
@@ -469,7 +461,7 @@ ltq_etop_open(struct net_device *dev)
469461
ltq_dma_open(&ch->dma);
470462
napi_enable(&ch->napi);
471463
}
472-
phy_start(priv->phydev);
464+
phy_start(dev->phydev);
473465
netif_tx_start_all_queues(dev);
474466
return 0;
475467
}
@@ -481,7 +473,7 @@ ltq_etop_stop(struct net_device *dev)
481473
int i;
482474

483475
netif_tx_stop_all_queues(dev);
484-
phy_stop(priv->phydev);
476+
phy_stop(dev->phydev);
485477
for (i = 0; i < MAX_DMA_CHAN; i++) {
486478
struct ltq_etop_chan *ch = &priv->ch[i];
487479

@@ -556,10 +548,8 @@ ltq_etop_change_mtu(struct net_device *dev, int new_mtu)
556548
static int
557549
ltq_etop_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
558550
{
559-
struct ltq_etop_priv *priv = netdev_priv(dev);
560-
561551
/* TODO: mii-toll reports "No MII transceiver present!." ?!*/
562-
return phy_mii_ioctl(priv->phydev, rq, cmd);
552+
return phy_mii_ioctl(dev->phydev, rq, cmd);
563553
}
564554

565555
static int

0 commit comments

Comments
 (0)