Commit 1e606889 authored by David S. Miller's avatar David S. Miller

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: default avatarDavid S. Miller <davem@davemloft.net>
parents 1ddee6d8 168f7a16
...@@ -29,7 +29,7 @@ struct gmii2rgmii { ...@@ -29,7 +29,7 @@ struct gmii2rgmii {
static int xgmiitorgmii_read_status(struct phy_device *phydev) 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; struct mii_bus *bus = priv->mdio->bus;
int addr = priv->mdio->addr; int addr = priv->mdio->addr;
u16 val = 0; u16 val = 0;
...@@ -90,7 +90,7 @@ static int xgmiitorgmii_probe(struct mdio_device *mdiodev) ...@@ -90,7 +90,7 @@ static int xgmiitorgmii_probe(struct mdio_device *mdiodev)
memcpy(&priv->conv_phy_drv, priv->phy_dev->drv, memcpy(&priv->conv_phy_drv, priv->phy_dev->drv,
sizeof(struct phy_driver)); sizeof(struct phy_driver));
priv->conv_phy_drv.read_status = xgmiitorgmii_read_status; 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; priv->phy_dev->drv = &priv->conv_phy_drv;
return 0; return 0;
......
...@@ -68,6 +68,17 @@ struct mdio_driver { ...@@ -68,6 +68,17 @@ struct mdio_driver {
#define to_mdio_driver(d) \ #define to_mdio_driver(d) \
container_of(to_mdio_common_driver(d), struct mdio_driver, mdiodrv) 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); void mdio_device_free(struct mdio_device *mdiodev);
struct mdio_device *mdio_device_create(struct mii_bus *bus, int addr); struct mdio_device *mdio_device_create(struct mii_bus *bus, int addr);
int mdio_device_register(struct mdio_device *mdiodev); int mdio_device_register(struct mdio_device *mdiodev);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment