Patchwork Remove nested function

login
register
mail settings
Submitter Jérôme Pouiller
Date Oct. 8, 2009, 8:34 a.m.
Message ID <1254990863-15271-1-git-send-email-jezz@sysmic.org>
Download mbox | patch
Permalink /patch/35415/
State Accepted, archived
Commit 08a7963aad03b5cf515f1e9c35e0ac9eb7dae072
Delegated to: Grant Likely
Headers show

Comments

Jérôme Pouiller - Oct. 8, 2009, 8:34 a.m.
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(-)
David Miller - Oct. 8, 2009, 9:10 a.m.
From: Jérôme Pouiller <jezz@sysmic.org>
Date: Thu,  8 Oct 2009 10:34:23 +0200

> 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>

Acked-by: David S. Miller <davem@davemloft.net>

Patch

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);