[<prev] [next>] [day] [month] [year] [list]
Message-ID: <fa686aa40910070755s519b479xa29aa7b9cccb2f84@mail.gmail.com>
Date: Wed, 7 Oct 2009 08:55:57 -0600
From: Grant Likely <grant.likely@...retlab.ca>
To: Jérôme Pouiller <jezz@...mic.org>
Cc: "David S. Miller" <davem@...emloft.net>,
Andy Fleming <afleming@...escale.com>,
netdev <netdev@...r.kernel.org>
Subject: Re: Nested function in drivers/of/of_mdio.c
Please resend your question with both linuxppc-dev@...ts.ozlabs.org
and netdev@...r.kernel.org added to the cc: list.
g.
On Wed, Oct 7, 2009 at 8:29 AM, Jérôme Pouiller <jezz@...mic.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.
>
> 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.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists