mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2025-03-31 15:03:30 +07:00
net: ethernet: ethoc: 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 <tremyfr@gmail.com> Reviewed-by: Tobias Klauser <tklauser@distanz.ch> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
6cf285de02
commit
11331fc294
@ -192,7 +192,6 @@ MODULE_PARM_DESC(buffer_size, "DMA buffer allocation size");
|
|||||||
* @napi: NAPI structure
|
* @napi: NAPI structure
|
||||||
* @msg_enable: device state flags
|
* @msg_enable: device state flags
|
||||||
* @lock: device lock
|
* @lock: device lock
|
||||||
* @phy: attached PHY
|
|
||||||
* @mdio: MDIO bus for PHY access
|
* @mdio: MDIO bus for PHY access
|
||||||
* @phy_id: address of attached PHY
|
* @phy_id: address of attached PHY
|
||||||
*/
|
*/
|
||||||
@ -219,7 +218,6 @@ struct ethoc {
|
|||||||
|
|
||||||
spinlock_t lock;
|
spinlock_t lock;
|
||||||
|
|
||||||
struct phy_device *phy;
|
|
||||||
struct mii_bus *mdio;
|
struct mii_bus *mdio;
|
||||||
struct clk *clk;
|
struct clk *clk;
|
||||||
s8 phy_id;
|
s8 phy_id;
|
||||||
@ -694,7 +692,6 @@ static int ethoc_mdio_probe(struct net_device *dev)
|
|||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
priv->phy = phy;
|
|
||||||
phy->advertising &= ~(ADVERTISED_1000baseT_Full |
|
phy->advertising &= ~(ADVERTISED_1000baseT_Full |
|
||||||
ADVERTISED_1000baseT_Half);
|
ADVERTISED_1000baseT_Half);
|
||||||
phy->supported &= ~(SUPPORTED_1000baseT_Full |
|
phy->supported &= ~(SUPPORTED_1000baseT_Full |
|
||||||
@ -724,7 +721,7 @@ static int ethoc_open(struct net_device *dev)
|
|||||||
netif_start_queue(dev);
|
netif_start_queue(dev);
|
||||||
}
|
}
|
||||||
|
|
||||||
phy_start(priv->phy);
|
phy_start(dev->phydev);
|
||||||
napi_enable(&priv->napi);
|
napi_enable(&priv->napi);
|
||||||
|
|
||||||
if (netif_msg_ifup(priv)) {
|
if (netif_msg_ifup(priv)) {
|
||||||
@ -741,8 +738,8 @@ static int ethoc_stop(struct net_device *dev)
|
|||||||
|
|
||||||
napi_disable(&priv->napi);
|
napi_disable(&priv->napi);
|
||||||
|
|
||||||
if (priv->phy)
|
if (dev->phydev)
|
||||||
phy_stop(priv->phy);
|
phy_stop(dev->phydev);
|
||||||
|
|
||||||
ethoc_disable_rx_and_tx(priv);
|
ethoc_disable_rx_and_tx(priv);
|
||||||
free_irq(dev->irq, dev);
|
free_irq(dev->irq, dev);
|
||||||
@ -770,7 +767,7 @@ static int ethoc_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
|
|||||||
if (!phy)
|
if (!phy)
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
} else {
|
} else {
|
||||||
phy = priv->phy;
|
phy = dev->phydev;
|
||||||
}
|
}
|
||||||
|
|
||||||
return phy_mii_ioctl(phy, ifr, cmd);
|
return phy_mii_ioctl(phy, ifr, cmd);
|
||||||
@ -899,8 +896,7 @@ static netdev_tx_t ethoc_start_xmit(struct sk_buff *skb, struct net_device *dev)
|
|||||||
|
|
||||||
static int ethoc_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
|
static int ethoc_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
|
||||||
{
|
{
|
||||||
struct ethoc *priv = netdev_priv(dev);
|
struct phy_device *phydev = dev->phydev;
|
||||||
struct phy_device *phydev = priv->phy;
|
|
||||||
|
|
||||||
if (!phydev)
|
if (!phydev)
|
||||||
return -EOPNOTSUPP;
|
return -EOPNOTSUPP;
|
||||||
@ -910,8 +906,7 @@ static int ethoc_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
|
|||||||
|
|
||||||
static int ethoc_set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
|
static int ethoc_set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
|
||||||
{
|
{
|
||||||
struct ethoc *priv = netdev_priv(dev);
|
struct phy_device *phydev = dev->phydev;
|
||||||
struct phy_device *phydev = priv->phy;
|
|
||||||
|
|
||||||
if (!phydev)
|
if (!phydev)
|
||||||
return -EOPNOTSUPP;
|
return -EOPNOTSUPP;
|
||||||
@ -1261,8 +1256,7 @@ static int ethoc_remove(struct platform_device *pdev)
|
|||||||
|
|
||||||
if (netdev) {
|
if (netdev) {
|
||||||
netif_napi_del(&priv->napi);
|
netif_napi_del(&priv->napi);
|
||||||
phy_disconnect(priv->phy);
|
phy_disconnect(netdev->phydev);
|
||||||
priv->phy = NULL;
|
|
||||||
|
|
||||||
if (priv->mdio) {
|
if (priv->mdio) {
|
||||||
mdiobus_unregister(priv->mdio);
|
mdiobus_unregister(priv->mdio);
|
||||||
|
Loading…
Reference in New Issue
Block a user