summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorTroy Kisky <troy.kisky@boundarydevices.com>2012-10-22 16:40:44 +0000
committerStefano Babic <sbabic@denx.de>2013-01-28 06:57:50 +0100
commitef8e3a3bbf0720068b7bf6e4f182c17679f94fa2 (patch)
treeb98576471f444d7ad0ca1dd8409125bebb296126 /drivers
parent1adb406b014176f0c1a925e4d3e9aae556dfe571 (diff)
net: fec_mxc: use fec_set_dev_name to set name
This allows us to create the phydev before calling fec_probe in later patch. Signed-off-by: Troy Kisky <troy.kisky@boundarydevices.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/fec_mxc.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/drivers/net/fec_mxc.c b/drivers/net/fec_mxc.c
index f7384ad7087..7e2721070ef 100644
--- a/drivers/net/fec_mxc.c
+++ b/drivers/net/fec_mxc.c
@@ -915,6 +915,11 @@ static int fec_recv(struct eth_device *dev)
return len;
}
+static void fec_set_dev_name(char *dest, int dev_id)
+{
+ sprintf(dest, (dev_id == -1) ? "FEC" : "FEC%i", dev_id);
+}
+
static int fec_probe(bd_t *bd, int dev_id, int phy_id, uint32_t base_addr)
{
struct eth_device *edev;
@@ -967,13 +972,8 @@ static int fec_probe(bd_t *bd, int dev_id, int phy_id, uint32_t base_addr)
fec_reg_setup(fec);
- if (dev_id == -1) {
- sprintf(edev->name, "FEC");
- fec->dev_id = 0;
- } else {
- sprintf(edev->name, "FEC%i", dev_id);
- fec->dev_id = dev_id;
- }
+ fec_set_dev_name(edev->name, dev_id);
+ fec->dev_id = (dev_id == -1) ? 0 : dev_id;
fec->phy_id = phy_id;
bus = mdio_alloc();
@@ -984,7 +984,7 @@ static int fec_probe(bd_t *bd, int dev_id, int phy_id, uint32_t base_addr)
}
bus->read = fec_phy_read;
bus->write = fec_phy_write;
- sprintf(bus->name, edev->name);
+ fec_set_dev_name(bus->name, dev_id);
#ifdef CONFIG_MX28
/*
* The i.MX28 has two ethernet interfaces, but they are not equal.