Skip to content

Commit 0822c5d

Browse files
keesdavem330
authored andcommitted
net: ethernet: sun: Convert timers to use timer_setup()
In preparation for unconditionally passing the struct timer_list pointer to all timer callbacks, switch to using the new timer_setup() and from_timer() to pass the timer pointer explicitly. Cc: "David S. Miller" <[email protected]> Cc: Philippe Reynes <[email protected]> Cc: Jarod Wilson <[email protected]> Cc: Shannon Nelson <[email protected]> Cc: Rob Herring <[email protected]> Cc: chris hyser <[email protected]> Cc: Tushar Dave <[email protected]> Cc: Tobias Klauser <[email protected]> Cc: [email protected] Signed-off-by: Kees Cook <[email protected]> Acked-by: Shannon Nelson <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent de892f8 commit 0822c5d

File tree

9 files changed

+24
-31
lines changed

9 files changed

+24
-31
lines changed

drivers/net/ethernet/sun/cassini.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4079,9 +4079,9 @@ static void cas_reset_task(struct work_struct *work)
40794079
#endif
40804080
}
40814081

4082-
static void cas_link_timer(unsigned long data)
4082+
static void cas_link_timer(struct timer_list *t)
40834083
{
4084-
struct cas *cp = (struct cas *) data;
4084+
struct cas *cp = from_timer(cp, t, link_timer);
40854085
int mask, pending = 0, reset = 0;
40864086
unsigned long flags;
40874087

@@ -5039,7 +5039,8 @@ static int cas_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
50395039
spin_lock_init(&cp->stat_lock[N_TX_RINGS]);
50405040
mutex_init(&cp->pm_mutex);
50415041

5042-
setup_timer(&cp->link_timer, cas_link_timer, (unsigned long)cp);
5042+
timer_setup(&cp->link_timer, cas_link_timer, 0);
5043+
50435044
#if 1
50445045
/* Just in case the implementation of atomic operations
50455046
* change so that an explicit initialization is necessary.

drivers/net/ethernet/sun/ldmvsw.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -363,8 +363,7 @@ static int vsw_port_probe(struct vio_dev *vdev, const struct vio_device_id *id)
363363
list_add_rcu(&port->list, &vp->port_list);
364364
spin_unlock_irqrestore(&vp->lock, flags);
365365

366-
setup_timer(&port->clean_timer, sunvnet_clean_timer_expire_common,
367-
(unsigned long)port);
366+
timer_setup(&port->clean_timer, sunvnet_clean_timer_expire_common, 0);
368367

369368
err = register_netdev(dev);
370369
if (err) {

drivers/net/ethernet/sun/niu.c

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2221,9 +2221,9 @@ static int niu_link_status(struct niu *np, int *link_up_p)
22212221
return err;
22222222
}
22232223

2224-
static void niu_timer(unsigned long __opaque)
2224+
static void niu_timer(struct timer_list *t)
22252225
{
2226-
struct niu *np = (struct niu *) __opaque;
2226+
struct niu *np = from_timer(np, t, timer);
22272227
unsigned long off;
22282228
int err, link_up;
22292229

@@ -6123,7 +6123,7 @@ static int niu_open(struct net_device *dev)
61236123

61246124
err = niu_init_hw(np);
61256125
if (!err) {
6126-
setup_timer(&np->timer, niu_timer, (unsigned long)np);
6126+
timer_setup(&np->timer, niu_timer, 0);
61276127
np->timer.expires = jiffies + HZ;
61286128

61296129
err = niu_enable_interrupts(np, 1);
@@ -6773,10 +6773,8 @@ static int niu_change_mtu(struct net_device *dev, int new_mtu)
67736773

67746774
err = niu_init_hw(np);
67756775
if (!err) {
6776-
init_timer(&np->timer);
6776+
timer_setup(&np->timer, niu_timer, 0);
67776777
np->timer.expires = jiffies + HZ;
6778-
np->timer.data = (unsigned long) np;
6779-
np->timer.function = niu_timer;
67806778

67816779
err = niu_enable_interrupts(np, 1);
67826780
if (err)

drivers/net/ethernet/sun/sunbmac.c

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -523,9 +523,9 @@ static int try_next_permutation(struct bigmac *bp, void __iomem *tregs)
523523
return -1;
524524
}
525525

526-
static void bigmac_timer(unsigned long data)
526+
static void bigmac_timer(struct timer_list *t)
527527
{
528-
struct bigmac *bp = (struct bigmac *) data;
528+
struct bigmac *bp = from_timer(bp, t, bigmac_timer);
529529
void __iomem *tregs = bp->tregs;
530530
int restart_timer = 0;
531531

@@ -613,8 +613,6 @@ static void bigmac_begin_auto_negotiation(struct bigmac *bp)
613613
bp->timer_state = ltrywait;
614614
bp->timer_ticks = 0;
615615
bp->bigmac_timer.expires = jiffies + (12 * HZ) / 10;
616-
bp->bigmac_timer.data = (unsigned long) bp;
617-
bp->bigmac_timer.function = bigmac_timer;
618616
add_timer(&bp->bigmac_timer);
619617
}
620618

@@ -921,7 +919,7 @@ static int bigmac_open(struct net_device *dev)
921919
printk(KERN_ERR "BIGMAC: Can't order irq %d to go.\n", dev->irq);
922920
return ret;
923921
}
924-
init_timer(&bp->bigmac_timer);
922+
timer_setup(&bp->bigmac_timer, bigmac_timer, 0);
925923
ret = bigmac_init_hw(bp, 0);
926924
if (ret)
927925
free_irq(dev->irq, bp);
@@ -1172,7 +1170,7 @@ static int bigmac_ether_init(struct platform_device *op,
11721170
"board-version", 1);
11731171

11741172
/* Init auto-negotiation timer state. */
1175-
init_timer(&bp->bigmac_timer);
1173+
timer_setup(&bp->bigmac_timer, bigmac_timer, 0);
11761174
bp->timer_state = asleep;
11771175
bp->timer_ticks = 0;
11781176

drivers/net/ethernet/sun/sungem.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1496,9 +1496,9 @@ static int gem_mdio_link_not_up(struct gem *gp)
14961496
}
14971497
}
14981498

1499-
static void gem_link_timer(unsigned long data)
1499+
static void gem_link_timer(struct timer_list *t)
15001500
{
1501-
struct gem *gp = (struct gem *) data;
1501+
struct gem *gp = from_timer(gp, t, link_timer);
15021502
struct net_device *dev = gp->dev;
15031503
int restart_aneg = 0;
15041504

@@ -2910,7 +2910,7 @@ static int gem_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
29102910

29112911
gp->msg_enable = DEFAULT_MSG;
29122912

2913-
setup_timer(&gp->link_timer, gem_link_timer, (unsigned long)gp);
2913+
timer_setup(&gp->link_timer, gem_link_timer, 0);
29142914

29152915
INIT_WORK(&gp->reset_task, gem_reset_task);
29162916

drivers/net/ethernet/sun/sunhme.c

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -685,9 +685,9 @@ static int is_lucent_phy(struct happy_meal *hp)
685685
return ret;
686686
}
687687

688-
static void happy_meal_timer(unsigned long data)
688+
static void happy_meal_timer(struct timer_list *t)
689689
{
690-
struct happy_meal *hp = (struct happy_meal *) data;
690+
struct happy_meal *hp = from_timer(hp, t, happy_timer);
691691
void __iomem *tregs = hp->tcvregs;
692692
int restart_timer = 0;
693693

@@ -1413,8 +1413,6 @@ happy_meal_begin_auto_negotiation(struct happy_meal *hp,
14131413

14141414
hp->timer_ticks = 0;
14151415
hp->happy_timer.expires = jiffies + (12 * HZ)/10; /* 1.2 sec. */
1416-
hp->happy_timer.data = (unsigned long) hp;
1417-
hp->happy_timer.function = happy_meal_timer;
14181416
add_timer(&hp->happy_timer);
14191417
}
14201418

@@ -2819,7 +2817,7 @@ static int happy_meal_sbus_probe_one(struct platform_device *op, int is_qfe)
28192817
hp->timer_state = asleep;
28202818
hp->timer_ticks = 0;
28212819

2822-
init_timer(&hp->happy_timer);
2820+
timer_setup(&hp->happy_timer, happy_meal_timer, 0);
28232821

28242822
hp->dev = dev;
28252823
dev->netdev_ops = &hme_netdev_ops;
@@ -3133,7 +3131,7 @@ static int happy_meal_pci_probe(struct pci_dev *pdev,
31333131
hp->timer_state = asleep;
31343132
hp->timer_ticks = 0;
31353133

3136-
init_timer(&hp->happy_timer);
3134+
timer_setup(&hp->happy_timer, happy_meal_timer, 0);
31373135

31383136
hp->irq = pdev->irq;
31393137
hp->dev = dev;

drivers/net/ethernet/sun/sunvnet.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -492,8 +492,7 @@ static int vnet_port_probe(struct vio_dev *vdev, const struct vio_device_id *id)
492492
pr_info("%s: PORT ( remote-mac %pM%s )\n",
493493
vp->dev->name, port->raddr, switch_port ? " switch-port" : "");
494494

495-
setup_timer(&port->clean_timer, sunvnet_clean_timer_expire_common,
496-
(unsigned long)port);
495+
timer_setup(&port->clean_timer, sunvnet_clean_timer_expire_common, 0);
497496

498497
napi_enable(&port->napi);
499498
vio_port_up(&port->vio);

drivers/net/ethernet/sun/sunvnet_common.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1040,9 +1040,9 @@ static inline void vnet_free_skbs(struct sk_buff *skb)
10401040
}
10411041
}
10421042

1043-
void sunvnet_clean_timer_expire_common(unsigned long port0)
1043+
void sunvnet_clean_timer_expire_common(struct timer_list *t)
10441044
{
1045-
struct vnet_port *port = (struct vnet_port *)port0;
1045+
struct vnet_port *port = from_timer(port, t, clean_timer);
10461046
struct sk_buff *freeskbs;
10471047
unsigned pending;
10481048

drivers/net/ethernet/sun/sunvnet_common.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ struct vnet {
129129
((__port)->vsw ? (__port)->dev : (__port)->vp->dev)
130130

131131
/* Common funcs */
132-
void sunvnet_clean_timer_expire_common(unsigned long port0);
132+
void sunvnet_clean_timer_expire_common(struct timer_list *t);
133133
int sunvnet_open_common(struct net_device *dev);
134134
int sunvnet_close_common(struct net_device *dev);
135135
void sunvnet_set_rx_mode_common(struct net_device *dev, struct vnet *vp);

0 commit comments

Comments
 (0)