lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1466865222-11840-1-git-send-email-tremyfr@gmail.com>
Date:	Sat, 25 Jun 2016 16:33:41 +0200
From:	Philippe Reynes <tremyfr@...il.com>
To:	davem@...emloft.net, andrew@...n.ch, tklauser@...tanz.ch,
	colin.king@...onical.com, f.fainelli@...il.com, jcmvbkbc@...il.com
Cc:	netdev@...r.kernel.org, linux-kernel@...r.kernel.org,
	Philippe Reynes <tremyfr@...il.com>
Subject: [PATCH 1/2] 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@...il.com>
---
 drivers/net/ethernet/ethoc.c |   19 +++++++------------
 1 files changed, 7 insertions(+), 12 deletions(-)

diff --git a/drivers/net/ethernet/ethoc.c b/drivers/net/ethernet/ethoc.c
index 4edb98c..fe09021 100644
--- a/drivers/net/ethernet/ethoc.c
+++ b/drivers/net/ethernet/ethoc.c
@@ -219,7 +219,6 @@ struct ethoc {
 
 	spinlock_t lock;
 
-	struct phy_device *phy;
 	struct mii_bus *mdio;
 	struct clk *clk;
 	s8 phy_id;
@@ -694,7 +693,6 @@ static int ethoc_mdio_probe(struct net_device *dev)
 		return err;
 	}
 
-	priv->phy = phy;
 	phy->advertising &= ~(ADVERTISED_1000baseT_Full |
 			      ADVERTISED_1000baseT_Half);
 	phy->supported &= ~(SUPPORTED_1000baseT_Full |
@@ -724,7 +722,7 @@ static int ethoc_open(struct net_device *dev)
 		netif_start_queue(dev);
 	}
 
-	phy_start(priv->phy);
+	phy_start(dev->phydev);
 	napi_enable(&priv->napi);
 
 	if (netif_msg_ifup(priv)) {
@@ -741,8 +739,8 @@ static int ethoc_stop(struct net_device *dev)
 
 	napi_disable(&priv->napi);
 
-	if (priv->phy)
-		phy_stop(priv->phy);
+	if (dev->phydev)
+		phy_stop(dev->phydev);
 
 	ethoc_disable_rx_and_tx(priv);
 	free_irq(dev->irq, dev);
@@ -770,7 +768,7 @@ static int ethoc_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
 		if (!phy)
 			return -ENODEV;
 	} else {
-		phy = priv->phy;
+		phy = dev->phydev;
 	}
 
 	return phy_mii_ioctl(phy, ifr, cmd);
@@ -899,8 +897,7 @@ out:
 
 static int ethoc_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
 {
-	struct ethoc *priv = netdev_priv(dev);
-	struct phy_device *phydev = priv->phy;
+	struct phy_device *phydev = dev->phydev;
 
 	if (!phydev)
 		return -EOPNOTSUPP;
@@ -910,8 +907,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)
 {
-	struct ethoc *priv = netdev_priv(dev);
-	struct phy_device *phydev = priv->phy;
+	struct phy_device *phydev = dev->phydev;
 
 	if (!phydev)
 		return -EOPNOTSUPP;
@@ -1261,8 +1257,7 @@ static int ethoc_remove(struct platform_device *pdev)
 
 	if (netdev) {
 		netif_napi_del(&priv->napi);
-		phy_disconnect(priv->phy);
-		priv->phy = NULL;
+		phy_disconnect(netdev->phydev);
 
 		if (priv->mdio) {
 			mdiobus_unregister(priv->mdio);
-- 
1.7.4.4

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ