Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

of: Remove nested function

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>

authored by

Jérôme Pouiller and committed by
Grant Likely
08a7963a 830cb6fa

+7 -6
+7 -6
drivers/of/of_mdio.c
··· 97 97 } 98 98 EXPORT_SYMBOL(of_mdiobus_register); 99 99 100 + /* Helper function for of_phy_find_device */ 101 + static int of_phy_match(struct device *dev, void *phy_np) 102 + { 103 + return dev_archdata_get_node(&dev->archdata) == phy_np; 104 + } 105 + 100 106 /** 101 107 * of_phy_find_device - Give a PHY node, find the phy_device 102 108 * @phy_np: Pointer to the phy's device tree node ··· 112 106 struct phy_device *of_phy_find_device(struct device_node *phy_np) 113 107 { 114 108 struct device *d; 115 - int match(struct device *dev, void *phy_np) 116 - { 117 - return dev_archdata_get_node(&dev->archdata) == phy_np; 118 - } 119 - 120 109 if (!phy_np) 121 110 return NULL; 122 111 123 - d = bus_find_device(&mdio_bus_type, NULL, phy_np, match); 112 + d = bus_find_device(&mdio_bus_type, NULL, phy_np, of_phy_match); 124 113 return d ? to_phy_device(d) : NULL; 125 114 } 126 115 EXPORT_SYMBOL(of_phy_find_device);