summaryrefslogtreecommitdiffstats
path: root/drivers/net/phy/phy.c
diff options
context:
space:
mode:
authorAndrey Smirnov <andrew.smirnov@gmail.com>2016-01-31 19:10:12 -0800
committerSascha Hauer <s.hauer@pengutronix.de>2016-02-03 08:36:33 +0100
commit993a28aa48f26da8d7e06ee4c3011c66c47df8c9 (patch)
treecc1a4c4284eaf5f72b68fd8ae2d770a41edced56 /drivers/net/phy/phy.c
parentb88381df6ef2930fb6072489b93b1fc31257162a (diff)
downloadbarebox-993a28aa48f26da8d7e06ee4c3011c66c47df8c9.tar.gz
barebox-993a28aa48f26da8d7e06ee4c3011c66c47df8c9.tar.xz
mdio_bus: Change PHY's naming scheme
Change the way PHY devices are named upon creation. This commit replaces sequentialy numbered "/dev/phy%d" with "/dev/mdio%d-phy%02x". This way it is significanlty easier to identify which PHY in real-life (e.g. on a schematic) corresponds to which device in /dev. Also, replace asprintf with xasprintf to provide some form of memory allocation failure checking. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'drivers/net/phy/phy.c')
-rw-r--r--drivers/net/phy/phy.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
index 25c999c550..d128a5e8d5 100644
--- a/drivers/net/phy/phy.c
+++ b/drivers/net/phy/phy.c
@@ -168,8 +168,10 @@ static struct phy_device *phy_device_create(struct mii_bus *bus, int addr, int p
phydev->bus = bus;
phydev->dev.bus = &mdio_bus_type;
- strcpy(phydev->dev.name, "phy");
- phydev->dev.id = DEVICE_ID_DYNAMIC;
+ sprintf(phydev->dev.name, "mdio%d-phy%02x",
+ phydev->bus->dev.id,
+ phydev->addr);
+ phydev->dev.id = DEVICE_ID_SINGLE;
return phydev;
}