diff mbox series

[3/4] net: macb: Support specifying PHYs in a mdio container dts node

Message ID 20180820121238.7779-3-a.fatoum@pengutronix.de
State Changes Requested, archived
Delegated to: David Miller
Headers show
Series [1/4] net: macb: Fix regression breaking non-MDIO fixed-link PHYs | expand

Commit Message

Ahmad Fatoum Aug. 20, 2018, 12:12 p.m. UTC
To align macb DT entries with those of other MACs.
For backwards compatibility, the old way remains supported.

Suggested-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 drivers/net/ethernet/cadence/macb_main.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Andrew Lunn Aug. 20, 2018, 1:42 p.m. UTC | #1
On Mon, Aug 20, 2018 at 02:12:37PM +0200, Ahmad Fatoum wrote:
> To align macb DT entries with those of other MACs.
> For backwards compatibility, the old way remains supported.
> 
> Suggested-by: Andrew Lunn <andrew@lunn.ch>
> Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
> ---
>  drivers/net/ethernet/cadence/macb_main.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/ethernet/cadence/macb_main.c b/drivers/net/ethernet/cadence/macb_main.c
> index ef6ce8691443..2ebc5698db9d 100644
> --- a/drivers/net/ethernet/cadence/macb_main.c
> +++ b/drivers/net/ethernet/cadence/macb_main.c
> @@ -596,10 +596,10 @@ static int macb_mii_init(struct macb *bp)
>  
>  		err = mdiobus_register(bp->mii_bus);
>  	} else {
> +		struct device_node *node = of_get_child_by_name(np, "mdio") ?: np;

This is correct. But i would prefer the more readable

		struct device_node *node = of_get_child_by_name(np, "mdio");

		if (!node)
   			/* Allow for the deprecated PHYs in the MAC node. */
   			node = np;

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

Also, the device tree binding documentation needs updating.

Thanks
	Andrew
Ahmad Fatoum Aug. 20, 2018, 1:45 p.m. UTC | #2
On 08/20/2018 03:42 PM, Andrew Lunn wrote:
> On Mon, Aug 20, 2018 at 02:12:37PM +0200, Ahmad Fatoum wrote:
> This is correct. But i would prefer the more readable
> 
> 		struct device_node *node = of_get_child_by_name(np, "mdio");
> 
> 		if (!node)
>    			/* Allow for the deprecated PHYs in the MAC node. */
>    			node = np;
> 
>>  		if (pdata)
>>  			bp->mii_bus->phy_mask = pdata->phy_mask;
>> -
>> -		err = of_mdiobus_register(bp->mii_bus, np);
>> +		err = of_mdiobus_register(bp->mii_bus, node);
>>  	}

Ok.

> Also, the device tree binding documentation needs updating.

I've done so in part 4/4.
Andrew Lunn Aug. 20, 2018, 1:56 p.m. UTC | #3
> I've done so in part 4/4.

Yes, i noticed that later. Ideally, it would be here, since this is
the patch which actually changes the binding.

    Andrew
diff mbox series

Patch

diff --git a/drivers/net/ethernet/cadence/macb_main.c b/drivers/net/ethernet/cadence/macb_main.c
index ef6ce8691443..2ebc5698db9d 100644
--- a/drivers/net/ethernet/cadence/macb_main.c
+++ b/drivers/net/ethernet/cadence/macb_main.c
@@ -596,10 +596,10 @@  static int macb_mii_init(struct macb *bp)
 
 		err = mdiobus_register(bp->mii_bus);
 	} else {
+		struct device_node *node = of_get_child_by_name(np, "mdio") ?: np;
 		if (pdata)
 			bp->mii_bus->phy_mask = pdata->phy_mask;
-
-		err = of_mdiobus_register(bp->mii_bus, np);
+		err = of_mdiobus_register(bp->mii_bus, node);
 	}
 
 	if (err)