]> err.no Git - linux-2.6/commitdiff
r8169: fix a race between PCI probe and dev_open
authorFrancois Romieu <romieu@fr.zoreil.com>
Thu, 8 Mar 2007 23:00:05 +0000 (00:00 +0100)
committerJeff Garzik <jeff@garzik.org>
Fri, 9 Mar 2007 16:51:32 +0000 (11:51 -0500)
Initialize the timer with the rest of the private-struct.

Signed-off-by: Jeff Garzik <jeff@garzik.org>
Signed-off-by: Francois Romieu <romieu@fr.zoreil.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
drivers/net/r8169.c

index 6693a305bcceb52f37120b4236ebb870e88b0f55..521b5f0618a4a904a4d736d2263a6573eb9dbd5e 100644 (file)
@@ -1368,11 +1368,7 @@ static inline void rtl8169_request_timer(struct net_device *dev)
            (tp->phy_version >= RTL_GIGA_PHY_VER_H))
                return;
 
-       init_timer(timer);
-       timer->expires = jiffies + RTL8169_PHY_TIMEOUT;
-       timer->data = (unsigned long)(dev);
-       timer->function = rtl8169_phy_timer;
-       add_timer(timer);
+       mod_timer(timer, jiffies + RTL8169_PHY_TIMEOUT);
 }
 
 #ifdef CONFIG_NET_POLL_CONTROLLER
@@ -1685,6 +1681,10 @@ rtl8169_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
        tp->mmio_addr = ioaddr;
        tp->align = rtl_cfg_info[ent->driver_data].align;
 
+       init_timer(&tp->timer);
+       tp->timer.data = (unsigned long) dev;
+       tp->timer.function = rtl8169_phy_timer;
+
        spin_lock_init(&tp->lock);
 
        rc = register_netdev(dev);