From patchwork Wed Oct 7 15:15:57 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?SsOpcsO0bWUgUG91aWxsZXI=?= X-Patchwork-Id: 35308 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by ozlabs.org (Postfix) with ESMTP id 9A9F2B7B92 for ; Thu, 8 Oct 2009 02:33:24 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759258AbZJGP0p (ORCPT ); Wed, 7 Oct 2009 11:26:45 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1754969AbZJGP0p (ORCPT ); Wed, 7 Oct 2009 11:26:45 -0400 Received: from sysmic.org ([88.191.45.54]:55183 "EHLO draco.sysmic.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752850AbZJGP0o convert rfc822-to-8bit (ORCPT ); Wed, 7 Oct 2009 11:26:44 -0400 X-Greylist: delayed 603 seconds by postgrey-1.27 at vger.kernel.org; Wed, 07 Oct 2009 11:26:44 EDT Received: by draco.sysmic.org (Postfix, from userid 65534) id 51B6D322F5; Wed, 7 Oct 2009 17:16:04 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on draco X-Spam-Level: X-Spam-Status: No, score=-1.4 required=5.0 tests=ALL_TRUSTED autolearn=failed version=3.2.5 Received: from aquila.localnet (cev75-4-82-247-117-217.fbx.proxad.net [82.247.117.217]) (Authenticated sender: jezz) by draco.sysmic.org (Postfix) with ESMTPSA id 9EF04322F0; Wed, 7 Oct 2009 17:15:57 +0200 (CEST) To: Grant Likely Subject: Nested function in drivers/of/of_mdio.c Cc: "David S. Miller" , Andy Fleming , netdev , linuxppc From: =?iso-8859-1?q?J=E9r=F4me_Pouiller?= Organization: Freelance Date: Wed, 7 Oct 2009 17:15:57 +0200 MIME-Version: 1.0 Message-Id: <200910071715.57249.jezz@sysmic.org> Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org 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. What do you think about it? Best regards, 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;