Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b0ec7585 authored by David S. Miller's avatar David S. Miller
Browse files

Merge branch 'of-mdio-Fall-back-to-mdiobus_register-with-NULL-device_node'



Florian Fainelli says:

====================
of: mdio: Fall back to mdiobus_register() with NULL device_node

This patch series updates of_mdiobus_register() such that when the device_node
argument is NULL, it calls mdiobus_register() directly. This is consistent with
the behavior of of_mdiobus_register() when CONFIG_OF=n.

I only converted the most obvious drivers, there are others that have a much
less obvious behavior and specifically attempt to deal with CONFIG_ACPI.

Changes in v2:

- fixed build error in davincin_mdio.c (Grygorii)
- reworked first patch a bit: commit message, subject and removed useless
  code comment
====================

Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents c6213eb1 00e798c7
Loading
Loading
Loading
Loading
+2 −6
Original line number Diff line number Diff line
@@ -450,12 +450,8 @@ static int bcm_sf2_mdio_register(struct dsa_switch *ds)
	priv->slave_mii_bus->parent = ds->dev->parent;
	priv->slave_mii_bus->phy_mask = ~priv->indir_phy_mask;

	if (dn)
	err = of_mdiobus_register(priv->slave_mii_bus, dn);
	else
		err = mdiobus_register(priv->slave_mii_bus);

	if (err)
	if (err && dn)
		of_node_put(dn);

	return err;
+1 −4
Original line number Diff line number Diff line
@@ -2454,10 +2454,7 @@ static int mv88e6xxx_mdio_register(struct mv88e6xxx_chip *chip,
			return err;
	}

	if (np)
	err = of_mdiobus_register(bus, np);
	else
		err = mdiobus_register(bus);
	if (err) {
		dev_err(chip->dev, "Cannot register MDIO bus (%d)\n", err);
		mv88e6xxx_g2_irq_mdio_free(chip, bus);
+3 −9
Original line number Diff line number Diff line
@@ -591,16 +591,10 @@ static int macb_mii_init(struct macb *bp)
	dev_set_drvdata(&bp->dev->dev, bp->mii_bus);

	np = bp->pdev->dev.of_node;

	if (np) {
		err = of_mdiobus_register(bp->mii_bus, np);
	} else {
	if (pdata)
		bp->mii_bus->phy_mask = pdata->phy_mask;

		err = mdiobus_register(bp->mii_bus);
	}

	err = of_mdiobus_register(bp->mii_bus, np);
	if (err)
		goto err_out_free_mdiobus;

+2 −6
Original line number Diff line number Diff line
@@ -2052,13 +2052,9 @@ static int fec_enet_mii_init(struct platform_device *pdev)
	fep->mii_bus->parent = &pdev->dev;

	node = of_get_child_by_name(pdev->dev.of_node, "mdio");
	if (node) {
	err = of_mdiobus_register(fep->mii_bus, node);
	if (node)
		of_node_put(node);
	} else {
		err = mdiobus_register(fep->mii_bus);
	}

	if (err)
		goto err_out_free_mdiobus;

+1 −4
Original line number Diff line number Diff line
@@ -348,10 +348,7 @@ static int orion_mdio_probe(struct platform_device *pdev)
		goto out_mdio;
	}

	if (pdev->dev.of_node)
	ret = of_mdiobus_register(bus, pdev->dev.of_node);
	else
		ret = mdiobus_register(bus);
	if (ret < 0) {
		dev_err(&pdev->dev, "Cannot register MDIO bus (%d)\n", ret);
		goto out_mdio;
Loading