Skip to content

Commit

Permalink
net: tulip: Use setup_timer()
Browse files Browse the repository at this point in the history
Convert a call to init_timer and accompanying intializations of
the timer's data and function fields to a call to setup_timer.

The Coccinelle semantic patch that fixes this problem is
as follows:

// <smpl>
@@
expression t,f,d;
@@

-init_timer(&t);
+setup_timer(&t,f,d);
-t.data = d;
-t.function = f;
// </smpl>

Signed-off-by: Amitoj Kaur Chawla <amitoj1606@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Amitoj Kaur Chawla authored and David S. Miller committed Feb 25, 2016
1 parent 4b69d87 commit 5327ef9
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions drivers/net/ethernet/dec/tulip/tulip_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -505,9 +505,7 @@ static void tulip_up(struct net_device *dev)
tp->timer.expires = RUN_AT(next_tick);
add_timer(&tp->timer);
#ifdef CONFIG_TULIP_NAPI
init_timer(&tp->oom_timer);
tp->oom_timer.data = (unsigned long)dev;
tp->oom_timer.function = oom_timer;
setup_timer(&tp->oom_timer, oom_timer, (unsigned long)dev);
#endif
}

Expand Down Expand Up @@ -782,9 +780,8 @@ static void tulip_down (struct net_device *dev)

spin_unlock_irqrestore (&tp->lock, flags);

init_timer(&tp->timer);
tp->timer.data = (unsigned long)dev;
tp->timer.function = tulip_tbl[tp->chip_id].media_timer;
setup_timer(&tp->timer, tulip_tbl[tp->chip_id].media_timer,
(unsigned long)dev);

dev->if_port = tp->saved_if_port;

Expand Down Expand Up @@ -1475,9 +1472,8 @@ static int tulip_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
tp->csr0 = csr0;
spin_lock_init(&tp->lock);
spin_lock_init(&tp->mii_lock);
init_timer(&tp->timer);
tp->timer.data = (unsigned long)dev;
tp->timer.function = tulip_tbl[tp->chip_id].media_timer;
setup_timer(&tp->timer, tulip_tbl[tp->chip_id].media_timer,
(unsigned long)dev);

INIT_WORK(&tp->media_work, tulip_tbl[tp->chip_id].media_task);

Expand Down

0 comments on commit 5327ef9

Please sign in to comment.