]> err.no Git - linux-2.6/commitdiff
[PATCH] phy: Added a macro to represent the string format used to match a phy device
authorKumar Gala <galak@gate.crashing.org>
Wed, 11 Jan 2006 19:27:33 +0000 (11:27 -0800)
committerJeff Garzik <jgarzik@pobox.com>
Thu, 12 Jan 2006 21:31:52 +0000 (16:31 -0500)
Add the PHY_ID_FMT macro to ensure that the format of the id string used by a
driver to match to its specific phy is consistent between the mdio_bus and the
driver.

Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Jeff Garzik <jgarzik@pobox.com>
drivers/net/phy/mdio_bus.c
drivers/net/phy/phy.c
include/linux/phy.h

index 02940c0fef680af5d913e7aac2af9d86337c42a2..459443b572cef542a6757c1f02443f6ee42cbe7f 100644 (file)
@@ -81,7 +81,7 @@ int mdiobus_register(struct mii_bus *bus)
 
                        phydev->dev.parent = bus->dev;
                        phydev->dev.bus = &mdio_bus_type;
-                       sprintf(phydev->dev.bus_id, "phy%d:%d", bus->id, i);
+                       snprintf(phydev->dev.bus_id, BUS_ID_SIZE, PHY_ID_FMT, bus->id, i);
 
                        phydev->bus = bus;
 
index b8686e47f8996470c780305e15905e434649dda2..1474b7c5ac0bd5c882c29a6d77fa0708aac664c5 100644 (file)
@@ -42,7 +42,7 @@
  */
 void phy_print_status(struct phy_device *phydev)
 {
-       pr_info("%s: Link is %s", phydev->dev.bus_id,
+       pr_info("PHY: %s - Link is %s", phydev->dev.bus_id,
                        phydev->link ? "Up" : "Down");
        if (phydev->link)
                printk(" - %d/%s", phydev->speed,
index 92a9696fdebe0ecb7bad1922bffe3c8e360026d5..331521a10a2d5072be85698afd37c1300016d53d 100644 (file)
@@ -53,6 +53,9 @@
 
 #define PHY_MAX_ADDR 32
 
+/* Used when trying to connect to a specific phy (mii bus id:phy device id) */
+#define PHY_ID_FMT "%x:%02x"
+
 /* The Bus class for PHYs.  Devices which provide access to
  * PHYs should register using this structure */
 struct mii_bus {