[PATCH] phy: Added a macro to represent the string format used to match a phy device

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>

authored by Kumar Gala and committed by Jeff Garzik a4d00f17 1d532677

+5 -2
+1 -1
drivers/net/phy/mdio_bus.c
··· 81 82 phydev->dev.parent = bus->dev; 83 phydev->dev.bus = &mdio_bus_type; 84 - sprintf(phydev->dev.bus_id, "phy%d:%d", bus->id, i); 85 86 phydev->bus = bus; 87
··· 81 82 phydev->dev.parent = bus->dev; 83 phydev->dev.bus = &mdio_bus_type; 84 + snprintf(phydev->dev.bus_id, BUS_ID_SIZE, PHY_ID_FMT, bus->id, i); 85 86 phydev->bus = bus; 87
+1 -1
drivers/net/phy/phy.c
··· 42 */ 43 void phy_print_status(struct phy_device *phydev) 44 { 45 - pr_info("%s: Link is %s", phydev->dev.bus_id, 46 phydev->link ? "Up" : "Down"); 47 if (phydev->link) 48 printk(" - %d/%s", phydev->speed,
··· 42 */ 43 void phy_print_status(struct phy_device *phydev) 44 { 45 + pr_info("PHY: %s - Link is %s", phydev->dev.bus_id, 46 phydev->link ? "Up" : "Down"); 47 if (phydev->link) 48 printk(" - %d/%s", phydev->speed,
+3
include/linux/phy.h
··· 53 54 #define PHY_MAX_ADDR 32 55 56 /* The Bus class for PHYs. Devices which provide access to 57 * PHYs should register using this structure */ 58 struct mii_bus {
··· 53 54 #define PHY_MAX_ADDR 32 55 56 + /* Used when trying to connect to a specific phy (mii bus id:phy device id) */ 57 + #define PHY_ID_FMT "%x:%02x" 58 + 59 /* The Bus class for PHYs. Devices which provide access to 60 * PHYs should register using this structure */ 61 struct mii_bus {