Skip to content

Commit

Permalink
of: Remove nested function
Browse files Browse the repository at this point in the history
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>
Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
  • Loading branch information
Jérôme Pouiller authored and Grant Likely committed Oct 15, 2009
1 parent 830cb6f commit 08a7963
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions drivers/of/of_mdio.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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);
Expand Down

0 comments on commit 08a7963

Please sign in to comment.