diff options
author | David S. Miller <davem@davemloft.net> | 2019-09-05 12:32:06 +0200 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2019-09-05 12:32:06 +0200 |
commit | 1e6068899c0fda0e996ee6428ea2f320df084bb6 (patch) | |
tree | 945368660310b564a4ae72fde8229ef01fae97ab | |
parent | 1ddee6d843d841414039414923620c8160aec623 (diff) | |
parent | 168f7a1616081832bcfd710c2b5eaeb848eacebb (diff) | |
download | linux-1e6068899c0fda0e996ee6428ea2f320df084bb6.tar.gz linux-1e6068899c0fda0e996ee6428ea2f320df084bb6.tar.bz2 linux-1e6068899c0fda0e996ee6428ea2f320df084bb6.zip |
Merge branch 'Fix-GMII2RGMII-private-field'
Harini Katakam says:
====================
Fix GMII2RGMII private field
Fix the usage of external phy's priv field by gmii2rgmii driver.
Based on net-next.
====================
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | drivers/net/phy/xilinx_gmii2rgmii.c | 4 | ||||
-rw-r--r-- | include/linux/mdio.h | 11 |
2 files changed, 13 insertions, 2 deletions
diff --git a/drivers/net/phy/xilinx_gmii2rgmii.c b/drivers/net/phy/xilinx_gmii2rgmii.c index 2d1449345959..151c2a3f0b3a 100644 --- a/drivers/net/phy/xilinx_gmii2rgmii.c +++ b/drivers/net/phy/xilinx_gmii2rgmii.c @@ -29,7 +29,7 @@ struct gmii2rgmii { static int xgmiitorgmii_read_status(struct phy_device *phydev) { - struct gmii2rgmii *priv = phydev->priv; + struct gmii2rgmii *priv = mdiodev_get_drvdata(&phydev->mdio); struct mii_bus *bus = priv->mdio->bus; int addr = priv->mdio->addr; u16 val = 0; @@ -90,7 +90,7 @@ static int xgmiitorgmii_probe(struct mdio_device *mdiodev) memcpy(&priv->conv_phy_drv, priv->phy_dev->drv, sizeof(struct phy_driver)); priv->conv_phy_drv.read_status = xgmiitorgmii_read_status; - priv->phy_dev->priv = priv; + mdiodev_set_drvdata(&priv->phy_dev->mdio, priv); priv->phy_dev->drv = &priv->conv_phy_drv; return 0; diff --git a/include/linux/mdio.h b/include/linux/mdio.h index e8242ad88c81..a7604248777b 100644 --- a/include/linux/mdio.h +++ b/include/linux/mdio.h @@ -68,6 +68,17 @@ struct mdio_driver { #define to_mdio_driver(d) \ container_of(to_mdio_common_driver(d), struct mdio_driver, mdiodrv) +/* device driver data */ +static inline void mdiodev_set_drvdata(struct mdio_device *mdio, void *data) +{ + dev_set_drvdata(&mdio->dev, data); +} + +static inline void *mdiodev_get_drvdata(struct mdio_device *mdio) +{ + return dev_get_drvdata(&mdio->dev); +} + void mdio_device_free(struct mdio_device *mdiodev); struct mdio_device *mdio_device_create(struct mii_bus *bus, int addr); int mdio_device_register(struct mdio_device *mdiodev); |