Re: [PATCH] net: Explicitly include correct DT includes
estera_rxtx.c | 3 --- > drivers/net/ethernet/marvell/sky2.c | 1 - > drivers/net/ethernet/mediatek/mtk_eth_soc.c | 3 ++- > drivers/net/ethernet/mediatek/mtk_star_emac.c | 1 - > drivers/net/ethernet/mediatek/mtk_wed.c | 1 + > drivers/net/ethernet/mediatek/mtk_wed_wo.c | 3 +-- > drivers/net/ethernet/microchip/lan966x/lan966x_main.c | 3 ++- > drivers/net/ethernet/mscc/ocelot_fdma.c | 1 - > drivers/net/ethernet/mscc/ocelot_vsc7514.c | 3 ++- > drivers/net/ethernet/ni/nixge.c | 5 ++--- > drivers/net/ethernet/qualcomm/emac/emac-sgmii.c | 2 ++ > drivers/net/ethernet/qualcomm/emac/emac.c | 1 - > drivers/net/ethernet/qualcomm/qca_spi.c | 1 - > drivers/net/ethernet/qualcomm/qca_uart.c| 1 - > drivers/net/ethernet/renesas/ravb_main.c| 3 +-- > drivers/net/ethernet/renesas/rswitch.c | 3 +-- > drivers/net/ethernet/renesas/sh_eth.c | 2 -- > drivers/net/ethernet/smsc/smsc911x.c| 1 - > drivers/net/ethernet/socionext/sni_ave.c| 3 ++- > drivers/net/ethernet/stmicro/stmmac/dwmac-dwc-qos-eth.c | 2 +- > drivers/net/ethernet/stmicro/stmmac/dwmac-imx.c | 1 - > drivers/net/ethernet/stmicro/stmmac/dwmac-ingenic.c | 1 - > drivers/net/ethernet/stmicro/stmmac/dwmac-mediatek.c| 2 +- > drivers/net/ethernet/stmicro/stmmac/dwmac-meson8b.c | 2 +- > drivers/net/ethernet/stmicro/stmmac/dwmac-oxnas.c | 1 - > drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c | 1 - > drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c | 2 +- > drivers/net/ethernet/stmicro/stmmac/dwmac-starfive.c| 4 +++- > drivers/net/ethernet/stmicro/stmmac/dwmac-sti.c | 1 - > drivers/net/ethernet/stmicro/stmmac/dwmac-stm32.c | 1 - > drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c | 3 ++- > drivers/net/ethernet/stmicro/stmmac/dwmac-tegra.c | 2 +- > drivers/net/ethernet/stmicro/stmmac/dwmac-visconti.c| 3 ++- > drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c | 1 - > drivers/net/ethernet/sun/niu.c | 2 +- > drivers/net/ethernet/sun/sunbmac.c | 2 +- > drivers/net/ethernet/sun/sungem.c | 1 + > drivers/net/ethernet/sun/sunhme.c | 3 ++- > drivers/net/ethernet/sun/sunqe.c| 2 +- > drivers/net/ethernet/ti/am65-cpsw-nuss.c| 1 + > drivers/net/ethernet/ti/cpsw-common.c | 1 - > drivers/net/ethernet/ti/cpsw-phy-sel.c | 1 - > drivers/net/ethernet/ti/davinci_mdio.c | 1 - > drivers/net/ethernet/via/via-rhine.c| 2 +- > drivers/net/ethernet/via/via-velocity.c | 2 +- > drivers/net/ethernet/xilinx/ll_temac.h | 1 + > drivers/net/ethernet/xilinx/ll_temac_main.c | 4 +--- > drivers/net/ethernet/xilinx/ll_temac_mdio.c | 2 +- > drivers/net/ethernet/xilinx/xilinx_axienet_main.c | 3 ++- > drivers/net/ethernet/xilinx/xilinx_emaclite.c | 4 ++-- > drivers/net/ieee802154/ca8210.c | 1 - > drivers/net/ipa/ipa_main.c | 2 +- > drivers/net/pcs/pcs-rzn1-miic.c | 1 + > drivers/net/phy/marvell-88x.c | 1 - > drivers/net/phy/mediatek-ge-soc.c | 2 -- > drivers/net/wireless/ath/ath10k/ahb.c | 2 +- > drivers/net/wireless/ath/ath11k/qmi.c | 1 - > drivers/net/wireless/ath/wcn36xx/main.c | 3 +-- > drivers/net/wireless/intersil/orinoco/airport.c | 2 +- > drivers/net/wireless/mediatek/mt76/mt7915/soc.c | 1 - > drivers/net/wireless/silabs/wfx/bus_sdio.c | 2 +- > net/core/of_net.c | 1 + > 124 files changed, 110 insertions(+), 120 deletions(-) > [...] > diff --git a/drivers/net/wireless/silabs/wfx/bus_sdio.c > b/drivers/net/wireless/silabs/wfx/bus_sdio.c > index 51a0d58a9070..909d5f346a01 100644 > --- a/drivers/net/wireless/silabs/wfx/bus_sdio.c > +++ b/drivers/net/wireless/silabs/wfx/bus_sdio.c > @@ -10,7 +10,7 @@ > #include > #include > #include > -#include > +#include > #include > #include > #include For 'drivers/net/wireless/silabs/wfx/bus_sdio.c': Reviewed-by: Jérôme Pouiller -- Jérôme Pouiller
[PATCH] Remove nested function
Some toolchains dislike nested function definition, so we define function match outside of of_phy_find_device. Signed-off-by: Jérôme Pouiller j...@sysmic.org --- drivers/of/of_mdio.c | 13 +++-- 1 files changed, 7 insertions(+), 6 deletions(-) diff --git a/drivers/of/of_mdio.c b/drivers/of/of_mdio.c index bacaa53..4b22ba5 100644 --- a/drivers/of/of_mdio.c +++ b/drivers/of/of_mdio.c @@ -97,6 +97,12 @@ int of_mdiobus_register(struct mii_bus *mdio, struct device_node *np) } EXPORT_SYMBOL(of_mdiobus_register); +/* Helper function for of_phy_find_device */ +static int of_phy_match(struct device *dev, void *phy_np) +{ + return dev_archdata_get_node(dev-archdata) == phy_np; +} + /** * of_phy_find_device - Give a PHY node, find the phy_device * @phy_np: Pointer to the phy's device tree node @@ -106,15 +112,10 @@ EXPORT_SYMBOL(of_mdiobus_register); struct phy_device *of_phy_find_device(struct device_node *phy_np) { struct device *d; - int match(struct device *dev, void *phy_np) - { - return dev_archdata_get_node(dev-archdata) == phy_np; - } - if (!phy_np) return NULL; - d = bus_find_device(mdio_bus_type, NULL, phy_np, match); + d = bus_find_device(mdio_bus_type, NULL, phy_np, of_phy_match); return d ? to_phy_device(d) : NULL; } EXPORT_SYMBOL(of_phy_find_device); -- 1.6.0.4 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: Nested function in drivers/of/of_mdio.c
I did some grep on codebase. I have not found any other instances of nested functions, but my regexps are not enough to be 100% sure. On Wednesday 07 October 2009 18:23:04 v...@vsbe.com wrote: Guys, are there other instances of nested C functions in the codebase or was this the first attempt? On Wed, Oct 7, 2009 at 9:11 AM, Grant Likely grant.lik...@secretlab.ca wrote: On Wed, Oct 7, 2009 at 9:15 AM, Jérôme Pouiller j...@sysmic.org wrote: Dear, I have a problem with commit 8bc487d150b939e69830c39322df4ee486efe381 in file drivers/of/of_mdio.c in function of_phy_find_device. As you see, this function define match() as a nested function. My compiler (powerpc-e500-linux-gnu-gcc-3.4.1) raise an error during link due to this nested definition: drivers/built-in.o(.text+0x5e2a4): In function `of_phy_find_device': /home/jezz/linux-next/drivers/of/of_mdio.c:107: undefined reference to `__trampoline_setup' I am sure I could solve problem by rebuilding my toolchain. Nevertheless, I think nested function definition is not perfectly supported by all compilers. Also, I suggest to place function match() outside of scope of of_phy_find_device as in following patch. I'm okay with that, but if you're moving code out of the file scope, then please rename the function to of_phy_match() to avoid global namespace conflicts. g. diff --git a/drivers/of/of_mdio.c b/drivers/of/of_mdio.c index bacaa53..c7b2e26 100644 --- a/drivers/of/of_mdio.c +++ b/drivers/of/of_mdio.c @@ -97,6 +97,10 @@ int of_mdiobus_register(struct mii_bus *mdio, struct device_node *np) } EXPORT_SYMBOL(of_mdiobus_register); +static int match(struct device *dev, void *phy_np) +{ + return dev_archdata_get_node(dev-archdata) == phy_np; +} /** * of_phy_find_device - Give a PHY node, find the phy_device * @phy_np: Pointer to the phy's device tree node @@ -106,11 +110,6 @@ EXPORT_SYMBOL(of_mdiobus_register); struct phy_device *of_phy_find_device(struct device_node *phy_np) { struct device *d; - int match(struct device *dev, void *phy_np) - { - return dev_archdata_get_node(dev-archdata) == phy_np; - } - if (!phy_np) return NULL; What do you think about it? Best regards, -- Jérôme Pouiller (jezz AT sysmic DOT org) -- Grant Likely, B.Sc., P.Eng. Secret Lab Technologies Ltd. ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev -- Jérôme Pouiller (jerome AT sysmic DOT org) Expert Linux Embarqué ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Nested function in drivers/of/of_mdio.c
Dear, I have a problem with commit 8bc487d150b939e69830c39322df4ee486efe381 in file drivers/of/of_mdio.c in function of_phy_find_device. As you see, this function define match() as a nested function. My compiler (powerpc-e500-linux-gnu-gcc-3.4.1) raise an error during link due to this nested definition: drivers/built-in.o(.text+0x5e2a4): In function `of_phy_find_device': /home/jezz/linux-next/drivers/of/of_mdio.c:107: undefined reference to `__trampoline_setup' I am sure I could solve problem by rebuilding my toolchain. Nevertheless, I think nested function definition is not perfectly supported by all compilers. Also, I suggest to place function match() outside of scope of of_phy_find_device as in following patch. diff --git a/drivers/of/of_mdio.c b/drivers/of/of_mdio.c index bacaa53..c7b2e26 100644 --- a/drivers/of/of_mdio.c +++ b/drivers/of/of_mdio.c @@ -97,6 +97,10 @@ int of_mdiobus_register(struct mii_bus *mdio, struct device_node *np) } EXPORT_SYMBOL(of_mdiobus_register); +static int match(struct device *dev, void *phy_np) +{ + return dev_archdata_get_node(dev-archdata) == phy_np; +} /** * of_phy_find_device - Give a PHY node, find the phy_device * @phy_np: Pointer to the phy's device tree node @@ -106,11 +110,6 @@ EXPORT_SYMBOL(of_mdiobus_register); struct phy_device *of_phy_find_device(struct device_node *phy_np) { struct device *d; - int match(struct device *dev, void *phy_np) - { - return dev_archdata_get_node(dev-archdata) == phy_np; - } - if (!phy_np) return NULL; What do you think about it? Best regards, -- Jérôme Pouiller (jezz AT sysmic DOT org) ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev