linux-mips
[Top] [All Lists]

[PATCH 1/5] cpmac: fix wrong MDIO bus identifier

To: Ralf Baechle <ralf@linux-mips.org>
Subject: [PATCH 1/5] cpmac: fix wrong MDIO bus identifier
From: Florian Fainelli <florian@openwrt.org>
Date: Tue, 4 Aug 2009 22:52:41 +0200
Cc: linux-mips@linux-mips.org, netdev@vger.kernel.org, David Miller <davem@davemloft.net>
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:sender:from:date:subject :mime-version:x-uid:x-length:to:cc:content-type :content-transfer-encoding:content-disposition:message-id; bh=xtQWb8HhG85u4wsk8TcRUU0J0z1npIHIn5m5jT4r+Oo=; b=xzHqjHOUhEEhl/ykL4BVj0SGJYsEfPU0LNJCy91LlRedMEZ5Gm2QGrxo5S/Hc52pvj Q7G05HJ2DStDSV3oocnzknAScnyM6vYAXRDDGUm2esBi995bMimseBMojCdOeoodACqw SIBtJQfK948wvO+tQiuBbDbF4SUkZ5FbhzSxY=
Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=sender:from:date:subject:mime-version:x-uid:x-length:to:cc :content-type:content-transfer-encoding:content-disposition :message-id; b=HtnnDIwjECOyKTQ9F0UvLB0jKPnS4dbrrOX6hNhcksgDEqq4gaXF29vCxqYe5sNeff xVxVQa64NsQ8Lt1peCmWwMIGj5FprfKotNNMov+Cb+6zT7WMKcCum1TPNaaFogQA4sp9 QnxBhwZ1Av5DVfdEbZJtwQJeafK9KrD+kSq+Q=
Original-recipient: rfc822;linux-mips@linux-mips.org
Sender: linux-mips-bounce@linux-mips.org
This patch fixes the wrong MDIO bus identifier which was
set to 0 unconditionaly, suitable for external switches while
it is actually 1 for PHYs different than external switches
which are autodetected.

Signed-off-by: Florian Fainelli <florian@openwrt.org>
---
diff --git a/drivers/net/cpmac.c b/drivers/net/cpmac.c
index fd5e32c..c951dd4 100644
--- a/drivers/net/cpmac.c
+++ b/drivers/net/cpmac.c
@@ -1109,7 +1109,7 @@ static int external_switch;
 static int __devinit cpmac_probe(struct platform_device *pdev)
 {
        int rc, phy_id;
-       char *mdio_bus_id = "0";
+       char mdio_bus_id[BUS_ID_SIZE];
        struct resource *mem;
        struct cpmac_priv *priv;
        struct net_device *dev;
@@ -1127,7 +1127,7 @@ static int __devinit cpmac_probe(struct platform_device 
*pdev)
 
        if (phy_id == PHY_MAX_ADDR) {
                if (external_switch || dumb_switch) {
-                       mdio_bus_id = 0; /* fixed phys bus */
+                       strncpy(mdio_bus_id, "0", BUS_ID_SIZE); /* fixed phys 
bus */
                        phy_id = pdev->id;
                } else {
                        dev_err(&pdev->dev, "no PHY present\n");
@@ -1254,7 +1254,7 @@ int __devinit cpmac_init(void)
        }
 
        cpmac_mii->phy_mask = ~(mask | 0x80000000);
-       snprintf(cpmac_mii->id, MII_BUS_ID_SIZE, "0");
+       snprintf(cpmac_mii->id, MII_BUS_ID_SIZE, "1");
 
        res = mdiobus_register(cpmac_mii);
        if (res)

<Prev in Thread] Current Thread [Next in Thread>