aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/phy
diff options
context:
space:
mode:
authorJiri Pirko <jpirko@redhat.com>2010-02-04 13:23:02 -0500
committerDavid S. Miller <davem@davemloft.net>2010-02-04 13:23:02 -0500
commitf8f76db1db369f3a130ac3fd33e2eee5f1610d9c (patch)
tree808ba0be71bc55335afca100fc857d7f4e937b46 /drivers/net/phy
parent6683ece36e3531fc8c75f69e7165c5f20930be88 (diff)
libphy: add phy_find_first function
Many drivers do this in them manually. Now they can use this function. Signed-off-by: Jiri Pirko <jpirko@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/phy')
-rw-r--r--drivers/net/phy/phy_device.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c
index adbc0fded130..db1794546c56 100644
--- a/drivers/net/phy/phy_device.c
+++ b/drivers/net/phy/phy_device.c
@@ -277,6 +277,22 @@ int phy_device_register(struct phy_device *phydev)
277EXPORT_SYMBOL(phy_device_register); 277EXPORT_SYMBOL(phy_device_register);
278 278
279/** 279/**
280 * phy_find_first - finds the first PHY device on the bus
281 * @bus: the target MII bus
282 */
283struct phy_device *phy_find_first(struct mii_bus *bus)
284{
285 int addr;
286
287 for (addr = 0; addr < PHY_MAX_ADDR; addr++) {
288 if (bus->phy_map[addr])
289 return bus->phy_map[addr];
290 }
291 return NULL;
292}
293EXPORT_SYMBOL(phy_find_first);
294
295/**
280 * phy_prepare_link - prepares the PHY layer to monitor link status 296 * phy_prepare_link - prepares the PHY layer to monitor link status
281 * @phydev: target phy_device struct 297 * @phydev: target phy_device struct
282 * @handler: callback function for link status change notifications 298 * @handler: callback function for link status change notifications