diff mbox

[net-next,2/2] drivers: net: Remove device_node checks with of_mdiobus_register()

Message ID 20180515215930.12115-3-f.fainelli@gmail.com (mailing list archive)
State New, archived
Headers show

Commit Message

Florian Fainelli May 15, 2018, 9:59 p.m. UTC
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@gmail.com>
---
 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(-)

Comments

Grygorii Strashko May 15, 2018, 10:57 p.m. UTC | #1
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@gmail.com>
> ---
>   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.

>   		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 Fainelli May 15, 2018, 10:59 p.m. UTC | #2
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@gmail.com>
>> ---
>>   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)
> 
> [...]
>
kernel test robot May 16, 2018, 4:33 p.m. UTC | #3
Hi Florian,

I love your patch! Yet something to improve:

[auto build test ERROR on net-next/master]

url:    https://github.com/0day-ci/linux/commits/Florian-Fainelli/of-mdio-Fall-back-to-mdiobus_register-with-np-is-NULL/20180516-203317
config: arm-allmodconfig (attached as .config)
compiler: arm-linux-gnueabi-gcc (Debian 7.2.0-11) 7.2.0
reproduce:
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        make.cross ARCH=arm 

All error/warnings (new ones prefixed by >>):

     .runtime_suspend = suspend_fn, \
                        ^~~~~~~~~~
   drivers/net//ethernet/ti/davinci_mdio.c:527:21: note: (near initialization for 'davinci_mdio_pm_ops.runtime_suspend')
     SET_RUNTIME_PM_OPS(davinci_mdio_runtime_suspend,
                        ^
   include/linux/pm.h:354:21: note: in definition of macro 'SET_RUNTIME_PM_OPS'
     .runtime_suspend = suspend_fn, \
                        ^~~~~~~~~~
   drivers/net//ethernet/ti/davinci_mdio.c:528:7: error: initializer element is not constant
          davinci_mdio_runtime_resume, NULL)
          ^
   include/linux/pm.h:355:20: note: in definition of macro 'SET_RUNTIME_PM_OPS'
     .runtime_resume = resume_fn, \
                       ^~~~~~~~~
   drivers/net//ethernet/ti/davinci_mdio.c:528:7: note: (near initialization for 'davinci_mdio_pm_ops.runtime_resume')
          davinci_mdio_runtime_resume, NULL)
          ^
   include/linux/pm.h:355:20: note: in definition of macro 'SET_RUNTIME_PM_OPS'
     .runtime_resume = resume_fn, \
                       ^~~~~~~~~
   drivers/net//ethernet/ti/davinci_mdio.c:529:31: error: initializer element is not constant
     SET_LATE_SYSTEM_SLEEP_PM_OPS(davinci_mdio_suspend, davinci_mdio_resume)
                                  ^
   include/linux/pm.h:330:18: note: in definition of macro 'SET_LATE_SYSTEM_SLEEP_PM_OPS'
     .suspend_late = suspend_fn, \
                     ^~~~~~~~~~
   drivers/net//ethernet/ti/davinci_mdio.c:529:31: note: (near initialization for 'davinci_mdio_pm_ops.suspend_late')
     SET_LATE_SYSTEM_SLEEP_PM_OPS(davinci_mdio_suspend, davinci_mdio_resume)
                                  ^
   include/linux/pm.h:330:18: note: in definition of macro 'SET_LATE_SYSTEM_SLEEP_PM_OPS'
     .suspend_late = suspend_fn, \
                     ^~~~~~~~~~
   drivers/net//ethernet/ti/davinci_mdio.c:529:53: error: initializer element is not constant
     SET_LATE_SYSTEM_SLEEP_PM_OPS(davinci_mdio_suspend, davinci_mdio_resume)
                                                        ^
   include/linux/pm.h:331:18: note: in definition of macro 'SET_LATE_SYSTEM_SLEEP_PM_OPS'
     .resume_early = resume_fn, \
                     ^~~~~~~~~
   drivers/net//ethernet/ti/davinci_mdio.c:529:53: note: (near initialization for 'davinci_mdio_pm_ops.resume_early')
     SET_LATE_SYSTEM_SLEEP_PM_OPS(davinci_mdio_suspend, davinci_mdio_resume)
                                                        ^
   include/linux/pm.h:331:18: note: in definition of macro 'SET_LATE_SYSTEM_SLEEP_PM_OPS'
     .resume_early = resume_fn, \
                     ^~~~~~~~~
   drivers/net//ethernet/ti/davinci_mdio.c:529:31: error: initializer element is not constant
     SET_LATE_SYSTEM_SLEEP_PM_OPS(davinci_mdio_suspend, davinci_mdio_resume)
                                  ^
   include/linux/pm.h:332:17: note: in definition of macro 'SET_LATE_SYSTEM_SLEEP_PM_OPS'
     .freeze_late = suspend_fn, \
                    ^~~~~~~~~~
   drivers/net//ethernet/ti/davinci_mdio.c:529:31: note: (near initialization for 'davinci_mdio_pm_ops.freeze_late')
     SET_LATE_SYSTEM_SLEEP_PM_OPS(davinci_mdio_suspend, davinci_mdio_resume)
                                  ^
   include/linux/pm.h:332:17: note: in definition of macro 'SET_LATE_SYSTEM_SLEEP_PM_OPS'
     .freeze_late = suspend_fn, \
                    ^~~~~~~~~~
   drivers/net//ethernet/ti/davinci_mdio.c:529:53: error: initializer element is not constant
     SET_LATE_SYSTEM_SLEEP_PM_OPS(davinci_mdio_suspend, davinci_mdio_resume)
                                                        ^
   include/linux/pm.h:333:16: note: in definition of macro 'SET_LATE_SYSTEM_SLEEP_PM_OPS'
     .thaw_early = resume_fn, \
                   ^~~~~~~~~
   drivers/net//ethernet/ti/davinci_mdio.c:529:53: note: (near initialization for 'davinci_mdio_pm_ops.thaw_early')
     SET_LATE_SYSTEM_SLEEP_PM_OPS(davinci_mdio_suspend, davinci_mdio_resume)
                                                        ^
   include/linux/pm.h:333:16: note: in definition of macro 'SET_LATE_SYSTEM_SLEEP_PM_OPS'
     .thaw_early = resume_fn, \
                   ^~~~~~~~~
   drivers/net//ethernet/ti/davinci_mdio.c:529:31: error: initializer element is not constant
     SET_LATE_SYSTEM_SLEEP_PM_OPS(davinci_mdio_suspend, davinci_mdio_resume)
                                  ^
   include/linux/pm.h:334:19: note: in definition of macro 'SET_LATE_SYSTEM_SLEEP_PM_OPS'
     .poweroff_late = suspend_fn, \
                      ^~~~~~~~~~
   drivers/net//ethernet/ti/davinci_mdio.c:529:31: note: (near initialization for 'davinci_mdio_pm_ops.poweroff_late')
     SET_LATE_SYSTEM_SLEEP_PM_OPS(davinci_mdio_suspend, davinci_mdio_resume)
                                  ^
   include/linux/pm.h:334:19: note: in definition of macro 'SET_LATE_SYSTEM_SLEEP_PM_OPS'
     .poweroff_late = suspend_fn, \
                      ^~~~~~~~~~
   drivers/net//ethernet/ti/davinci_mdio.c:529:53: error: initializer element is not constant
     SET_LATE_SYSTEM_SLEEP_PM_OPS(davinci_mdio_suspend, davinci_mdio_resume)
                                                        ^
   include/linux/pm.h:335:19: note: in definition of macro 'SET_LATE_SYSTEM_SLEEP_PM_OPS'
     .restore_early = resume_fn,
                      ^~~~~~~~~
   drivers/net//ethernet/ti/davinci_mdio.c:529:53: note: (near initialization for 'davinci_mdio_pm_ops.restore_early')
     SET_LATE_SYSTEM_SLEEP_PM_OPS(davinci_mdio_suspend, davinci_mdio_resume)
                                                        ^
   include/linux/pm.h:335:19: note: in definition of macro 'SET_LATE_SYSTEM_SLEEP_PM_OPS'
     .restore_early = resume_fn,
                      ^~~~~~~~~
   drivers/net//ethernet/ti/davinci_mdio.c:539:12: error: initializer element is not constant
     .remove = davinci_mdio_remove,
               ^~~~~~~~~~~~~~~~~~~
   drivers/net//ethernet/ti/davinci_mdio.c:539:12: note: (near initialization for 'davinci_mdio_driver.remove')
   drivers/net//ethernet/ti/davinci_mdio.c:542:19: error: invalid storage class for function 'davinci_mdio_init'
    static int __init davinci_mdio_init(void)
                      ^~~~~~~~~~~~~~~~~
   In file included from drivers/net//ethernet/ti/davinci_mdio.c:27:0:
>> include/linux/module.h:130:42: error: invalid storage class for function '__inittest'
     static inline initcall_t __maybe_unused __inittest(void)  \
                                             ^
   include/linux/module.h:120:30: note: in expansion of macro 'module_init'
    #define device_initcall(fn)  module_init(fn)
                                 ^~~~~~~~~~~
   drivers/net//ethernet/ti/davinci_mdio.c:546:1: note: in expansion of macro 'device_initcall'
    device_initcall(davinci_mdio_init);
    ^~~~~~~~~~~~~~~
>> drivers/net//ethernet/ti/davinci_mdio.c:546:1: warning: 'alias' attribute ignored [-Wattributes]
   drivers/net//ethernet/ti/davinci_mdio.c:548:20: error: invalid storage class for function 'davinci_mdio_exit'
    static void __exit davinci_mdio_exit(void)
                       ^~~~~~~~~~~~~~~~~
   drivers/net//ethernet/ti/davinci_mdio.c:548:1: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
    static void __exit davinci_mdio_exit(void)
    ^~~~~~
   In file included from drivers/net//ethernet/ti/davinci_mdio.c:27:0:
>> include/linux/module.h:136:42: error: invalid storage class for function '__exittest'
     static inline exitcall_t __maybe_unused __exittest(void)  \
                                             ^
   drivers/net//ethernet/ti/davinci_mdio.c:552:1: note: in expansion of macro 'module_exit'
    module_exit(davinci_mdio_exit);
    ^~~~~~~~~~~
   drivers/net//ethernet/ti/davinci_mdio.c:552:1: warning: 'alias' attribute ignored [-Wattributes]
   In file included from include/linux/module.h:18:0,
                    from drivers/net//ethernet/ti/davinci_mdio.c:27:
   include/linux/moduleparam.h:22:1: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
    static const char __UNIQUE_ID(name)[]       \
    ^
   include/linux/module.h:161:32: note: in expansion of macro '__MODULE_INFO'
    #define MODULE_INFO(tag, info) __MODULE_INFO(tag, tag, info)
                                   ^~~~~~~~~~~~~
   include/linux/module.h:199:34: note: in expansion of macro 'MODULE_INFO'
    #define MODULE_LICENSE(_license) MODULE_INFO(license, _license)
                                     ^~~~~~~~~~~
   drivers/net//ethernet/ti/davinci_mdio.c:554:1: note: in expansion of macro 'MODULE_LICENSE'
    MODULE_LICENSE("GPL");
    ^~~~~~~~~~~~~~
>> drivers/net//ethernet/ti/davinci_mdio.c:555:1: error: expected declaration or statement at end of input
    MODULE_DESCRIPTION("DaVinci MDIO driver");
    ^~~~~~~~~~~~~~~~~~
   At top level:
   drivers/net//ethernet/ti/davinci_mdio.c:357:12: warning: 'davinci_mdio_probe' defined but not used [-Wunused-function]
    static int davinci_mdio_probe(struct platform_device *pdev)
               ^~~~~~~~~~~~~~~~~~
--
     .runtime_suspend = suspend_fn, \
                        ^~~~~~~~~~
   drivers/net/ethernet/ti/davinci_mdio.c:527:21: note: (near initialization for 'davinci_mdio_pm_ops.runtime_suspend')
     SET_RUNTIME_PM_OPS(davinci_mdio_runtime_suspend,
                        ^
   include/linux/pm.h:354:21: note: in definition of macro 'SET_RUNTIME_PM_OPS'
     .runtime_suspend = suspend_fn, \
                        ^~~~~~~~~~
   drivers/net/ethernet/ti/davinci_mdio.c:528:7: error: initializer element is not constant
          davinci_mdio_runtime_resume, NULL)
          ^
   include/linux/pm.h:355:20: note: in definition of macro 'SET_RUNTIME_PM_OPS'
     .runtime_resume = resume_fn, \
                       ^~~~~~~~~
   drivers/net/ethernet/ti/davinci_mdio.c:528:7: note: (near initialization for 'davinci_mdio_pm_ops.runtime_resume')
          davinci_mdio_runtime_resume, NULL)
          ^
   include/linux/pm.h:355:20: note: in definition of macro 'SET_RUNTIME_PM_OPS'
     .runtime_resume = resume_fn, \
                       ^~~~~~~~~
   drivers/net/ethernet/ti/davinci_mdio.c:529:31: error: initializer element is not constant
     SET_LATE_SYSTEM_SLEEP_PM_OPS(davinci_mdio_suspend, davinci_mdio_resume)
                                  ^
   include/linux/pm.h:330:18: note: in definition of macro 'SET_LATE_SYSTEM_SLEEP_PM_OPS'
     .suspend_late = suspend_fn, \
                     ^~~~~~~~~~
   drivers/net/ethernet/ti/davinci_mdio.c:529:31: note: (near initialization for 'davinci_mdio_pm_ops.suspend_late')
     SET_LATE_SYSTEM_SLEEP_PM_OPS(davinci_mdio_suspend, davinci_mdio_resume)
                                  ^
   include/linux/pm.h:330:18: note: in definition of macro 'SET_LATE_SYSTEM_SLEEP_PM_OPS'
     .suspend_late = suspend_fn, \
                     ^~~~~~~~~~
   drivers/net/ethernet/ti/davinci_mdio.c:529:53: error: initializer element is not constant
     SET_LATE_SYSTEM_SLEEP_PM_OPS(davinci_mdio_suspend, davinci_mdio_resume)
                                                        ^
   include/linux/pm.h:331:18: note: in definition of macro 'SET_LATE_SYSTEM_SLEEP_PM_OPS'
     .resume_early = resume_fn, \
                     ^~~~~~~~~
   drivers/net/ethernet/ti/davinci_mdio.c:529:53: note: (near initialization for 'davinci_mdio_pm_ops.resume_early')
     SET_LATE_SYSTEM_SLEEP_PM_OPS(davinci_mdio_suspend, davinci_mdio_resume)
                                                        ^
   include/linux/pm.h:331:18: note: in definition of macro 'SET_LATE_SYSTEM_SLEEP_PM_OPS'
     .resume_early = resume_fn, \
                     ^~~~~~~~~
   drivers/net/ethernet/ti/davinci_mdio.c:529:31: error: initializer element is not constant
     SET_LATE_SYSTEM_SLEEP_PM_OPS(davinci_mdio_suspend, davinci_mdio_resume)
                                  ^
   include/linux/pm.h:332:17: note: in definition of macro 'SET_LATE_SYSTEM_SLEEP_PM_OPS'
     .freeze_late = suspend_fn, \
                    ^~~~~~~~~~
   drivers/net/ethernet/ti/davinci_mdio.c:529:31: note: (near initialization for 'davinci_mdio_pm_ops.freeze_late')
     SET_LATE_SYSTEM_SLEEP_PM_OPS(davinci_mdio_suspend, davinci_mdio_resume)
                                  ^
   include/linux/pm.h:332:17: note: in definition of macro 'SET_LATE_SYSTEM_SLEEP_PM_OPS'
     .freeze_late = suspend_fn, \
                    ^~~~~~~~~~
   drivers/net/ethernet/ti/davinci_mdio.c:529:53: error: initializer element is not constant
     SET_LATE_SYSTEM_SLEEP_PM_OPS(davinci_mdio_suspend, davinci_mdio_resume)
                                                        ^
   include/linux/pm.h:333:16: note: in definition of macro 'SET_LATE_SYSTEM_SLEEP_PM_OPS'
     .thaw_early = resume_fn, \
                   ^~~~~~~~~
   drivers/net/ethernet/ti/davinci_mdio.c:529:53: note: (near initialization for 'davinci_mdio_pm_ops.thaw_early')
     SET_LATE_SYSTEM_SLEEP_PM_OPS(davinci_mdio_suspend, davinci_mdio_resume)
                                                        ^
   include/linux/pm.h:333:16: note: in definition of macro 'SET_LATE_SYSTEM_SLEEP_PM_OPS'
     .thaw_early = resume_fn, \
                   ^~~~~~~~~
   drivers/net/ethernet/ti/davinci_mdio.c:529:31: error: initializer element is not constant
     SET_LATE_SYSTEM_SLEEP_PM_OPS(davinci_mdio_suspend, davinci_mdio_resume)
                                  ^
   include/linux/pm.h:334:19: note: in definition of macro 'SET_LATE_SYSTEM_SLEEP_PM_OPS'
     .poweroff_late = suspend_fn, \
                      ^~~~~~~~~~
   drivers/net/ethernet/ti/davinci_mdio.c:529:31: note: (near initialization for 'davinci_mdio_pm_ops.poweroff_late')
     SET_LATE_SYSTEM_SLEEP_PM_OPS(davinci_mdio_suspend, davinci_mdio_resume)
                                  ^
   include/linux/pm.h:334:19: note: in definition of macro 'SET_LATE_SYSTEM_SLEEP_PM_OPS'
     .poweroff_late = suspend_fn, \
                      ^~~~~~~~~~
   drivers/net/ethernet/ti/davinci_mdio.c:529:53: error: initializer element is not constant
     SET_LATE_SYSTEM_SLEEP_PM_OPS(davinci_mdio_suspend, davinci_mdio_resume)
                                                        ^
   include/linux/pm.h:335:19: note: in definition of macro 'SET_LATE_SYSTEM_SLEEP_PM_OPS'
     .restore_early = resume_fn,
                      ^~~~~~~~~
   drivers/net/ethernet/ti/davinci_mdio.c:529:53: note: (near initialization for 'davinci_mdio_pm_ops.restore_early')
     SET_LATE_SYSTEM_SLEEP_PM_OPS(davinci_mdio_suspend, davinci_mdio_resume)
                                                        ^
   include/linux/pm.h:335:19: note: in definition of macro 'SET_LATE_SYSTEM_SLEEP_PM_OPS'
     .restore_early = resume_fn,
                      ^~~~~~~~~
   drivers/net/ethernet/ti/davinci_mdio.c:539:12: error: initializer element is not constant
     .remove = davinci_mdio_remove,
               ^~~~~~~~~~~~~~~~~~~
   drivers/net/ethernet/ti/davinci_mdio.c:539:12: note: (near initialization for 'davinci_mdio_driver.remove')
   drivers/net/ethernet/ti/davinci_mdio.c:542:19: error: invalid storage class for function 'davinci_mdio_init'
    static int __init davinci_mdio_init(void)
                      ^~~~~~~~~~~~~~~~~
   In file included from drivers/net/ethernet/ti/davinci_mdio.c:27:0:
>> include/linux/module.h:130:42: error: invalid storage class for function '__inittest'
     static inline initcall_t __maybe_unused __inittest(void)  \
                                             ^
   include/linux/module.h:120:30: note: in expansion of macro 'module_init'
    #define device_initcall(fn)  module_init(fn)
                                 ^~~~~~~~~~~
   drivers/net/ethernet/ti/davinci_mdio.c:546:1: note: in expansion of macro 'device_initcall'
    device_initcall(davinci_mdio_init);
    ^~~~~~~~~~~~~~~
   drivers/net/ethernet/ti/davinci_mdio.c:546:1: warning: 'alias' attribute ignored [-Wattributes]
   drivers/net/ethernet/ti/davinci_mdio.c:548:20: error: invalid storage class for function 'davinci_mdio_exit'
    static void __exit davinci_mdio_exit(void)
                       ^~~~~~~~~~~~~~~~~
   drivers/net/ethernet/ti/davinci_mdio.c:548:1: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
    static void __exit davinci_mdio_exit(void)
    ^~~~~~
   In file included from drivers/net/ethernet/ti/davinci_mdio.c:27:0:
>> include/linux/module.h:136:42: error: invalid storage class for function '__exittest'
     static inline exitcall_t __maybe_unused __exittest(void)  \
                                             ^
   drivers/net/ethernet/ti/davinci_mdio.c:552:1: note: in expansion of macro 'module_exit'
    module_exit(davinci_mdio_exit);
    ^~~~~~~~~~~
   drivers/net/ethernet/ti/davinci_mdio.c:552:1: warning: 'alias' attribute ignored [-Wattributes]
   In file included from include/linux/module.h:18:0,
                    from drivers/net/ethernet/ti/davinci_mdio.c:27:
   include/linux/moduleparam.h:22:1: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
    static const char __UNIQUE_ID(name)[]       \
    ^
   include/linux/module.h:161:32: note: in expansion of macro '__MODULE_INFO'
    #define MODULE_INFO(tag, info) __MODULE_INFO(tag, tag, info)
                                   ^~~~~~~~~~~~~
   include/linux/module.h:199:34: note: in expansion of macro 'MODULE_INFO'
    #define MODULE_LICENSE(_license) MODULE_INFO(license, _license)
                                     ^~~~~~~~~~~
   drivers/net/ethernet/ti/davinci_mdio.c:554:1: note: in expansion of macro 'MODULE_LICENSE'
    MODULE_LICENSE("GPL");
    ^~~~~~~~~~~~~~
   drivers/net/ethernet/ti/davinci_mdio.c:555:1: error: expected declaration or statement at end of input
    MODULE_DESCRIPTION("DaVinci MDIO driver");
    ^~~~~~~~~~~~~~~~~~
   At top level:
   drivers/net/ethernet/ti/davinci_mdio.c:357:12: warning: 'davinci_mdio_probe' defined but not used [-Wunused-function]
    static int davinci_mdio_probe(struct platform_device *pdev)
               ^~~~~~~~~~~~~~~~~~

vim +/__inittest +130 include/linux/module.h

0fd972a7 Paul Gortmaker 2015-05-01  127  
0fd972a7 Paul Gortmaker 2015-05-01  128  /* Each module must use one module_init(). */
0fd972a7 Paul Gortmaker 2015-05-01  129  #define module_init(initfn)					\
1f318a8b Arnd Bergmann  2017-02-01 @130  	static inline initcall_t __maybe_unused __inittest(void)		\
0fd972a7 Paul Gortmaker 2015-05-01  131  	{ return initfn; }					\
0fd972a7 Paul Gortmaker 2015-05-01  132  	int init_module(void) __attribute__((alias(#initfn)));
0fd972a7 Paul Gortmaker 2015-05-01  133  
0fd972a7 Paul Gortmaker 2015-05-01  134  /* This is only required if you want to be unloadable. */
0fd972a7 Paul Gortmaker 2015-05-01  135  #define module_exit(exitfn)					\
1f318a8b Arnd Bergmann  2017-02-01 @136  	static inline exitcall_t __maybe_unused __exittest(void)		\
0fd972a7 Paul Gortmaker 2015-05-01  137  	{ return exitfn; }					\
0fd972a7 Paul Gortmaker 2015-05-01  138  	void cleanup_module(void) __attribute__((alias(#exitfn)));
0fd972a7 Paul Gortmaker 2015-05-01  139  

:::::: The code at line 130 was first introduced by commit
:::::: 1f318a8bafcfba9f0d623f4870c4e890fd22e659 modules: mark __inittest/__exittest as __maybe_unused

:::::: TO: Arnd Bergmann <arnd@arndb.de>
:::::: CC: Jessica Yu <jeyu@redhat.com>

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
kernel test robot May 16, 2018, 5:05 p.m. UTC | #4
Hi Florian,

I love your patch! Yet something to improve:

[auto build test ERROR on net-next/master]

url:    https://github.com/0day-ci/linux/commits/Florian-Fainelli/of-mdio-Fall-back-to-mdiobus_register-with-np-is-NULL/20180516-203317
config: arm-omap2plus_defconfig (attached as .config)
compiler: arm-linux-gnueabi-gcc (Debian 7.2.0-11) 7.2.0
reproduce:
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        make.cross ARCH=arm 

All error/warnings (new ones prefixed by >>):

   drivers/net//ethernet/ti/davinci_mdio.c: In function 'davinci_mdio_probe':
>> drivers/net//ethernet/ti/davinci_mdio.c:457:12: error: invalid storage class for function 'davinci_mdio_remove'
    static int davinci_mdio_remove(struct platform_device *pdev)
               ^~~~~~~~~~~~~~~~~~~
>> drivers/net//ethernet/ti/davinci_mdio.c:457:1: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
    static int davinci_mdio_remove(struct platform_device *pdev)
    ^~~~~~
>> drivers/net//ethernet/ti/davinci_mdio.c:471:12: error: invalid storage class for function 'davinci_mdio_runtime_suspend'
    static int davinci_mdio_runtime_suspend(struct device *dev)
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> drivers/net//ethernet/ti/davinci_mdio.c:485:12: error: invalid storage class for function 'davinci_mdio_runtime_resume'
    static int davinci_mdio_runtime_resume(struct device *dev)
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~
>> drivers/net//ethernet/ti/davinci_mdio.c:495:12: error: invalid storage class for function 'davinci_mdio_suspend'
    static int davinci_mdio_suspend(struct device *dev)
               ^~~~~~~~~~~~~~~~~~~~
>> drivers/net//ethernet/ti/davinci_mdio.c:512:12: error: invalid storage class for function 'davinci_mdio_resume'
    static int davinci_mdio_resume(struct device *dev)
               ^~~~~~~~~~~~~~~~~~~
   In file included from include/linux/device.h:23:0,
                    from include/linux/platform_device.h:14,
                    from drivers/net//ethernet/ti/davinci_mdio.c:29:
>> drivers/net//ethernet/ti/davinci_mdio.c:527:21: error: initializer element is not constant
     SET_RUNTIME_PM_OPS(davinci_mdio_runtime_suspend,
                        ^
   include/linux/pm.h:354:21: note: in definition of macro 'SET_RUNTIME_PM_OPS'
     .runtime_suspend = suspend_fn, \
                        ^~~~~~~~~~
   drivers/net//ethernet/ti/davinci_mdio.c:527:21: note: (near initialization for 'davinci_mdio_pm_ops.runtime_suspend')
     SET_RUNTIME_PM_OPS(davinci_mdio_runtime_suspend,
                        ^
   include/linux/pm.h:354:21: note: in definition of macro 'SET_RUNTIME_PM_OPS'
     .runtime_suspend = suspend_fn, \
                        ^~~~~~~~~~
   drivers/net//ethernet/ti/davinci_mdio.c:528:7: error: initializer element is not constant
          davinci_mdio_runtime_resume, NULL)
          ^
   include/linux/pm.h:355:20: note: in definition of macro 'SET_RUNTIME_PM_OPS'
     .runtime_resume = resume_fn, \
                       ^~~~~~~~~
   drivers/net//ethernet/ti/davinci_mdio.c:528:7: note: (near initialization for 'davinci_mdio_pm_ops.runtime_resume')
          davinci_mdio_runtime_resume, NULL)
          ^
   include/linux/pm.h:355:20: note: in definition of macro 'SET_RUNTIME_PM_OPS'
     .runtime_resume = resume_fn, \
                       ^~~~~~~~~
   drivers/net//ethernet/ti/davinci_mdio.c:529:31: error: initializer element is not constant
     SET_LATE_SYSTEM_SLEEP_PM_OPS(davinci_mdio_suspend, davinci_mdio_resume)
                                  ^
   include/linux/pm.h:330:18: note: in definition of macro 'SET_LATE_SYSTEM_SLEEP_PM_OPS'
     .suspend_late = suspend_fn, \
                     ^~~~~~~~~~
   drivers/net//ethernet/ti/davinci_mdio.c:529:31: note: (near initialization for 'davinci_mdio_pm_ops.suspend_late')
     SET_LATE_SYSTEM_SLEEP_PM_OPS(davinci_mdio_suspend, davinci_mdio_resume)
                                  ^
   include/linux/pm.h:330:18: note: in definition of macro 'SET_LATE_SYSTEM_SLEEP_PM_OPS'
     .suspend_late = suspend_fn, \
                     ^~~~~~~~~~
   drivers/net//ethernet/ti/davinci_mdio.c:529:53: error: initializer element is not constant
     SET_LATE_SYSTEM_SLEEP_PM_OPS(davinci_mdio_suspend, davinci_mdio_resume)
                                                        ^
   include/linux/pm.h:331:18: note: in definition of macro 'SET_LATE_SYSTEM_SLEEP_PM_OPS'
     .resume_early = resume_fn, \
                     ^~~~~~~~~
   drivers/net//ethernet/ti/davinci_mdio.c:529:53: note: (near initialization for 'davinci_mdio_pm_ops.resume_early')
     SET_LATE_SYSTEM_SLEEP_PM_OPS(davinci_mdio_suspend, davinci_mdio_resume)
                                                        ^
   include/linux/pm.h:331:18: note: in definition of macro 'SET_LATE_SYSTEM_SLEEP_PM_OPS'
     .resume_early = resume_fn, \
                     ^~~~~~~~~
   drivers/net//ethernet/ti/davinci_mdio.c:529:31: error: initializer element is not constant
     SET_LATE_SYSTEM_SLEEP_PM_OPS(davinci_mdio_suspend, davinci_mdio_resume)
                                  ^
   include/linux/pm.h:332:17: note: in definition of macro 'SET_LATE_SYSTEM_SLEEP_PM_OPS'
     .freeze_late = suspend_fn, \
                    ^~~~~~~~~~
   drivers/net//ethernet/ti/davinci_mdio.c:529:31: note: (near initialization for 'davinci_mdio_pm_ops.freeze_late')
     SET_LATE_SYSTEM_SLEEP_PM_OPS(davinci_mdio_suspend, davinci_mdio_resume)
                                  ^
   include/linux/pm.h:332:17: note: in definition of macro 'SET_LATE_SYSTEM_SLEEP_PM_OPS'
     .freeze_late = suspend_fn, \
                    ^~~~~~~~~~
   drivers/net//ethernet/ti/davinci_mdio.c:529:53: error: initializer element is not constant
     SET_LATE_SYSTEM_SLEEP_PM_OPS(davinci_mdio_suspend, davinci_mdio_resume)
                                                        ^
   include/linux/pm.h:333:16: note: in definition of macro 'SET_LATE_SYSTEM_SLEEP_PM_OPS'
     .thaw_early = resume_fn, \
                   ^~~~~~~~~
   drivers/net//ethernet/ti/davinci_mdio.c:529:53: note: (near initialization for 'davinci_mdio_pm_ops.thaw_early')
     SET_LATE_SYSTEM_SLEEP_PM_OPS(davinci_mdio_suspend, davinci_mdio_resume)
                                                        ^
   include/linux/pm.h:333:16: note: in definition of macro 'SET_LATE_SYSTEM_SLEEP_PM_OPS'
     .thaw_early = resume_fn, \
                   ^~~~~~~~~
   drivers/net//ethernet/ti/davinci_mdio.c:529:31: error: initializer element is not constant
     SET_LATE_SYSTEM_SLEEP_PM_OPS(davinci_mdio_suspend, davinci_mdio_resume)
                                  ^
   include/linux/pm.h:334:19: note: in definition of macro 'SET_LATE_SYSTEM_SLEEP_PM_OPS'
     .poweroff_late = suspend_fn, \
                      ^~~~~~~~~~
   drivers/net//ethernet/ti/davinci_mdio.c:529:31: note: (near initialization for 'davinci_mdio_pm_ops.poweroff_late')
     SET_LATE_SYSTEM_SLEEP_PM_OPS(davinci_mdio_suspend, davinci_mdio_resume)
                                  ^
   include/linux/pm.h:334:19: note: in definition of macro 'SET_LATE_SYSTEM_SLEEP_PM_OPS'
     .poweroff_late = suspend_fn, \
                      ^~~~~~~~~~
   drivers/net//ethernet/ti/davinci_mdio.c:529:53: error: initializer element is not constant
     SET_LATE_SYSTEM_SLEEP_PM_OPS(davinci_mdio_suspend, davinci_mdio_resume)
                                                        ^
   include/linux/pm.h:335:19: note: in definition of macro 'SET_LATE_SYSTEM_SLEEP_PM_OPS'
     .restore_early = resume_fn,
                      ^~~~~~~~~
   drivers/net//ethernet/ti/davinci_mdio.c:529:53: note: (near initialization for 'davinci_mdio_pm_ops.restore_early')
     SET_LATE_SYSTEM_SLEEP_PM_OPS(davinci_mdio_suspend, davinci_mdio_resume)
                                                        ^
   include/linux/pm.h:335:19: note: in definition of macro 'SET_LATE_SYSTEM_SLEEP_PM_OPS'
     .restore_early = resume_fn,
                      ^~~~~~~~~
   drivers/net//ethernet/ti/davinci_mdio.c:539:12: error: initializer element is not constant
     .remove = davinci_mdio_remove,
               ^~~~~~~~~~~~~~~~~~~
   drivers/net//ethernet/ti/davinci_mdio.c:539:12: note: (near initialization for 'davinci_mdio_driver.remove')
>> drivers/net//ethernet/ti/davinci_mdio.c:542:19: error: invalid storage class for function 'davinci_mdio_init'
    static int __init davinci_mdio_init(void)
                      ^~~~~~~~~~~~~~~~~
   In file included from include/linux/printk.h:6:0,
                    from include/linux/kernel.h:14,
                    from include/linux/list.h:9,
                    from include/linux/module.h:9,
                    from drivers/net//ethernet/ti/davinci_mdio.c:27:
   drivers/net//ethernet/ti/davinci_mdio.c:546:17: error: initializer element is not constant
    device_initcall(davinci_mdio_init);
                    ^
   include/linux/init.h:172:58: note: in definition of macro '__define_initcall'
     __attribute__((__section__(".initcall" #id ".init"))) = fn;
                                                             ^~
>> drivers/net//ethernet/ti/davinci_mdio.c:546:1: note: in expansion of macro 'device_initcall'
    device_initcall(davinci_mdio_init);
    ^~~~~~~~~~~~~~~
>> drivers/net//ethernet/ti/davinci_mdio.c:548:20: error: invalid storage class for function 'davinci_mdio_exit'
    static void __exit davinci_mdio_exit(void)
                       ^~~~~~~~~~~~~~~~~
   drivers/net//ethernet/ti/davinci_mdio.c:548:1: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
    static void __exit davinci_mdio_exit(void)
    ^~~~~~
   In file included from include/linux/printk.h:6:0,
                    from include/linux/kernel.h:14,
                    from include/linux/list.h:9,
                    from include/linux/module.h:9,
                    from drivers/net//ethernet/ti/davinci_mdio.c:27:
   drivers/net//ethernet/ti/davinci_mdio.c:552:13: error: initializer element is not constant
    module_exit(davinci_mdio_exit);
                ^
   include/linux/init.h:209:50: note: in definition of macro '__exitcall'
     static exitcall_t __exitcall_##fn __exit_call = fn
                                                     ^~
>> drivers/net//ethernet/ti/davinci_mdio.c:552:1: note: in expansion of macro 'module_exit'
    module_exit(davinci_mdio_exit);
    ^~~~~~~~~~~
   In file included from include/linux/module.h:18:0,
                    from drivers/net//ethernet/ti/davinci_mdio.c:27:
>> include/linux/moduleparam.h:28:3: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
      struct __UNIQUE_ID(name) {}
      ^
   include/linux/module.h:161:32: note: in expansion of macro '__MODULE_INFO'
    #define MODULE_INFO(tag, info) __MODULE_INFO(tag, tag, info)
                                   ^~~~~~~~~~~~~
   include/linux/module.h:199:34: note: in expansion of macro 'MODULE_INFO'
    #define MODULE_LICENSE(_license) MODULE_INFO(license, _license)
                                     ^~~~~~~~~~~
>> drivers/net//ethernet/ti/davinci_mdio.c:554:1: note: in expansion of macro 'MODULE_LICENSE'
    MODULE_LICENSE("GPL");
    ^~~~~~~~~~~~~~
   In file included from <command-line>:0:0:
>> include/linux/compiler-gcc.h:193:45: error: expected declaration or statement at end of input
    #define __UNIQUE_ID(prefix) __PASTE(__PASTE(__UNIQUE_ID_, prefix), __COUNTER__)
                                                ^
   include/linux/compiler_types.h:52:23: note: in definition of macro '___PASTE'
    #define ___PASTE(a,b) a##b
                          ^
   include/linux/compiler-gcc.h:193:29: note: in expansion of macro '__PASTE'
    #define __UNIQUE_ID(prefix) __PASTE(__PASTE(__UNIQUE_ID_, prefix), __COUNTER__)
                                ^~~~~~~
   include/linux/compiler_types.h:53:22: note: in expansion of macro '___PASTE'
    #define __PASTE(a,b) ___PASTE(a,b)
                         ^~~~~~~~
   include/linux/compiler-gcc.h:193:37: note: in expansion of macro '__PASTE'
    #define __UNIQUE_ID(prefix) __PASTE(__PASTE(__UNIQUE_ID_, prefix), __COUNTER__)
                                        ^~~~~~~
   include/linux/moduleparam.h:28:10: note: in expansion of macro '__UNIQUE_ID'
      struct __UNIQUE_ID(name) {}
             ^~~~~~~~~~~
   include/linux/module.h:161:32: note: in expansion of macro '__MODULE_INFO'
    #define MODULE_INFO(tag, info) __MODULE_INFO(tag, tag, info)
                                   ^~~~~~~~~~~~~
   include/linux/module.h:208:42: note: in expansion of macro 'MODULE_INFO'
    #define MODULE_DESCRIPTION(_description) MODULE_INFO(description, _description)
                                             ^~~~~~~~~~~
>> drivers/net//ethernet/ti/davinci_mdio.c:555:1: note: in expansion of macro 'MODULE_DESCRIPTION'
    MODULE_DESCRIPTION("DaVinci MDIO driver");
    ^~~~~~~~~~~~~~~~~~
   At top level:
   drivers/net//ethernet/ti/davinci_mdio.c:357:12: warning: 'davinci_mdio_probe' defined but not used [-Wunused-function]
    static int davinci_mdio_probe(struct platform_device *pdev)
               ^~~~~~~~~~~~~~~~~~
--
   include/linux/pm.h:331:18: note: in definition of macro 'SET_LATE_SYSTEM_SLEEP_PM_OPS'
     .resume_early = resume_fn, \
                     ^~~~~~~~~
   drivers/net/ethernet/ti/davinci_mdio.c:529:53: note: (near initialization for 'davinci_mdio_pm_ops.resume_early')
     SET_LATE_SYSTEM_SLEEP_PM_OPS(davinci_mdio_suspend, davinci_mdio_resume)
                                                        ^
   include/linux/pm.h:331:18: note: in definition of macro 'SET_LATE_SYSTEM_SLEEP_PM_OPS'
     .resume_early = resume_fn, \
                     ^~~~~~~~~
   drivers/net/ethernet/ti/davinci_mdio.c:529:31: error: initializer element is not constant
     SET_LATE_SYSTEM_SLEEP_PM_OPS(davinci_mdio_suspend, davinci_mdio_resume)
                                  ^
   include/linux/pm.h:332:17: note: in definition of macro 'SET_LATE_SYSTEM_SLEEP_PM_OPS'
     .freeze_late = suspend_fn, \
                    ^~~~~~~~~~
   drivers/net/ethernet/ti/davinci_mdio.c:529:31: note: (near initialization for 'davinci_mdio_pm_ops.freeze_late')
     SET_LATE_SYSTEM_SLEEP_PM_OPS(davinci_mdio_suspend, davinci_mdio_resume)
                                  ^
   include/linux/pm.h:332:17: note: in definition of macro 'SET_LATE_SYSTEM_SLEEP_PM_OPS'
     .freeze_late = suspend_fn, \
                    ^~~~~~~~~~
   drivers/net/ethernet/ti/davinci_mdio.c:529:53: error: initializer element is not constant
     SET_LATE_SYSTEM_SLEEP_PM_OPS(davinci_mdio_suspend, davinci_mdio_resume)
                                                        ^
   include/linux/pm.h:333:16: note: in definition of macro 'SET_LATE_SYSTEM_SLEEP_PM_OPS'
     .thaw_early = resume_fn, \
                   ^~~~~~~~~
   drivers/net/ethernet/ti/davinci_mdio.c:529:53: note: (near initialization for 'davinci_mdio_pm_ops.thaw_early')
     SET_LATE_SYSTEM_SLEEP_PM_OPS(davinci_mdio_suspend, davinci_mdio_resume)
                                                        ^
   include/linux/pm.h:333:16: note: in definition of macro 'SET_LATE_SYSTEM_SLEEP_PM_OPS'
     .thaw_early = resume_fn, \
                   ^~~~~~~~~
   drivers/net/ethernet/ti/davinci_mdio.c:529:31: error: initializer element is not constant
     SET_LATE_SYSTEM_SLEEP_PM_OPS(davinci_mdio_suspend, davinci_mdio_resume)
                                  ^
   include/linux/pm.h:334:19: note: in definition of macro 'SET_LATE_SYSTEM_SLEEP_PM_OPS'
     .poweroff_late = suspend_fn, \
                      ^~~~~~~~~~
   drivers/net/ethernet/ti/davinci_mdio.c:529:31: note: (near initialization for 'davinci_mdio_pm_ops.poweroff_late')
     SET_LATE_SYSTEM_SLEEP_PM_OPS(davinci_mdio_suspend, davinci_mdio_resume)
                                  ^
   include/linux/pm.h:334:19: note: in definition of macro 'SET_LATE_SYSTEM_SLEEP_PM_OPS'
     .poweroff_late = suspend_fn, \
                      ^~~~~~~~~~
   drivers/net/ethernet/ti/davinci_mdio.c:529:53: error: initializer element is not constant
     SET_LATE_SYSTEM_SLEEP_PM_OPS(davinci_mdio_suspend, davinci_mdio_resume)
                                                        ^
   include/linux/pm.h:335:19: note: in definition of macro 'SET_LATE_SYSTEM_SLEEP_PM_OPS'
     .restore_early = resume_fn,
                      ^~~~~~~~~
   drivers/net/ethernet/ti/davinci_mdio.c:529:53: note: (near initialization for 'davinci_mdio_pm_ops.restore_early')
     SET_LATE_SYSTEM_SLEEP_PM_OPS(davinci_mdio_suspend, davinci_mdio_resume)
                                                        ^
   include/linux/pm.h:335:19: note: in definition of macro 'SET_LATE_SYSTEM_SLEEP_PM_OPS'
     .restore_early = resume_fn,
                      ^~~~~~~~~
   drivers/net/ethernet/ti/davinci_mdio.c:539:12: error: initializer element is not constant
     .remove = davinci_mdio_remove,
               ^~~~~~~~~~~~~~~~~~~
   drivers/net/ethernet/ti/davinci_mdio.c:539:12: note: (near initialization for 'davinci_mdio_driver.remove')
   drivers/net/ethernet/ti/davinci_mdio.c:542:19: error: invalid storage class for function 'davinci_mdio_init'
    static int __init davinci_mdio_init(void)
                      ^~~~~~~~~~~~~~~~~
   In file included from include/linux/printk.h:6:0,
                    from include/linux/kernel.h:14,
                    from include/linux/list.h:9,
                    from include/linux/module.h:9,
                    from drivers/net/ethernet/ti/davinci_mdio.c:27:
   drivers/net/ethernet/ti/davinci_mdio.c:546:17: error: initializer element is not constant
    device_initcall(davinci_mdio_init);
                    ^
   include/linux/init.h:172:58: note: in definition of macro '__define_initcall'
     __attribute__((__section__(".initcall" #id ".init"))) = fn;
                                                             ^~
   drivers/net/ethernet/ti/davinci_mdio.c:546:1: note: in expansion of macro 'device_initcall'
    device_initcall(davinci_mdio_init);
    ^~~~~~~~~~~~~~~
   drivers/net/ethernet/ti/davinci_mdio.c:548:20: error: invalid storage class for function 'davinci_mdio_exit'
    static void __exit davinci_mdio_exit(void)
                       ^~~~~~~~~~~~~~~~~
   drivers/net/ethernet/ti/davinci_mdio.c:548:1: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
    static void __exit davinci_mdio_exit(void)
    ^~~~~~
   In file included from include/linux/printk.h:6:0,
                    from include/linux/kernel.h:14,
                    from include/linux/list.h:9,
                    from include/linux/module.h:9,
                    from drivers/net/ethernet/ti/davinci_mdio.c:27:
   drivers/net/ethernet/ti/davinci_mdio.c:552:13: error: initializer element is not constant
    module_exit(davinci_mdio_exit);
                ^
   include/linux/init.h:209:50: note: in definition of macro '__exitcall'
     static exitcall_t __exitcall_##fn __exit_call = fn
                                                     ^~
   drivers/net/ethernet/ti/davinci_mdio.c:552:1: note: in expansion of macro 'module_exit'
    module_exit(davinci_mdio_exit);
    ^~~~~~~~~~~
   In file included from include/linux/module.h:18:0,
                    from drivers/net/ethernet/ti/davinci_mdio.c:27:
>> include/linux/moduleparam.h:28:3: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
      struct __UNIQUE_ID(name) {}
      ^
   include/linux/module.h:161:32: note: in expansion of macro '__MODULE_INFO'
    #define MODULE_INFO(tag, info) __MODULE_INFO(tag, tag, info)
                                   ^~~~~~~~~~~~~
   include/linux/module.h:199:34: note: in expansion of macro 'MODULE_INFO'
    #define MODULE_LICENSE(_license) MODULE_INFO(license, _license)
                                     ^~~~~~~~~~~
   drivers/net/ethernet/ti/davinci_mdio.c:554:1: note: in expansion of macro 'MODULE_LICENSE'
    MODULE_LICENSE("GPL");
    ^~~~~~~~~~~~~~
   In file included from <command-line>:0:0:
>> include/linux/compiler-gcc.h:193:45: error: expected declaration or statement at end of input
    #define __UNIQUE_ID(prefix) __PASTE(__PASTE(__UNIQUE_ID_, prefix), __COUNTER__)
                                                ^
   include/linux/compiler_types.h:52:23: note: in definition of macro '___PASTE'
    #define ___PASTE(a,b) a##b
                          ^
   include/linux/compiler-gcc.h:193:29: note: in expansion of macro '__PASTE'
    #define __UNIQUE_ID(prefix) __PASTE(__PASTE(__UNIQUE_ID_, prefix), __COUNTER__)
                                ^~~~~~~
   include/linux/compiler_types.h:53:22: note: in expansion of macro '___PASTE'
    #define __PASTE(a,b) ___PASTE(a,b)
                         ^~~~~~~~
   include/linux/compiler-gcc.h:193:37: note: in expansion of macro '__PASTE'
    #define __UNIQUE_ID(prefix) __PASTE(__PASTE(__UNIQUE_ID_, prefix), __COUNTER__)
                                        ^~~~~~~
   include/linux/moduleparam.h:28:10: note: in expansion of macro '__UNIQUE_ID'
      struct __UNIQUE_ID(name) {}
             ^~~~~~~~~~~
   include/linux/module.h:161:32: note: in expansion of macro '__MODULE_INFO'
    #define MODULE_INFO(tag, info) __MODULE_INFO(tag, tag, info)
                                   ^~~~~~~~~~~~~
   include/linux/module.h:208:42: note: in expansion of macro 'MODULE_INFO'
    #define MODULE_DESCRIPTION(_description) MODULE_INFO(description, _description)
                                             ^~~~~~~~~~~
   drivers/net/ethernet/ti/davinci_mdio.c:555:1: note: in expansion of macro 'MODULE_DESCRIPTION'
    MODULE_DESCRIPTION("DaVinci MDIO driver");
    ^~~~~~~~~~~~~~~~~~
   At top level:
   drivers/net/ethernet/ti/davinci_mdio.c:357:12: warning: 'davinci_mdio_probe' defined but not used [-Wunused-function]
    static int davinci_mdio_probe(struct platform_device *pdev)
               ^~~~~~~~~~~~~~~~~~

vim +/davinci_mdio_remove +457 drivers/net//ethernet/ti/davinci_mdio.c

f20136eb drivers/net/davinci_mdio.c             Cyril Chemparathy 2010-09-15  456  
e38921d4 drivers/net/ethernet/ti/davinci_mdio.c Bill Pemberton    2012-12-03 @457  static int davinci_mdio_remove(struct platform_device *pdev)
f20136eb drivers/net/davinci_mdio.c             Cyril Chemparathy 2010-09-15  458  {
84ce22df drivers/net/ethernet/ti/davinci_mdio.c Libo Chen         2013-08-19  459  	struct davinci_mdio_data *data = platform_get_drvdata(pdev);
f20136eb drivers/net/davinci_mdio.c             Cyril Chemparathy 2010-09-15  460  
50d0636e drivers/net/ethernet/ti/davinci_mdio.c Grygorii Strashko 2014-04-30  461  	if (data->bus)
b27393ae drivers/net/ethernet/ti/davinci_mdio.c Bin Liu           2012-08-30  462  		mdiobus_unregister(data->bus);
f20136eb drivers/net/davinci_mdio.c             Cyril Chemparathy 2010-09-15  463  
8ea63bba drivers/net/ethernet/ti/davinci_mdio.c Grygorii Strashko 2016-06-24  464  	pm_runtime_dont_use_autosuspend(&pdev->dev);
8e476d9d drivers/net/ethernet/ti/davinci_mdio.c Mugunthan V N     2012-07-17  465  	pm_runtime_disable(&pdev->dev);
f20136eb drivers/net/davinci_mdio.c             Cyril Chemparathy 2010-09-15  466  
f20136eb drivers/net/davinci_mdio.c             Cyril Chemparathy 2010-09-15  467  	return 0;
f20136eb drivers/net/davinci_mdio.c             Cyril Chemparathy 2010-09-15  468  }
f20136eb drivers/net/davinci_mdio.c             Cyril Chemparathy 2010-09-15  469  
651652aa drivers/net/ethernet/ti/davinci_mdio.c Grygorii Strashko 2016-06-24  470  #ifdef CONFIG_PM
651652aa drivers/net/ethernet/ti/davinci_mdio.c Grygorii Strashko 2016-06-24 @471  static int davinci_mdio_runtime_suspend(struct device *dev)
f20136eb drivers/net/davinci_mdio.c             Cyril Chemparathy 2010-09-15  472  {
f20136eb drivers/net/davinci_mdio.c             Cyril Chemparathy 2010-09-15  473  	struct davinci_mdio_data *data = dev_get_drvdata(dev);
f20136eb drivers/net/davinci_mdio.c             Cyril Chemparathy 2010-09-15  474  	u32 ctrl;
f20136eb drivers/net/davinci_mdio.c             Cyril Chemparathy 2010-09-15  475  
f20136eb drivers/net/davinci_mdio.c             Cyril Chemparathy 2010-09-15  476  	/* shutdown the scan state machine */
f20136eb drivers/net/davinci_mdio.c             Cyril Chemparathy 2010-09-15  477  	ctrl = __raw_readl(&data->regs->control);
f20136eb drivers/net/davinci_mdio.c             Cyril Chemparathy 2010-09-15  478  	ctrl &= ~CONTROL_ENABLE;
f20136eb drivers/net/davinci_mdio.c             Cyril Chemparathy 2010-09-15  479  	__raw_writel(ctrl, &data->regs->control);
f20136eb drivers/net/davinci_mdio.c             Cyril Chemparathy 2010-09-15  480  	wait_for_idle(data);
f20136eb drivers/net/davinci_mdio.c             Cyril Chemparathy 2010-09-15  481  
651652aa drivers/net/ethernet/ti/davinci_mdio.c Grygorii Strashko 2016-06-24  482  	return 0;
651652aa drivers/net/ethernet/ti/davinci_mdio.c Grygorii Strashko 2016-06-24  483  }
651652aa drivers/net/ethernet/ti/davinci_mdio.c Grygorii Strashko 2016-06-24  484  
651652aa drivers/net/ethernet/ti/davinci_mdio.c Grygorii Strashko 2016-06-24 @485  static int davinci_mdio_runtime_resume(struct device *dev)
651652aa drivers/net/ethernet/ti/davinci_mdio.c Grygorii Strashko 2016-06-24  486  {
651652aa drivers/net/ethernet/ti/davinci_mdio.c Grygorii Strashko 2016-06-24  487  	struct davinci_mdio_data *data = dev_get_drvdata(dev);
651652aa drivers/net/ethernet/ti/davinci_mdio.c Grygorii Strashko 2016-06-24  488  
651652aa drivers/net/ethernet/ti/davinci_mdio.c Grygorii Strashko 2016-06-24  489  	davinci_mdio_enable(data);
651652aa drivers/net/ethernet/ti/davinci_mdio.c Grygorii Strashko 2016-06-24  490  	return 0;
651652aa drivers/net/ethernet/ti/davinci_mdio.c Grygorii Strashko 2016-06-24  491  }
651652aa drivers/net/ethernet/ti/davinci_mdio.c Grygorii Strashko 2016-06-24  492  #endif
651652aa drivers/net/ethernet/ti/davinci_mdio.c Grygorii Strashko 2016-06-24  493  
651652aa drivers/net/ethernet/ti/davinci_mdio.c Grygorii Strashko 2016-06-24  494  #ifdef CONFIG_PM_SLEEP
651652aa drivers/net/ethernet/ti/davinci_mdio.c Grygorii Strashko 2016-06-24 @495  static int davinci_mdio_suspend(struct device *dev)
651652aa drivers/net/ethernet/ti/davinci_mdio.c Grygorii Strashko 2016-06-24  496  {
651652aa drivers/net/ethernet/ti/davinci_mdio.c Grygorii Strashko 2016-06-24  497  	struct davinci_mdio_data *data = dev_get_drvdata(dev);
651652aa drivers/net/ethernet/ti/davinci_mdio.c Grygorii Strashko 2016-06-24  498  	int ret = 0;
651652aa drivers/net/ethernet/ti/davinci_mdio.c Grygorii Strashko 2016-06-24  499  
8ea63bba drivers/net/ethernet/ti/davinci_mdio.c Grygorii Strashko 2016-06-24  500  	data->active_in_suspend = !pm_runtime_status_suspended(dev);
8ea63bba drivers/net/ethernet/ti/davinci_mdio.c Grygorii Strashko 2016-06-24  501  	if (data->active_in_suspend)
651652aa drivers/net/ethernet/ti/davinci_mdio.c Grygorii Strashko 2016-06-24  502  		ret = pm_runtime_force_suspend(dev);
651652aa drivers/net/ethernet/ti/davinci_mdio.c Grygorii Strashko 2016-06-24  503  	if (ret < 0)
651652aa drivers/net/ethernet/ti/davinci_mdio.c Grygorii Strashko 2016-06-24  504  		return ret;
651652aa drivers/net/ethernet/ti/davinci_mdio.c Grygorii Strashko 2016-06-24  505  
5c0e3580 drivers/net/ethernet/ti/davinci_mdio.c Mugunthan V N     2013-06-06  506  	/* Select sleep pin state */
5c0e3580 drivers/net/ethernet/ti/davinci_mdio.c Mugunthan V N     2013-06-06  507  	pinctrl_pm_select_sleep_state(dev);
5c0e3580 drivers/net/ethernet/ti/davinci_mdio.c Mugunthan V N     2013-06-06  508  
f20136eb drivers/net/davinci_mdio.c             Cyril Chemparathy 2010-09-15  509  	return 0;
f20136eb drivers/net/davinci_mdio.c             Cyril Chemparathy 2010-09-15  510  }
f20136eb drivers/net/davinci_mdio.c             Cyril Chemparathy 2010-09-15  511  
f20136eb drivers/net/davinci_mdio.c             Cyril Chemparathy 2010-09-15 @512  static int davinci_mdio_resume(struct device *dev)
f20136eb drivers/net/davinci_mdio.c             Cyril Chemparathy 2010-09-15  513  {
f20136eb drivers/net/davinci_mdio.c             Cyril Chemparathy 2010-09-15  514  	struct davinci_mdio_data *data = dev_get_drvdata(dev);
f20136eb drivers/net/davinci_mdio.c             Cyril Chemparathy 2010-09-15  515  
5c0e3580 drivers/net/ethernet/ti/davinci_mdio.c Mugunthan V N     2013-06-06  516  	/* Select default pin state */
5c0e3580 drivers/net/ethernet/ti/davinci_mdio.c Mugunthan V N     2013-06-06  517  	pinctrl_pm_select_default_state(dev);
5c0e3580 drivers/net/ethernet/ti/davinci_mdio.c Mugunthan V N     2013-06-06  518  
8ea63bba drivers/net/ethernet/ti/davinci_mdio.c Grygorii Strashko 2016-06-24  519  	if (data->active_in_suspend)
651652aa drivers/net/ethernet/ti/davinci_mdio.c Grygorii Strashko 2016-06-24  520  		pm_runtime_force_resume(dev);
f20136eb drivers/net/davinci_mdio.c             Cyril Chemparathy 2010-09-15  521  
f20136eb drivers/net/davinci_mdio.c             Cyril Chemparathy 2010-09-15  522  	return 0;
f20136eb drivers/net/davinci_mdio.c             Cyril Chemparathy 2010-09-15  523  }
2f5c54ce drivers/net/ethernet/ti/davinci_mdio.c Grygorii Strashko 2015-02-27  524  #endif
f20136eb drivers/net/davinci_mdio.c             Cyril Chemparathy 2010-09-15  525  
f20136eb drivers/net/davinci_mdio.c             Cyril Chemparathy 2010-09-15  526  static const struct dev_pm_ops davinci_mdio_pm_ops = {
651652aa drivers/net/ethernet/ti/davinci_mdio.c Grygorii Strashko 2016-06-24 @527  	SET_RUNTIME_PM_OPS(davinci_mdio_runtime_suspend,
651652aa drivers/net/ethernet/ti/davinci_mdio.c Grygorii Strashko 2016-06-24  528  			   davinci_mdio_runtime_resume, NULL)
2f5c54ce drivers/net/ethernet/ti/davinci_mdio.c Grygorii Strashko 2015-02-27  529  	SET_LATE_SYSTEM_SLEEP_PM_OPS(davinci_mdio_suspend, davinci_mdio_resume)
f20136eb drivers/net/davinci_mdio.c             Cyril Chemparathy 2010-09-15  530  };
f20136eb drivers/net/davinci_mdio.c             Cyril Chemparathy 2010-09-15  531  
f20136eb drivers/net/davinci_mdio.c             Cyril Chemparathy 2010-09-15  532  static struct platform_driver davinci_mdio_driver = {
f20136eb drivers/net/davinci_mdio.c             Cyril Chemparathy 2010-09-15  533  	.driver = {
f20136eb drivers/net/davinci_mdio.c             Cyril Chemparathy 2010-09-15  534  		.name	 = "davinci_mdio",
f20136eb drivers/net/davinci_mdio.c             Cyril Chemparathy 2010-09-15  535  		.pm	 = &davinci_mdio_pm_ops,
ec03e6a8 drivers/net/ethernet/ti/davinci_mdio.c Mugunthan V N     2012-08-06  536  		.of_match_table = of_match_ptr(davinci_mdio_of_mtable),
f20136eb drivers/net/davinci_mdio.c             Cyril Chemparathy 2010-09-15  537  	},
f20136eb drivers/net/davinci_mdio.c             Cyril Chemparathy 2010-09-15  538  	.probe = davinci_mdio_probe,
e38921d4 drivers/net/ethernet/ti/davinci_mdio.c Bill Pemberton    2012-12-03 @539  	.remove = davinci_mdio_remove,
f20136eb drivers/net/davinci_mdio.c             Cyril Chemparathy 2010-09-15  540  };
f20136eb drivers/net/davinci_mdio.c             Cyril Chemparathy 2010-09-15  541  
f20136eb drivers/net/davinci_mdio.c             Cyril Chemparathy 2010-09-15 @542  static int __init davinci_mdio_init(void)
f20136eb drivers/net/davinci_mdio.c             Cyril Chemparathy 2010-09-15  543  {
f20136eb drivers/net/davinci_mdio.c             Cyril Chemparathy 2010-09-15  544  	return platform_driver_register(&davinci_mdio_driver);
f20136eb drivers/net/davinci_mdio.c             Cyril Chemparathy 2010-09-15  545  }
f20136eb drivers/net/davinci_mdio.c             Cyril Chemparathy 2010-09-15 @546  device_initcall(davinci_mdio_init);
f20136eb drivers/net/davinci_mdio.c             Cyril Chemparathy 2010-09-15  547  
f20136eb drivers/net/davinci_mdio.c             Cyril Chemparathy 2010-09-15 @548  static void __exit davinci_mdio_exit(void)
f20136eb drivers/net/davinci_mdio.c             Cyril Chemparathy 2010-09-15  549  {
f20136eb drivers/net/davinci_mdio.c             Cyril Chemparathy 2010-09-15  550  	platform_driver_unregister(&davinci_mdio_driver);
f20136eb drivers/net/davinci_mdio.c             Cyril Chemparathy 2010-09-15  551  }
f20136eb drivers/net/davinci_mdio.c             Cyril Chemparathy 2010-09-15 @552  module_exit(davinci_mdio_exit);
f20136eb drivers/net/davinci_mdio.c             Cyril Chemparathy 2010-09-15  553  
f20136eb drivers/net/davinci_mdio.c             Cyril Chemparathy 2010-09-15 @554  MODULE_LICENSE("GPL");
f20136eb drivers/net/davinci_mdio.c             Cyril Chemparathy 2010-09-15 @555  MODULE_DESCRIPTION("DaVinci MDIO driver");

:::::: The code at line 457 was first introduced by commit
:::::: e38921d4dd7d2f052c1c2344fac307463c3b8d2d net/davinci_emac: remove __dev* attributes

:::::: TO: Bill Pemberton <wfp5p@virginia.edu>
:::::: CC: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
diff mbox

Patch

diff --git a/drivers/net/dsa/bcm_sf2.c b/drivers/net/dsa/bcm_sf2.c
index ac621f44237a..02e8982519ce 100644
--- a/drivers/net/dsa/bcm_sf2.c
+++ b/drivers/net/dsa/bcm_sf2.c
@@ -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)
+	err = of_mdiobus_register(priv->slave_mii_bus, dn);
+	if (err && dn)
 		of_node_put(dn);
 
 	return err;
diff --git a/drivers/net/dsa/mv88e6xxx/chip.c b/drivers/net/dsa/mv88e6xxx/chip.c
index b23c11d9f4b2..2bb3f03ee1cb 100644
--- a/drivers/net/dsa/mv88e6xxx/chip.c
+++ b/drivers/net/dsa/mv88e6xxx/chip.c
@@ -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);
+	err = of_mdiobus_register(bus, np);
 	if (err) {
 		dev_err(chip->dev, "Cannot register MDIO bus (%d)\n", err);
 		mv88e6xxx_g2_irq_mdio_free(chip, bus);
diff --git a/drivers/net/ethernet/cadence/macb_main.c b/drivers/net/ethernet/cadence/macb_main.c
index b4c9268100bb..3e93df5d4e3b 100644
--- a/drivers/net/ethernet/cadence/macb_main.c
+++ b/drivers/net/ethernet/cadence/macb_main.c
@@ -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 (pdata)
+		bp->mii_bus->phy_mask = pdata->phy_mask;
 
-	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;
 
diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c
index d4604bc8eb5b..f3e43db0d6cb 100644
--- a/drivers/net/ethernet/freescale/fec_main.c
+++ b/drivers/net/ethernet/freescale/fec_main.c
@@ -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);
+	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;
 
diff --git a/drivers/net/ethernet/marvell/mvmdio.c b/drivers/net/ethernet/marvell/mvmdio.c
index 0495487f7b42..c5dac6bd2be4 100644
--- a/drivers/net/ethernet/marvell/mvmdio.c
+++ b/drivers/net/ethernet/marvell/mvmdio.c
@@ -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);
+	ret = of_mdiobus_register(bus, pdev->dev.of_node);
 	if (ret < 0) {
 		dev_err(&pdev->dev, "Cannot register MDIO bus (%d)\n", ret);
 		goto out_mdio;
diff --git a/drivers/net/ethernet/renesas/sh_eth.c b/drivers/net/ethernet/renesas/sh_eth.c
index 5970d9e5ddf1..8dd41e08a6c6 100644
--- a/drivers/net/ethernet/renesas/sh_eth.c
+++ b/drivers/net/ethernet/renesas/sh_eth.c
@@ -3025,15 +3025,10 @@  static int sh_mdio_init(struct sh_eth_private *mdp,
 		 pdev->name, pdev->id);
 
 	/* register MDIO bus */
-	if (dev->of_node) {
-		ret = of_mdiobus_register(mdp->mii_bus, dev->of_node);
-	} else {
-		if (pd->phy_irq > 0)
-			mdp->mii_bus->irq[pd->phy] = pd->phy_irq;
-
-		ret = mdiobus_register(mdp->mii_bus);
-	}
+	if (pd->phy_irq > 0)
+		mdp->mii_bus->irq[pd->phy] = pd->phy_irq;
 
+	ret = of_mdiobus_register(mdp->mii_bus, dev->of_node);
 	if (ret)
 		goto out_free_bus;
 
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c
index f5f37bfa1d58..5df1a608e566 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c
@@ -233,10 +233,7 @@  int stmmac_mdio_register(struct net_device *ndev)
 	new_bus->phy_mask = mdio_bus_data->phy_mask;
 	new_bus->parent = priv->device;
 
-	if (mdio_node)
-		err = of_mdiobus_register(new_bus, mdio_node);
-	else
-		err = mdiobus_register(new_bus);
+	err = of_mdiobus_register(new_bus, mdio_node);
 	if (err != 0) {
 		dev_err(dev, "Cannot register the MDIO bus\n");
 		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)) {
 		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)
 	if (!new_bus)
 		return -ENODEV;
 
-	if (pdev->dev.of_node)
-		ret = of_mdiobus_register(new_bus, pdev->dev.of_node);
-	else
-		ret = mdiobus_register(new_bus);
-
+	ret = of_mdiobus_register(new_bus, pdev->dev.of_node);
 	if (ret)
 		mdio_gpio_bus_deinit(&pdev->dev);
 
diff --git a/drivers/net/phy/mdio-mscc-miim.c b/drivers/net/phy/mdio-mscc-miim.c
index 8c689ccfdbca..badbc99bedd3 100644
--- a/drivers/net/phy/mdio-mscc-miim.c
+++ b/drivers/net/phy/mdio-mscc-miim.c
@@ -151,11 +151,7 @@  static int mscc_miim_probe(struct platform_device *pdev)
 		}
 	}
 
-	if (pdev->dev.of_node)
-		ret = of_mdiobus_register(bus, pdev->dev.of_node);
-	else
-		ret = mdiobus_register(bus);
-
+	ret = of_mdiobus_register(bus, pdev->dev.of_node);
 	if (ret < 0) {
 		dev_err(&pdev->dev, "Cannot register MDIO bus (%d)\n", ret);
 		return ret;
diff --git a/drivers/net/usb/lan78xx.c b/drivers/net/usb/lan78xx.c
index 91761436709a..8dff87ec6d99 100644
--- a/drivers/net/usb/lan78xx.c
+++ b/drivers/net/usb/lan78xx.c
@@ -1843,12 +1843,9 @@  static int lan78xx_mdio_init(struct lan78xx_net *dev)
 	}
 
 	node = of_get_child_by_name(dev->udev->dev.of_node, "mdio");
-	if (node) {
-		ret = of_mdiobus_register(dev->mdiobus, node);
+	ret = of_mdiobus_register(dev->mdiobus, node);
+	if (node)
 		of_node_put(node);
-	} else {
-		ret = mdiobus_register(dev->mdiobus);
-	}
 	if (ret) {
 		netdev_err(dev->net, "can't register MDIO bus\n");
 		goto exit1;