[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1344940135-17079-3-git-send-email-shchepetkov@ispras.ru>
Date: Tue, 14 Aug 2012 14:28:52 +0400
From: Ilya Shchepetkov <shchepetkov@...ras.ru>
To: Grant Grundler <grundler@...isc-linux.org>
Cc: Ilya Shchepetkov <shchepetkov@...ras.ru>,
"David S. Miller" <davem@...emloft.net>, netdev@...r.kernel.org,
linux-kernel@...r.kernel.org, ldv-project@...ras.ru
Subject: [PATCH 2/5] de2104x: Call netif_carrier_off() after register_netdev()
For carrier detection to work properly when binding the driver with a
cable unplugged, netif_carrier_off() should be called after
register_netdev(), not before.
Calling netif_carrier_off() before register_netdev() was causing the
network interface to miss a linkwatch pending event leading to an
inconsistent state if the link is not up when interface is initialized.
Found by Linux Driver Verification project (linuxtesting.org).
Signed-off-by: Ilya Shchepetkov <shchepetkov@...ras.ru>
---
drivers/net/ethernet/dec/tulip/de2104x.c | 5 +++--
1 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/dec/tulip/de2104x.c b/drivers/net/ethernet/dec/tulip/de2104x.c
index 61cc093..237f254 100644
--- a/drivers/net/ethernet/dec/tulip/de2104x.c
+++ b/drivers/net/ethernet/dec/tulip/de2104x.c
@@ -2005,8 +2005,6 @@ static int __devinit de_init_one (struct pci_dev *pdev,
de->media_timer.function = de21041_media_timer;
de->media_timer.data = (unsigned long) de;
- netif_carrier_off(dev);
-
/* wake up device, assign resources */
rc = pci_enable_device(pdev);
if (rc)
@@ -2074,6 +2072,9 @@ static int __devinit de_init_one (struct pci_dev *pdev,
rc = register_netdev(dev);
if (rc)
goto err_out_iomap;
+
+ /* turn off carrier */
+ netif_carrier_off(dev);
/* print info about board and interface just registered */
netdev_info(dev, "%s at %p, %pM, IRQ %d\n",
--
1.7.7
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists