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

From: Andrew Lunn <[email-masked]>
Date: Mon, 20 Aug 2018 15:42:34 +0200

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 <[email-masked]>
> Signed-off-by: Ahmad Fatoum <[email-masked]>
> ---
>  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