* [PATCH 1/2] net: ethernet: renesas: ravb: use phydev from struct net_device
@ 2016-08-19 22:52 Philippe Reynes
2016-08-19 22:52 ` [PATCH 2/2] net: ethernet: renesas: ravb: use new api ethtool_{get|set}_link_ksettings Philippe Reynes
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Philippe Reynes @ 2016-08-19 22:52 UTC (permalink / raw)
To: sergei.shtylyov, davem, kazuya.mizuguchi.ks, ykaneko0929,
horms+renesas, masaru.nagai.vx, geert+renesas,
niklas.soderlund+renesas
Cc: netdev, linux-renesas-soc, 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
phy_dev 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/renesas/ravb.h | 1 -
drivers/net/ethernet/renesas/ravb_main.c | 29 ++++++++++++-----------------
2 files changed, 12 insertions(+), 18 deletions(-)
diff --git a/drivers/net/ethernet/renesas/ravb.h b/drivers/net/ethernet/renesas/ravb.h
index 4e5d5e9..f110966 100644
--- a/drivers/net/ethernet/renesas/ravb.h
+++ b/drivers/net/ethernet/renesas/ravb.h
@@ -1011,7 +1011,6 @@ struct ravb_private {
struct work_struct work;
/* MII transceiver section. */
struct mii_bus *mii_bus; /* MDIO bus control */
- struct phy_device *phydev; /* PHY device control */
int link;
phy_interface_t phy_interface;
int msg_enable;
diff --git a/drivers/net/ethernet/renesas/ravb_main.c b/drivers/net/ethernet/renesas/ravb_main.c
index d4809ad..d21c9a4 100644
--- a/drivers/net/ethernet/renesas/ravb_main.c
+++ b/drivers/net/ethernet/renesas/ravb_main.c
@@ -942,7 +942,7 @@ out:
static void ravb_adjust_link(struct net_device *ndev)
{
struct ravb_private *priv = netdev_priv(ndev);
- struct phy_device *phydev = priv->phydev;
+ struct phy_device *phydev = ndev->phydev;
bool new_state = false;
if (phydev->link) {
@@ -1032,22 +1032,19 @@ static int ravb_phy_init(struct net_device *ndev)
phy_attached_info(phydev);
- priv->phydev = phydev;
-
return 0;
}
/* PHY control start function */
static int ravb_phy_start(struct net_device *ndev)
{
- struct ravb_private *priv = netdev_priv(ndev);
int error;
error = ravb_phy_init(ndev);
if (error)
return error;
- phy_start(priv->phydev);
+ phy_start(ndev->phydev);
return 0;
}
@@ -1058,9 +1055,9 @@ static int ravb_get_settings(struct net_device *ndev, struct ethtool_cmd *ecmd)
int error = -ENODEV;
unsigned long flags;
- if (priv->phydev) {
+ if (ndev->phydev) {
spin_lock_irqsave(&priv->lock, flags);
- error = phy_ethtool_gset(priv->phydev, ecmd);
+ error = phy_ethtool_gset(ndev->phydev, ecmd);
spin_unlock_irqrestore(&priv->lock, flags);
}
@@ -1073,7 +1070,7 @@ static int ravb_set_settings(struct net_device *ndev, struct ethtool_cmd *ecmd)
unsigned long flags;
int error;
- if (!priv->phydev)
+ if (!ndev->phydev)
return -ENODEV;
spin_lock_irqsave(&priv->lock, flags);
@@ -1081,7 +1078,7 @@ static int ravb_set_settings(struct net_device *ndev, struct ethtool_cmd *ecmd)
/* Disable TX and RX */
ravb_rcv_snd_disable(ndev);
- error = phy_ethtool_sset(priv->phydev, ecmd);
+ error = phy_ethtool_sset(ndev->phydev, ecmd);
if (error)
goto error_exit;
@@ -1110,9 +1107,9 @@ static int ravb_nway_reset(struct net_device *ndev)
int error = -ENODEV;
unsigned long flags;
- if (priv->phydev) {
+ if (ndev->phydev) {
spin_lock_irqsave(&priv->lock, flags);
- error = phy_start_aneg(priv->phydev);
+ error = phy_start_aneg(ndev->phydev);
spin_unlock_irqrestore(&priv->lock, flags);
}
@@ -1661,10 +1658,9 @@ static int ravb_close(struct net_device *ndev)
}
/* PHY disconnect */
- if (priv->phydev) {
- phy_stop(priv->phydev);
- phy_disconnect(priv->phydev);
- priv->phydev = NULL;
+ if (ndev->phydev) {
+ phy_stop(ndev->phydev);
+ phy_disconnect(ndev->phydev);
}
if (priv->chip_id != RCAR_GEN2) {
@@ -1753,8 +1749,7 @@ static int ravb_hwtstamp_set(struct net_device *ndev, struct ifreq *req)
/* ioctl to device function */
static int ravb_do_ioctl(struct net_device *ndev, struct ifreq *req, int cmd)
{
- struct ravb_private *priv = netdev_priv(ndev);
- struct phy_device *phydev = priv->phydev;
+ struct phy_device *phydev = ndev->phydev;
if (!netif_running(ndev))
return -EINVAL;
--
1.7.4.4
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 2/2] net: ethernet: renesas: ravb: use new api ethtool_{get|set}_link_ksettings
2016-08-19 22:52 [PATCH 1/2] net: ethernet: renesas: ravb: use phydev from struct net_device Philippe Reynes
@ 2016-08-19 22:52 ` Philippe Reynes
2016-08-20 19:41 ` Sergei Shtylyov
2016-08-21 5:27 ` David Miller
2016-08-20 19:39 ` [PATCH 1/2] net: ethernet: renesas: ravb: use phydev from struct net_device Sergei Shtylyov
2016-08-21 5:27 ` David Miller
2 siblings, 2 replies; 6+ messages in thread
From: Philippe Reynes @ 2016-08-19 22:52 UTC (permalink / raw)
To: sergei.shtylyov, davem, kazuya.mizuguchi.ks, ykaneko0929,
horms+renesas, masaru.nagai.vx, geert+renesas,
niklas.soderlund+renesas
Cc: netdev, linux-renesas-soc, linux-kernel, Philippe Reynes
The ethtool api {get|set}_settings is deprecated.
We move this driver to new api {get|set}_link_ksettings.
Signed-off-by: Philippe Reynes <tremyfr@gmail.com>
---
drivers/net/ethernet/renesas/ravb_main.c | 16 +++++++++-------
1 files changed, 9 insertions(+), 7 deletions(-)
diff --git a/drivers/net/ethernet/renesas/ravb_main.c b/drivers/net/ethernet/renesas/ravb_main.c
index d21c9a4..cad23ba 100644
--- a/drivers/net/ethernet/renesas/ravb_main.c
+++ b/drivers/net/ethernet/renesas/ravb_main.c
@@ -1049,7 +1049,8 @@ static int ravb_phy_start(struct net_device *ndev)
return 0;
}
-static int ravb_get_settings(struct net_device *ndev, struct ethtool_cmd *ecmd)
+static int ravb_get_link_ksettings(struct net_device *ndev,
+ struct ethtool_link_ksettings *cmd)
{
struct ravb_private *priv = netdev_priv(ndev);
int error = -ENODEV;
@@ -1057,14 +1058,15 @@ static int ravb_get_settings(struct net_device *ndev, struct ethtool_cmd *ecmd)
if (ndev->phydev) {
spin_lock_irqsave(&priv->lock, flags);
- error = phy_ethtool_gset(ndev->phydev, ecmd);
+ error = phy_ethtool_ksettings_get(ndev->phydev, cmd);
spin_unlock_irqrestore(&priv->lock, flags);
}
return error;
}
-static int ravb_set_settings(struct net_device *ndev, struct ethtool_cmd *ecmd)
+static int ravb_set_link_ksettings(struct net_device *ndev,
+ const struct ethtool_link_ksettings *cmd)
{
struct ravb_private *priv = netdev_priv(ndev);
unsigned long flags;
@@ -1078,11 +1080,11 @@ static int ravb_set_settings(struct net_device *ndev, struct ethtool_cmd *ecmd)
/* Disable TX and RX */
ravb_rcv_snd_disable(ndev);
- error = phy_ethtool_sset(ndev->phydev, ecmd);
+ error = phy_ethtool_ksettings_set(ndev->phydev, cmd);
if (error)
goto error_exit;
- if (ecmd->duplex == DUPLEX_FULL)
+ if (cmd->base.duplex == DUPLEX_FULL)
priv->duplex = 1;
else
priv->duplex = 0;
@@ -1306,8 +1308,6 @@ static int ravb_get_ts_info(struct net_device *ndev,
}
static const struct ethtool_ops ravb_ethtool_ops = {
- .get_settings = ravb_get_settings,
- .set_settings = ravb_set_settings,
.nway_reset = ravb_nway_reset,
.get_msglevel = ravb_get_msglevel,
.set_msglevel = ravb_set_msglevel,
@@ -1318,6 +1318,8 @@ static const struct ethtool_ops ravb_ethtool_ops = {
.get_ringparam = ravb_get_ringparam,
.set_ringparam = ravb_set_ringparam,
.get_ts_info = ravb_get_ts_info,
+ .get_link_ksettings = ravb_get_link_ksettings,
+ .set_link_ksettings = ravb_set_link_ksettings,
};
static inline int ravb_hook_irq(unsigned int irq, irq_handler_t handler,
--
1.7.4.4
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH 2/2] net: ethernet: renesas: ravb: use new api ethtool_{get|set}_link_ksettings
2016-08-19 22:52 ` [PATCH 2/2] net: ethernet: renesas: ravb: use new api ethtool_{get|set}_link_ksettings Philippe Reynes
@ 2016-08-20 19:41 ` Sergei Shtylyov
2016-08-21 5:27 ` David Miller
1 sibling, 0 replies; 6+ messages in thread
From: Sergei Shtylyov @ 2016-08-20 19:41 UTC (permalink / raw)
To: Philippe Reynes, davem, kazuya.mizuguchi.ks, ykaneko0929,
horms+renesas, masaru.nagai.vx, geert+renesas,
niklas.soderlund+renesas
Cc: netdev, linux-renesas-soc, linux-kernel
On 08/20/2016 01:52 AM, Philippe Reynes wrote:
> The ethtool api {get|set}_settings is deprecated.
> We move this driver to new api {get|set}_link_ksettings.
>
> Signed-off-by: Philippe Reynes <tremyfr@gmail.com>
[...]
Acked-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Sorry for missing the sh_eth patchset. :-<
MBR, Sergei
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 2/2] net: ethernet: renesas: ravb: use new api ethtool_{get|set}_link_ksettings
2016-08-19 22:52 ` [PATCH 2/2] net: ethernet: renesas: ravb: use new api ethtool_{get|set}_link_ksettings Philippe Reynes
2016-08-20 19:41 ` Sergei Shtylyov
@ 2016-08-21 5:27 ` David Miller
1 sibling, 0 replies; 6+ messages in thread
From: David Miller @ 2016-08-21 5:27 UTC (permalink / raw)
To: tremyfr
Cc: sergei.shtylyov, kazuya.mizuguchi.ks, ykaneko0929, horms+renesas,
masaru.nagai.vx, geert+renesas, niklas.soderlund+renesas, netdev,
linux-renesas-soc, linux-kernel
From: Philippe Reynes <tremyfr@gmail.com>
Date: Sat, 20 Aug 2016 00:52:19 +0200
> The ethtool api {get|set}_settings is deprecated.
> We move this driver to new api {get|set}_link_ksettings.
>
> Signed-off-by: Philippe Reynes <tremyfr@gmail.com>
Applied.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 1/2] net: ethernet: renesas: ravb: use phydev from struct net_device
2016-08-19 22:52 [PATCH 1/2] net: ethernet: renesas: ravb: use phydev from struct net_device Philippe Reynes
2016-08-19 22:52 ` [PATCH 2/2] net: ethernet: renesas: ravb: use new api ethtool_{get|set}_link_ksettings Philippe Reynes
@ 2016-08-20 19:39 ` Sergei Shtylyov
2016-08-21 5:27 ` David Miller
2 siblings, 0 replies; 6+ messages in thread
From: Sergei Shtylyov @ 2016-08-20 19:39 UTC (permalink / raw)
To: Philippe Reynes, davem, kazuya.mizuguchi.ks, ykaneko0929,
horms+renesas, masaru.nagai.vx, geert+renesas,
niklas.soderlund+renesas
Cc: netdev, linux-renesas-soc, linux-kernel
Hello.
On 08/20/2016 01:52 AM, Philippe Reynes wrote:
> The private structure contain a pointer to phydev, but the structure
> net_device already contain such pointer. So we can remove the pointer
> phy_dev 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>
[...]
Acked-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
MBR, Sergei
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 1/2] net: ethernet: renesas: ravb: use phydev from struct net_device
2016-08-19 22:52 [PATCH 1/2] net: ethernet: renesas: ravb: use phydev from struct net_device Philippe Reynes
2016-08-19 22:52 ` [PATCH 2/2] net: ethernet: renesas: ravb: use new api ethtool_{get|set}_link_ksettings Philippe Reynes
2016-08-20 19:39 ` [PATCH 1/2] net: ethernet: renesas: ravb: use phydev from struct net_device Sergei Shtylyov
@ 2016-08-21 5:27 ` David Miller
2 siblings, 0 replies; 6+ messages in thread
From: David Miller @ 2016-08-21 5:27 UTC (permalink / raw)
To: tremyfr
Cc: sergei.shtylyov, kazuya.mizuguchi.ks, ykaneko0929, horms+renesas,
masaru.nagai.vx, geert+renesas, niklas.soderlund+renesas, netdev,
linux-renesas-soc, linux-kernel
From: Philippe Reynes <tremyfr@gmail.com>
Date: Sat, 20 Aug 2016 00:52:18 +0200
> The private structure contain a pointer to phydev, but the structure
> net_device already contain such pointer. So we can remove the pointer
> phy_dev 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] 6+ messages in thread
end of thread, other threads:[~2016-08-21 5:27 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-08-19 22:52 [PATCH 1/2] net: ethernet: renesas: ravb: use phydev from struct net_device Philippe Reynes
2016-08-19 22:52 ` [PATCH 2/2] net: ethernet: renesas: ravb: use new api ethtool_{get|set}_link_ksettings Philippe Reynes
2016-08-20 19:41 ` Sergei Shtylyov
2016-08-21 5:27 ` David Miller
2016-08-20 19:39 ` [PATCH 1/2] net: ethernet: renesas: ravb: use phydev from struct net_device Sergei Shtylyov
2016-08-21 5:27 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).