mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-26 16:41:25 +00:00
phylib: two dynamic mii_bus allocation fallout fixes
1. arch/powerpc/platforms/pasemi/gpio_mdio.c also needs to be converted over to mdiobus_{alloc,free}(). 2. drivers/net/phy/fixed.c used to embed a struct mii_bus into its struct fixed_mdio_bus and then use container_of() to go from the former to the latter. Since mii bus structures are no longer embedded, we need to do something like use the mii bus private pointer to go from mii_bus to fixed_mdio_bus instead. Signed-off-by: Lennert Buytenhek <buytenh@marvell.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
724f880576
commit
ec2a5652ea
2 changed files with 4 additions and 4 deletions
|
@ -230,7 +230,7 @@ static int __devinit gpio_mdio_probe(struct of_device *ofdev,
|
||||||
if (!priv)
|
if (!priv)
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
new_bus = kzalloc(sizeof(struct mii_bus), GFP_KERNEL);
|
new_bus = mdiobus_alloc();
|
||||||
|
|
||||||
if (!new_bus)
|
if (!new_bus)
|
||||||
goto out_free_priv;
|
goto out_free_priv;
|
||||||
|
@ -306,7 +306,7 @@ static int gpio_mdio_remove(struct of_device *dev)
|
||||||
|
|
||||||
kfree(bus->priv);
|
kfree(bus->priv);
|
||||||
bus->priv = NULL;
|
bus->priv = NULL;
|
||||||
kfree(bus);
|
mdiobus_free(bus);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -115,8 +115,7 @@ static int fixed_phy_update_regs(struct fixed_phy *fp)
|
||||||
|
|
||||||
static int fixed_mdio_read(struct mii_bus *bus, int phy_id, int reg_num)
|
static int fixed_mdio_read(struct mii_bus *bus, int phy_id, int reg_num)
|
||||||
{
|
{
|
||||||
struct fixed_mdio_bus *fmb = container_of(bus, struct fixed_mdio_bus,
|
struct fixed_mdio_bus *fmb = bus->priv;
|
||||||
mii_bus);
|
|
||||||
struct fixed_phy *fp;
|
struct fixed_phy *fp;
|
||||||
|
|
||||||
if (reg_num >= MII_REGS_NUM)
|
if (reg_num >= MII_REGS_NUM)
|
||||||
|
@ -221,6 +220,7 @@ static int __init fixed_mdio_bus_init(void)
|
||||||
|
|
||||||
snprintf(fmb->mii_bus->id, MII_BUS_ID_SIZE, "0");
|
snprintf(fmb->mii_bus->id, MII_BUS_ID_SIZE, "0");
|
||||||
fmb->mii_bus->name = "Fixed MDIO Bus";
|
fmb->mii_bus->name = "Fixed MDIO Bus";
|
||||||
|
fmb->mii_bus->priv = fmb;
|
||||||
fmb->mii_bus->parent = &pdev->dev;
|
fmb->mii_bus->parent = &pdev->dev;
|
||||||
fmb->mii_bus->read = &fixed_mdio_read;
|
fmb->mii_bus->read = &fixed_mdio_read;
|
||||||
fmb->mii_bus->write = &fixed_mdio_write;
|
fmb->mii_bus->write = &fixed_mdio_write;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue