All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] net: ethernet: ftgmac100: use phydev from struct net_device
@ 2016-05-15 23:35 Philippe Reynes
  2016-05-15 23:35 ` [PATCH 2/2] net: ethernet: ftgmac100: use phy_ethtool_{get|set}_link_ksettings Philippe Reynes
  2016-05-17  1:52 ` [PATCH 1/2] net: ethernet: ftgmac100: use phydev from struct net_device David Miller
  0 siblings, 2 replies; 4+ messages in thread
From: Philippe Reynes @ 2016-05-15 23:35 UTC (permalink / raw)
  To: andrew, davem, f.fainelli, linux; +Cc: netdev, linux-kernel, Philippe Reynes

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: Philippe Reynes <tremyfr@gmail.com>
---
 drivers/net/ethernet/faraday/ftgmac100.c |   24 ++++++++----------------
 1 files changed, 8 insertions(+), 16 deletions(-)

diff --git a/drivers/net/ethernet/faraday/ftgmac100.c b/drivers/net/ethernet/faraday/ftgmac100.c
index 84384e1..9cc23c3 100644
--- a/drivers/net/ethernet/faraday/ftgmac100.c
+++ b/drivers/net/ethernet/faraday/ftgmac100.c
@@ -71,7 +71,6 @@ struct ftgmac100 {
 	struct napi_struct napi;
 
 	struct mii_bus *mii_bus;
-	struct phy_device *phydev;
 	int old_speed;
 };
 
@@ -807,7 +806,7 @@ err:
 static void ftgmac100_adjust_link(struct net_device *netdev)
 {
 	struct ftgmac100 *priv = netdev_priv(netdev);
-	struct phy_device *phydev = priv->phydev;
+	struct phy_device *phydev = netdev->phydev;
 	int ier;
 
 	if (phydev->speed == priv->old_speed)
@@ -850,7 +849,6 @@ static int ftgmac100_mii_probe(struct ftgmac100 *priv)
 		return PTR_ERR(phydev);
 	}
 
-	priv->phydev = phydev;
 	return 0;
 }
 
@@ -942,17 +940,13 @@ static void ftgmac100_get_drvinfo(struct net_device *netdev,
 static int ftgmac100_get_settings(struct net_device *netdev,
 				  struct ethtool_cmd *cmd)
 {
-	struct ftgmac100 *priv = netdev_priv(netdev);
-
-	return phy_ethtool_gset(priv->phydev, cmd);
+	return phy_ethtool_gset(netdev->phydev, cmd);
 }
 
 static int ftgmac100_set_settings(struct net_device *netdev,
 				  struct ethtool_cmd *cmd)
 {
-	struct ftgmac100 *priv = netdev_priv(netdev);
-
-	return phy_ethtool_sset(priv->phydev, cmd);
+	return phy_ethtool_sset(netdev->phydev, cmd);
 }
 
 static const struct ethtool_ops ftgmac100_ethtool_ops = {
@@ -1085,7 +1079,7 @@ static int ftgmac100_open(struct net_device *netdev)
 	ftgmac100_init_hw(priv);
 	ftgmac100_start_hw(priv, 10);
 
-	phy_start(priv->phydev);
+	phy_start(netdev->phydev);
 
 	napi_enable(&priv->napi);
 	netif_start_queue(netdev);
@@ -1111,7 +1105,7 @@ static int ftgmac100_stop(struct net_device *netdev)
 
 	netif_stop_queue(netdev);
 	napi_disable(&priv->napi);
-	phy_stop(priv->phydev);
+	phy_stop(netdev->phydev);
 
 	ftgmac100_stop_hw(priv);
 	free_irq(priv->irq, netdev);
@@ -1152,9 +1146,7 @@ static int ftgmac100_hard_start_xmit(struct sk_buff *skb,
 /* optional */
 static int ftgmac100_do_ioctl(struct net_device *netdev, struct ifreq *ifr, int cmd)
 {
-	struct ftgmac100 *priv = netdev_priv(netdev);
-
-	return phy_mii_ioctl(priv->phydev, ifr, cmd);
+	return phy_mii_ioctl(netdev->phydev, ifr, cmd);
 }
 
 static const struct net_device_ops ftgmac100_netdev_ops = {
@@ -1275,7 +1267,7 @@ static int ftgmac100_probe(struct platform_device *pdev)
 	return 0;
 
 err_register_netdev:
-	phy_disconnect(priv->phydev);
+	phy_disconnect(netdev->phydev);
 err_mii_probe:
 	mdiobus_unregister(priv->mii_bus);
 err_register_mdiobus:
@@ -1301,7 +1293,7 @@ static int __exit ftgmac100_remove(struct platform_device *pdev)
 
 	unregister_netdev(netdev);
 
-	phy_disconnect(priv->phydev);
+	phy_disconnect(netdev->phydev);
 	mdiobus_unregister(priv->mii_bus);
 	mdiobus_free(priv->mii_bus);
 
-- 
1.7.4.4

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 2/2] net: ethernet: ftgmac100: use phy_ethtool_{get|set}_link_ksettings
  2016-05-15 23:35 [PATCH 1/2] net: ethernet: ftgmac100: use phydev from struct net_device Philippe Reynes
@ 2016-05-15 23:35 ` Philippe Reynes
  2016-05-17  1:52   ` David Miller
  2016-05-17  1:52 ` [PATCH 1/2] net: ethernet: ftgmac100: use phydev from struct net_device David Miller
  1 sibling, 1 reply; 4+ messages in thread
From: Philippe Reynes @ 2016-05-15 23:35 UTC (permalink / raw)
  To: andrew, davem, f.fainelli, linux; +Cc: netdev, linux-kernel, Philippe Reynes

There are two generics functions phy_ethtool_{get|set}_link_ksettings,
so we can use them instead of defining the same code in the driver.

Signed-off-by: Philippe Reynes <tremyfr@gmail.com>
---
 drivers/net/ethernet/faraday/ftgmac100.c |   16 ++--------------
 1 files changed, 2 insertions(+), 14 deletions(-)

diff --git a/drivers/net/ethernet/faraday/ftgmac100.c b/drivers/net/ethernet/faraday/ftgmac100.c
index 9cc23c3..e7cf313 100644
--- a/drivers/net/ethernet/faraday/ftgmac100.c
+++ b/drivers/net/ethernet/faraday/ftgmac100.c
@@ -937,23 +937,11 @@ static void ftgmac100_get_drvinfo(struct net_device *netdev,
 	strlcpy(info->bus_info, dev_name(&netdev->dev), sizeof(info->bus_info));
 }
 
-static int ftgmac100_get_settings(struct net_device *netdev,
-				  struct ethtool_cmd *cmd)
-{
-	return phy_ethtool_gset(netdev->phydev, cmd);
-}
-
-static int ftgmac100_set_settings(struct net_device *netdev,
-				  struct ethtool_cmd *cmd)
-{
-	return phy_ethtool_sset(netdev->phydev, cmd);
-}
-
 static const struct ethtool_ops ftgmac100_ethtool_ops = {
-	.set_settings		= ftgmac100_set_settings,
-	.get_settings		= ftgmac100_get_settings,
 	.get_drvinfo		= ftgmac100_get_drvinfo,
 	.get_link		= ethtool_op_get_link,
+	.get_link_ksettings	= phy_ethtool_get_link_ksettings,
+	.set_link_ksettings	= phy_ethtool_set_link_ksettings,
 };
 
 /******************************************************************************
-- 
1.7.4.4

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 1/2] net: ethernet: ftgmac100: use phydev from struct net_device
  2016-05-15 23:35 [PATCH 1/2] net: ethernet: ftgmac100: use phydev from struct net_device Philippe Reynes
  2016-05-15 23:35 ` [PATCH 2/2] net: ethernet: ftgmac100: use phy_ethtool_{get|set}_link_ksettings Philippe Reynes
@ 2016-05-17  1:52 ` David Miller
  1 sibling, 0 replies; 4+ messages in thread
From: David Miller @ 2016-05-17  1:52 UTC (permalink / raw)
  To: tremyfr; +Cc: andrew, f.fainelli, linux, netdev, linux-kernel

From: Philippe Reynes <tremyfr@gmail.com>
Date: Mon, 16 May 2016 01:35:13 +0200

> 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: Philippe Reynes <tremyfr@gmail.com>

Applied.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 2/2] net: ethernet: ftgmac100: use phy_ethtool_{get|set}_link_ksettings
  2016-05-15 23:35 ` [PATCH 2/2] net: ethernet: ftgmac100: use phy_ethtool_{get|set}_link_ksettings Philippe Reynes
@ 2016-05-17  1:52   ` David Miller
  0 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2016-05-17  1:52 UTC (permalink / raw)
  To: tremyfr; +Cc: andrew, f.fainelli, linux, netdev, linux-kernel

From: Philippe Reynes <tremyfr@gmail.com>
Date: Mon, 16 May 2016 01:35:14 +0200

> There are two generics functions phy_ethtool_{get|set}_link_ksettings,
> so we can use them instead of defining the same code in the driver.
> 
> Signed-off-by: Philippe Reynes <tremyfr@gmail.com>

Applied.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-05-17  1:52 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-05-15 23:35 [PATCH 1/2] net: ethernet: ftgmac100: use phydev from struct net_device Philippe Reynes
2016-05-15 23:35 ` [PATCH 2/2] net: ethernet: ftgmac100: use phy_ethtool_{get|set}_link_ksettings Philippe Reynes
2016-05-17  1:52   ` David Miller
2016-05-17  1:52 ` [PATCH 1/2] net: ethernet: ftgmac100: use phydev from struct net_device David Miller

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.