Re: [PATCH] net: mdio-octeon: Add PCI driver binding.

From: David Miller
Date: Thu Sep 24 2015 - 17:52:13 EST


From: David Daney <ddaney.cavm@xxxxxxxxx>
Date: Tue, 22 Sep 2015 17:41:36 -0700

> From: David Daney <david.daney@xxxxxxxxxx>
>
> When the Cavium mdio-octeon devices appear in the Thunder family of
> arm64 based SoCs, they show up as PCI devices. Add PCI driver
> wrapping so the driver is bound in the standard PCI device scan.
>
> When in this form, a single PCI device may have more than a single
> bus, we call this a "nexus" of buses. The standard firmware
> device_for_each_child_node() iterator is used to find the individual
> buses underneath the "nexus".
>
> Update the device tree binding documentation for the new PCI driver
> binding.
>
> Signed-off-by: David Daney <david.daney@xxxxxxxxxx>

This patch breaks the build:

CC [M] drivers/net/phy/mdio-octeon.o
In file included from drivers/net/phy/mdio-octeon.c:13:0:
include/linux/module.h:128:27: error: redefinition of ʽ__inittestʼ
static inline initcall_t __inittest(void) \
^
include/linux/device.h:1321:1: note: in expansion of macro ʽmodule_initʼ
module_init(__driver##_init); \
^
include/linux/pci.h:1192:2: note: in expansion of macro ʽmodule_driverʼ
module_driver(__pci_driver, pci_register_driver, \
^
drivers/net/phy/mdio-octeon.c:513:1: note: in expansion of macro ʽmodule_pci_driverʼ
module_pci_driver(thunder_mdiobus_driver);
^
include/linux/module.h:128:27: note: previous definition of ʽ__inittestʼ was here
static inline initcall_t __inittest(void) \
^
include/linux/device.h:1321:1: note: in expansion of macro ʽmodule_initʼ
module_init(__driver##_init); \
^
include/linux/platform_device.h:222:2: note: in expansion of macro ʽmodule_driverʼ
module_driver(__platform_driver, platform_driver_register, \
^
drivers/net/phy/mdio-octeon.c:373:1: note: in expansion of macro ʽmodule_platform_driverʼ
module_platform_driver(octeon_mdiobus_driver);
^
include/linux/module.h:130:6: error: redefinition of ʽinit_moduleʼ
int init_module(void) __attribute__((alias(#initfn)));
^
include/linux/device.h:1321:1: note: in expansion of macro ʽmodule_initʼ
module_init(__driver##_init); \
^
include/linux/pci.h:1192:2: note: in expansion of macro ʽmodule_driverʼ
module_driver(__pci_driver, pci_register_driver, \
^
drivers/net/phy/mdio-octeon.c:513:1: note: in expansion of macro ʽmodule_pci_driverʼ
module_pci_driver(thunder_mdiobus_driver);
^
include/linux/module.h:130:6: note: previous definition of ʽinit_moduleʼ was here
int init_module(void) __attribute__((alias(#initfn)));
^
include/linux/device.h:1321:1: note: in expansion of macro ʽmodule_initʼ
module_init(__driver##_init); \
^
include/linux/platform_device.h:222:2: note: in expansion of macro ʽmodule_driverʼ
module_driver(__platform_driver, platform_driver_register, \
^
drivers/net/phy/mdio-octeon.c:373:1: note: in expansion of macro ʽmodule_platform_driverʼ
module_platform_driver(octeon_mdiobus_driver);
^
include/linux/module.h:134:27: error: redefinition of ʽ__exittestʼ
static inline exitcall_t __exittest(void) \
^
include/linux/device.h:1326:1: note: in expansion of macro ʽmodule_exitʼ
module_exit(__driver##_exit);
^
include/linux/pci.h:1192:2: note: in expansion of macro ʽmodule_driverʼ
module_driver(__pci_driver, pci_register_driver, \
^
drivers/net/phy/mdio-octeon.c:513:1: note: in expansion of macro ʽmodule_pci_driverʼ
module_pci_driver(thunder_mdiobus_driver);
^
include/linux/module.h:134:27: note: previous definition of ʽ__exittestʼ was here
static inline exitcall_t __exittest(void) \
^
include/linux/device.h:1326:1: note: in expansion of macro ʽmodule_exitʼ
module_exit(__driver##_exit);
^
include/linux/platform_device.h:222:2: note: in expansion of macro ʽmodule_driverʼ
module_driver(__platform_driver, platform_driver_register, \
^
drivers/net/phy/mdio-octeon.c:373:1: note: in expansion of macro ʽmodule_platform_driverʼ
module_platform_driver(octeon_mdiobus_driver);
^
include/linux/module.h:136:7: error: redefinition of ʽcleanup_moduleʼ
void cleanup_module(void) __attribute__((alias(#exitfn)));
^
include/linux/device.h:1326:1: note: in expansion of macro ʽmodule_exitʼ
module_exit(__driver##_exit);
^
include/linux/pci.h:1192:2: note: in expansion of macro ʽmodule_driverʼ
module_driver(__pci_driver, pci_register_driver, \
^
drivers/net/phy/mdio-octeon.c:513:1: note: in expansion of macro ʽmodule_pci_driverʼ
module_pci_driver(thunder_mdiobus_driver);
^
include/linux/module.h:136:7: note: previous definition of ʽcleanup_moduleʼ was here
void cleanup_module(void) __attribute__((alias(#exitfn)));
^
include/linux/device.h:1326:1: note: in expansion of macro ʽmodule_exitʼ
module_exit(__driver##_exit);
^
include/linux/platform_device.h:222:2: note: in expansion of macro ʽmodule_driverʼ
module_driver(__platform_driver, platform_driver_register, \
^
drivers/net/phy/mdio-octeon.c:373:1: note: in expansion of macro ʽmodule_platform_driverʼ
module_platform_driver(octeon_mdiobus_driver);
^

And frankly I'm not sure I like this change anyways. If the OF nodes
are there, simply add code to match on those OF nodes.

This is better than assuming what sits underneath a PCI node, without
any checks for the 'name' or 'compatible' properties at all. That's
what they are there for afterall.