diff options
| -rw-r--r-- | drivers/net/phy/phy_device.c | 16 | ||||
| -rw-r--r-- | include/linux/phy.h | 1 |
2 files changed, 17 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) | |||
| 277 | EXPORT_SYMBOL(phy_device_register); | 277 | EXPORT_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 | */ | ||
| 283 | struct 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 | } | ||
| 293 | EXPORT_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 |
diff --git a/include/linux/phy.h b/include/linux/phy.h index 6a7eb402165d..14d7fdf6a90a 100644 --- a/include/linux/phy.h +++ b/include/linux/phy.h | |||
| @@ -452,6 +452,7 @@ int phy_attach_direct(struct net_device *dev, struct phy_device *phydev, | |||
| 452 | u32 flags, phy_interface_t interface); | 452 | u32 flags, phy_interface_t interface); |
| 453 | struct phy_device * phy_attach(struct net_device *dev, | 453 | struct phy_device * phy_attach(struct net_device *dev, |
| 454 | const char *bus_id, u32 flags, phy_interface_t interface); | 454 | const char *bus_id, u32 flags, phy_interface_t interface); |
| 455 | struct phy_device *phy_find_first(struct mii_bus *bus); | ||
| 455 | int phy_connect_direct(struct net_device *dev, struct phy_device *phydev, | 456 | int phy_connect_direct(struct net_device *dev, struct phy_device *phydev, |
| 456 | void (*handler)(struct net_device *), u32 flags, | 457 | void (*handler)(struct net_device *), u32 flags, |
| 457 | phy_interface_t interface); | 458 | phy_interface_t interface); |
