linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: "Jérôme Pouiller" <jezz@sysmic.org>
To: Grant Likely <grant.likely@secretlab.ca>
Cc: netdev <netdev@vger.kernel.org>,
	linuxppc <linuxppc-dev@lists.ozlabs.org>,
	"Andy Fleming" <afleming@freescale.com>,
	"Jérôme Pouiller" <jezz@sysmic.org>,
	"David S. Miller" <davem@davemloft.net>
Subject: [PATCH] Remove nested function
Date: Thu,  8 Oct 2009 10:34:23 +0200	[thread overview]
Message-ID: <1254990863-15271-1-git-send-email-jezz@sysmic.org> (raw)
In-Reply-To: <fa686aa40910070911x769d7d41u908fbcf6b0980962@mail.gmail.com>

Some toolchains dislike nested function definition, so we define function match
outside of of_phy_find_device.

Signed-off-by: Jérôme Pouiller <jezz@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

  parent reply	other threads:[~2009-10-08  8:34 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-10-07 15:15 Nested function in drivers/of/of_mdio.c Jérôme Pouiller
2009-10-07 16:11 ` Grant Likely
2009-10-07 16:23   ` vb
2009-10-08  8:45     ` Jérôme Pouiller
2009-10-08 11:14       ` Gabriel Paubert
2009-10-08  8:34   ` Jérôme Pouiller [this message]
2009-10-08  9:10     ` [PATCH] Remove nested function David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1254990863-15271-1-git-send-email-jezz@sysmic.org \
    --to=jezz@sysmic.org \
    --cc=afleming@freescale.com \
    --cc=davem@davemloft.net \
    --cc=grant.likely@secretlab.ca \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).