LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Brandon Maier <brandon.maier@rockwellcollins.com>
To: netdev@vger.kernel.org
Cc: andrew@lunn.ch, f.fainelli@gmail.com, davem@davemloft.net,
	michal.simek@xilinx.com, clayton.shotwell@rockwellcollins.com,
	kristopher.cory@rockwellcollins.com,
	linux-kernel@vger.kernel.org,
	Brandon Maier <brandon.maier@rockwellcollins.com>
Subject: [PATCH 2/3] net: phy: xgmiitorgmii: Use correct mdio bus
Date: Thu,  7 Jun 2018 10:53:47 -0500	[thread overview]
Message-ID: <20180607155348.149665-2-brandon.maier@rockwellcollins.com> (raw)
In-Reply-To: <20180607155348.149665-1-brandon.maier@rockwellcollins.com>

The xgmiitorgmii is using the mii_bus of the device it's attached too,
instead of the bus it was given during probe.

Signed-off-by: Brandon Maier <brandon.maier@rockwellcollins.com>
---
 drivers/net/phy/xilinx_gmii2rgmii.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/drivers/net/phy/xilinx_gmii2rgmii.c b/drivers/net/phy/xilinx_gmii2rgmii.c
index 04c8bec1c4c1..d6f8b64cddbe 100644
--- a/drivers/net/phy/xilinx_gmii2rgmii.c
+++ b/drivers/net/phy/xilinx_gmii2rgmii.c
@@ -33,17 +33,19 @@ struct gmii2rgmii {
 	struct phy_device *phy_dev;
 	struct phy_driver *phy_drv;
 	struct phy_driver conv_phy_drv;
-	int addr;
+	struct mdio_device *mdio;
 };
 
 static int xgmiitorgmii_read_status(struct phy_device *phydev)
 {
 	struct gmii2rgmii *priv = phydev->priv;
+	struct mii_bus *bus = priv->mdio->bus;
+	int addr = priv->mdio->addr;
 	u16 val = 0;
 
 	priv->phy_drv->read_status(phydev);
 
-	val = mdiobus_read(phydev->mdio.bus, priv->addr, XILINX_GMII2RGMII_REG);
+	val = mdiobus_read(bus, addr, XILINX_GMII2RGMII_REG);
 	val &= ~XILINX_GMII2RGMII_SPEED_MASK;
 
 	if (phydev->speed == SPEED_1000)
@@ -53,7 +55,7 @@ static int xgmiitorgmii_read_status(struct phy_device *phydev)
 	else
 		val |= BMCR_SPEED10;
 
-	mdiobus_write(phydev->mdio.bus, priv->addr, XILINX_GMII2RGMII_REG, val);
+	mdiobus_write(bus, addr, XILINX_GMII2RGMII_REG, val);
 
 	return 0;
 }
@@ -86,7 +88,7 @@ static int xgmiitorgmii_probe(struct mdio_device *mdiodev)
 		return -EPROBE_DEFER;
 	}
 
-	priv->addr = mdiodev->addr;
+	priv->mdio = mdiodev;
 	priv->phy_drv = priv->phy_dev->drv;
 	memcpy(&priv->conv_phy_drv, priv->phy_dev->drv,
 	       sizeof(struct phy_driver));
-- 
2.14.3

  reply	other threads:[~2018-06-07 16:06 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-07 15:53 [PATCH 1/3] net: phy: Check phy_driver ready before accessing Brandon Maier
2018-06-07 15:53 ` Brandon Maier [this message]
2018-06-07 16:49   ` [PATCH 2/3] net: phy: xgmiitorgmii: Use correct mdio bus Andrew Lunn
2018-06-07 17:37     ` Brandon Maier
2018-06-07 15:53 ` [PATCH 3/3] net: phy: xgmiitorgmii: Check read_status results Brandon Maier
2018-06-07 16:43   ` Andrew Lunn
2018-06-07 16:52 ` [PATCH 1/3] net: phy: Check phy_driver ready before accessing Andrew Lunn
2018-06-07 17:34   ` Brandon Maier
2018-06-07 18:12     ` Andrew Lunn
2018-06-07 16:54 ` Andrew Lunn

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180607155348.149665-2-brandon.maier@rockwellcollins.com \
    --to=brandon.maier@rockwellcollins.com \
    --cc=andrew@lunn.ch \
    --cc=clayton.shotwell@rockwellcollins.com \
    --cc=davem@davemloft.net \
    --cc=f.fainelli@gmail.com \
    --cc=kristopher.cory@rockwellcollins.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=michal.simek@xilinx.com \
    --cc=netdev@vger.kernel.org \
    --subject='Re: [PATCH 2/3] net: phy: xgmiitorgmii: Use correct mdio bus' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

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).