Re: [PATCH net-next 2/2] drivers: net: Remove device_node checks with of_mdiobus_register()
From: Florian Fainelli
Date: Tue May 15 2018 - 19:00:48 EST
On 05/15/2018 03:57 PM, Grygorii Strashko wrote:
>
>
> On 05/15/2018 04:59 PM, Florian Fainelli wrote:
>> A number of drivers have the following pattern:
>>
>> if (np)
>> ÂÂÂÂof_mdiobus_register()
>> else
>> ÂÂÂÂmdiobus_register()
>>
>> which the implementation of of_mdiobus_register() now takes care of.
>> Remove that pattern in drivers that strictly adhere to it.
>>
>> Signed-off-by: Florian Fainelli <f.fainelli@xxxxxxxxx>
>> ---
>> Â drivers/net/dsa/bcm_sf2.cÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ |Â 8 ++------
>> Â drivers/net/dsa/mv88e6xxx/chip.cÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ |Â 5 +----
>> Â drivers/net/ethernet/cadence/macb_main.cÂÂÂÂÂÂÂÂÂ | 12 +++---------
>> Â drivers/net/ethernet/freescale/fec_main.cÂÂÂÂÂÂÂÂ |Â 8 ++------
>> Â drivers/net/ethernet/marvell/mvmdio.cÂÂÂÂÂÂÂÂÂÂÂÂ |Â 5 +----
>> Â drivers/net/ethernet/renesas/sh_eth.cÂÂÂÂÂÂÂÂÂÂÂÂ | 11 +++--------
>> Â drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c |Â 5 +----
>> Â drivers/net/ethernet/ti/davinci_mdio.cÂÂÂÂÂÂÂÂÂÂÂ |Â 6 ++----
>> Â drivers/net/phy/mdio-gpio.cÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ |Â 6 +-----
>> Â drivers/net/phy/mdio-mscc-miim.cÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ |Â 6 +-----
>> Â drivers/net/usb/lan78xx.cÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ |Â 7 ++-----
>> Â 11 files changed, 19 insertions(+), 60 deletions(-)
>>
>
> ...
>
>> ÂÂÂÂÂÂÂÂÂ goto bus_register_fail;
>> diff --git a/drivers/net/ethernet/ti/davinci_mdio.c
>> b/drivers/net/ethernet/ti/davinci_mdio.c
>> index 98a1c97fb95e..e720244e7f71 100644
>> --- a/drivers/net/ethernet/ti/davinci_mdio.c
>> +++ b/drivers/net/ethernet/ti/davinci_mdio.c
>> @@ -431,10 +431,8 @@ static int davinci_mdio_probe(struct
>> platform_device *pdev)
>> ÂÂÂÂÂÂ */
>> ÂÂÂÂÂ if (dev->of_node && of_get_child_count(dev->of_node)) {
>
> It causes build error due to "{" above.
Humpf, shame on me for not enabling that driver, thanks for catching this!
>
>> ÂÂÂÂÂÂÂÂÂ data->skip_scan = true;
>> -ÂÂÂÂÂÂÂ ret = of_mdiobus_register(data->bus, dev->of_node);
>> -ÂÂÂ } else {
>> -ÂÂÂÂÂÂÂ ret = mdiobus_register(data->bus);
>> -ÂÂÂ }
>> +
>> +ÂÂÂ ret = of_mdiobus_register(data->bus, dev->of_node);
>> ÂÂÂÂÂ if (ret)
>> ÂÂÂÂÂÂÂÂÂ goto bail_out;
>> Â diff --git a/drivers/net/phy/mdio-gpio.c b/drivers/net/phy/mdio-gpio.c
>> index b501221819e1..4e4c8daf44c3 100644
>> --- a/drivers/net/phy/mdio-gpio.c
>> +++ b/drivers/net/phy/mdio-gpio.c
>> @@ -179,11 +179,7 @@ static int mdio_gpio_probe(struct platform_device
>> *pdev)
>
> [...]
>
--
Florian