kernel: update linux 3.3 to 3.3.2
[openwrt/svn-archive/archive.git] / target / linux / lantiq / patches-3.3 / 0016-NET-MIPS-lantiq-non-existing-phy-was-not-handled-gra.patch
1 From d6a9d52bfcc2d8f163e95920cf3678847bb97f18 Mon Sep 17 00:00:00 2001
2 From: John Crispin <blogic@openwrt.org>
3 Date: Tue, 15 Nov 2011 14:52:21 +0100
4 Subject: [PATCH 16/70] NET: MIPS: lantiq: non existing phy was not handled
5 gracefully
6
7 The code blindly assumed that that a PHY device was present causing a BadVA.
8 In addition the driver should not fail to load incase no PHY was found.
9 Instead we print the following line and continue with no attached PHY.
10
11 etop: mdio probe failed
12
13 Signed-off-by: John Crispin <blogic@openwrt.org>
14 Cc: netdev@vger.kernel.org
15 ---
16 drivers/net/ethernet/lantiq_etop.c | 14 ++++++++------
17 1 files changed, 8 insertions(+), 6 deletions(-)
18
19 --- a/drivers/net/ethernet/lantiq_etop.c
20 +++ b/drivers/net/ethernet/lantiq_etop.c
21 @@ -614,7 +614,8 @@ ltq_etop_open(struct net_device *dev)
22 ltq_dma_open(&ch->dma);
23 napi_enable(&ch->napi);
24 }
25 - phy_start(priv->phydev);
26 + if (priv->phydev)
27 + phy_start(priv->phydev);
28 netif_tx_start_all_queues(dev);
29 return 0;
30 }
31 @@ -626,7 +627,8 @@ ltq_etop_stop(struct net_device *dev)
32 int i;
33
34 netif_tx_stop_all_queues(dev);
35 - phy_stop(priv->phydev);
36 + if (priv->phydev)
37 + phy_stop(priv->phydev);
38 for (i = 0; i < MAX_DMA_CHAN; i++) {
39 struct ltq_etop_chan *ch = &priv->ch[i];
40
41 @@ -772,9 +774,10 @@ ltq_etop_init(struct net_device *dev)
42 if (err)
43 goto err_netdev;
44 ltq_etop_set_multicast_list(dev);
45 - err = ltq_etop_mdio_init(dev);
46 - if (err)
47 - goto err_netdev;
48 + if (!ltq_etop_mdio_init(dev))
49 + dev->ethtool_ops = &ltq_etop_ethtool_ops;
50 + else
51 + pr_warn("etop: mdio probe failed\n");;
52 return 0;
53
54 err_netdev:
55 @@ -870,7 +873,6 @@ ltq_etop_probe(struct platform_device *p
56 dev = alloc_etherdev_mq(sizeof(struct ltq_etop_priv), 4);
57 strcpy(dev->name, "eth%d");
58 dev->netdev_ops = &ltq_eth_netdev_ops;
59 - dev->ethtool_ops = &ltq_etop_ethtool_ops;
60 priv = netdev_priv(dev);
61 priv->res = res;
62 priv->pdev = pdev;