diff options
author | Kees Cook <keescook@chromium.org> | 2017-10-16 20:29:28 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2017-10-18 07:40:26 -0400 |
commit | 0822c5d94e10d9790e82bdfea20a10f0884bca54 (patch) | |
tree | 25608e9af64b0b506b8002f185caa560a93ae9b9 | |
parent | de892f8f2cc8176368a490e0778fd2de15e9bfda (diff) |
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" <davem@davemloft.net>
Cc: Philippe Reynes <tremyfr@gmail.com>
Cc: Jarod Wilson <jarod@redhat.com>
Cc: Shannon Nelson <shannon.nelson@oracle.com>
Cc: Rob Herring <robh@kernel.org>
Cc: chris hyser <chris.hyser@oracle.com>
Cc: Tushar Dave <tushar.n.dave@oracle.com>
Cc: Tobias Klauser <tklauser@distanz.ch>
Cc: netdev@vger.kernel.org
Signed-off-by: Kees Cook <keescook@chromium.org>
Acked-by: Shannon Nelson <shannon.nelson@oracle.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | drivers/net/ethernet/sun/cassini.c | 7 | ||||
-rw-r--r-- | drivers/net/ethernet/sun/ldmvsw.c | 3 | ||||
-rw-r--r-- | drivers/net/ethernet/sun/niu.c | 10 | ||||
-rw-r--r-- | drivers/net/ethernet/sun/sunbmac.c | 10 | ||||
-rw-r--r-- | drivers/net/ethernet/sun/sungem.c | 6 | ||||
-rw-r--r-- | drivers/net/ethernet/sun/sunhme.c | 10 | ||||
-rw-r--r-- | drivers/net/ethernet/sun/sunvnet.c | 3 | ||||
-rw-r--r-- | drivers/net/ethernet/sun/sunvnet_common.c | 4 | ||||
-rw-r--r-- | drivers/net/ethernet/sun/sunvnet_common.h | 2 |
9 files changed, 24 insertions, 31 deletions
diff --git a/drivers/net/ethernet/sun/cassini.c b/drivers/net/ethernet/sun/cassini.c index a74d78f64af9..113bd57e2ea0 100644 --- a/drivers/net/ethernet/sun/cassini.c +++ b/drivers/net/ethernet/sun/cassini.c | |||
@@ -4079,9 +4079,9 @@ done: | |||
4079 | #endif | 4079 | #endif |
4080 | } | 4080 | } |
4081 | 4081 | ||
4082 | static void cas_link_timer(unsigned long data) | 4082 | static void cas_link_timer(struct timer_list *t) |
4083 | { | 4083 | { |
4084 | struct cas *cp = (struct cas *) data; | 4084 | struct cas *cp = from_timer(cp, t, link_timer); |
4085 | int mask, pending = 0, reset = 0; | 4085 | int mask, pending = 0, reset = 0; |
4086 | unsigned long flags; | 4086 | unsigned long flags; |
4087 | 4087 | ||
@@ -5039,7 +5039,8 @@ static int cas_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
5039 | spin_lock_init(&cp->stat_lock[N_TX_RINGS]); | 5039 | spin_lock_init(&cp->stat_lock[N_TX_RINGS]); |
5040 | mutex_init(&cp->pm_mutex); | 5040 | mutex_init(&cp->pm_mutex); |
5041 | 5041 | ||
5042 | setup_timer(&cp->link_timer, cas_link_timer, (unsigned long)cp); | 5042 | timer_setup(&cp->link_timer, cas_link_timer, 0); |
5043 | |||
5043 | #if 1 | 5044 | #if 1 |
5044 | /* Just in case the implementation of atomic operations | 5045 | /* Just in case the implementation of atomic operations |
5045 | * change so that an explicit initialization is necessary. | 5046 | * change so that an explicit initialization is necessary. |
diff --git a/drivers/net/ethernet/sun/ldmvsw.c b/drivers/net/ethernet/sun/ldmvsw.c index 5feeaa9f0a9e..5ea037672e6f 100644 --- a/drivers/net/ethernet/sun/ldmvsw.c +++ b/drivers/net/ethernet/sun/ldmvsw.c | |||
@@ -363,8 +363,7 @@ static int vsw_port_probe(struct vio_dev *vdev, const struct vio_device_id *id) | |||
363 | list_add_rcu(&port->list, &vp->port_list); | 363 | list_add_rcu(&port->list, &vp->port_list); |
364 | spin_unlock_irqrestore(&vp->lock, flags); | 364 | spin_unlock_irqrestore(&vp->lock, flags); |
365 | 365 | ||
366 | setup_timer(&port->clean_timer, sunvnet_clean_timer_expire_common, | 366 | timer_setup(&port->clean_timer, sunvnet_clean_timer_expire_common, 0); |
367 | (unsigned long)port); | ||
368 | 367 | ||
369 | err = register_netdev(dev); | 368 | err = register_netdev(dev); |
370 | if (err) { | 369 | if (err) { |
diff --git a/drivers/net/ethernet/sun/niu.c b/drivers/net/ethernet/sun/niu.c index bde19b307d0d..ab502ee35fb2 100644 --- a/drivers/net/ethernet/sun/niu.c +++ b/drivers/net/ethernet/sun/niu.c | |||
@@ -2221,9 +2221,9 @@ static int niu_link_status(struct niu *np, int *link_up_p) | |||
2221 | return err; | 2221 | return err; |
2222 | } | 2222 | } |
2223 | 2223 | ||
2224 | static void niu_timer(unsigned long __opaque) | 2224 | static void niu_timer(struct timer_list *t) |
2225 | { | 2225 | { |
2226 | struct niu *np = (struct niu *) __opaque; | 2226 | struct niu *np = from_timer(np, t, timer); |
2227 | unsigned long off; | 2227 | unsigned long off; |
2228 | int err, link_up; | 2228 | int err, link_up; |
2229 | 2229 | ||
@@ -6123,7 +6123,7 @@ static int niu_open(struct net_device *dev) | |||
6123 | 6123 | ||
6124 | err = niu_init_hw(np); | 6124 | err = niu_init_hw(np); |
6125 | if (!err) { | 6125 | if (!err) { |
6126 | setup_timer(&np->timer, niu_timer, (unsigned long)np); | 6126 | timer_setup(&np->timer, niu_timer, 0); |
6127 | np->timer.expires = jiffies + HZ; | 6127 | np->timer.expires = jiffies + HZ; |
6128 | 6128 | ||
6129 | err = niu_enable_interrupts(np, 1); | 6129 | err = niu_enable_interrupts(np, 1); |
@@ -6773,10 +6773,8 @@ static int niu_change_mtu(struct net_device *dev, int new_mtu) | |||
6773 | 6773 | ||
6774 | err = niu_init_hw(np); | 6774 | err = niu_init_hw(np); |
6775 | if (!err) { | 6775 | if (!err) { |
6776 | init_timer(&np->timer); | 6776 | timer_setup(&np->timer, niu_timer, 0); |
6777 | np->timer.expires = jiffies + HZ; | 6777 | np->timer.expires = jiffies + HZ; |
6778 | np->timer.data = (unsigned long) np; | ||
6779 | np->timer.function = niu_timer; | ||
6780 | 6778 | ||
6781 | err = niu_enable_interrupts(np, 1); | 6779 | err = niu_enable_interrupts(np, 1); |
6782 | if (err) | 6780 | if (err) |
diff --git a/drivers/net/ethernet/sun/sunbmac.c b/drivers/net/ethernet/sun/sunbmac.c index 3189722110c2..0b1f41f6bceb 100644 --- a/drivers/net/ethernet/sun/sunbmac.c +++ b/drivers/net/ethernet/sun/sunbmac.c | |||
@@ -523,9 +523,9 @@ static int try_next_permutation(struct bigmac *bp, void __iomem *tregs) | |||
523 | return -1; | 523 | return -1; |
524 | } | 524 | } |
525 | 525 | ||
526 | static void bigmac_timer(unsigned long data) | 526 | static void bigmac_timer(struct timer_list *t) |
527 | { | 527 | { |
528 | struct bigmac *bp = (struct bigmac *) data; | 528 | struct bigmac *bp = from_timer(bp, t, bigmac_timer); |
529 | void __iomem *tregs = bp->tregs; | 529 | void __iomem *tregs = bp->tregs; |
530 | int restart_timer = 0; | 530 | int restart_timer = 0; |
531 | 531 | ||
@@ -613,8 +613,6 @@ static void bigmac_begin_auto_negotiation(struct bigmac *bp) | |||
613 | bp->timer_state = ltrywait; | 613 | bp->timer_state = ltrywait; |
614 | bp->timer_ticks = 0; | 614 | bp->timer_ticks = 0; |
615 | bp->bigmac_timer.expires = jiffies + (12 * HZ) / 10; | 615 | bp->bigmac_timer.expires = jiffies + (12 * HZ) / 10; |
616 | bp->bigmac_timer.data = (unsigned long) bp; | ||
617 | bp->bigmac_timer.function = bigmac_timer; | ||
618 | add_timer(&bp->bigmac_timer); | 616 | add_timer(&bp->bigmac_timer); |
619 | } | 617 | } |
620 | 618 | ||
@@ -921,7 +919,7 @@ static int bigmac_open(struct net_device *dev) | |||
921 | printk(KERN_ERR "BIGMAC: Can't order irq %d to go.\n", dev->irq); | 919 | printk(KERN_ERR "BIGMAC: Can't order irq %d to go.\n", dev->irq); |
922 | return ret; | 920 | return ret; |
923 | } | 921 | } |
924 | init_timer(&bp->bigmac_timer); | 922 | timer_setup(&bp->bigmac_timer, bigmac_timer, 0); |
925 | ret = bigmac_init_hw(bp, 0); | 923 | ret = bigmac_init_hw(bp, 0); |
926 | if (ret) | 924 | if (ret) |
927 | free_irq(dev->irq, bp); | 925 | free_irq(dev->irq, bp); |
@@ -1172,7 +1170,7 @@ static int bigmac_ether_init(struct platform_device *op, | |||
1172 | "board-version", 1); | 1170 | "board-version", 1); |
1173 | 1171 | ||
1174 | /* Init auto-negotiation timer state. */ | 1172 | /* Init auto-negotiation timer state. */ |
1175 | init_timer(&bp->bigmac_timer); | 1173 | timer_setup(&bp->bigmac_timer, bigmac_timer, 0); |
1176 | bp->timer_state = asleep; | 1174 | bp->timer_state = asleep; |
1177 | bp->timer_ticks = 0; | 1175 | bp->timer_ticks = 0; |
1178 | 1176 | ||
diff --git a/drivers/net/ethernet/sun/sungem.c b/drivers/net/ethernet/sun/sungem.c index b75ab8f44968..a7afcee3c5ae 100644 --- a/drivers/net/ethernet/sun/sungem.c +++ b/drivers/net/ethernet/sun/sungem.c | |||
@@ -1496,9 +1496,9 @@ static int gem_mdio_link_not_up(struct gem *gp) | |||
1496 | } | 1496 | } |
1497 | } | 1497 | } |
1498 | 1498 | ||
1499 | static void gem_link_timer(unsigned long data) | 1499 | static void gem_link_timer(struct timer_list *t) |
1500 | { | 1500 | { |
1501 | struct gem *gp = (struct gem *) data; | 1501 | struct gem *gp = from_timer(gp, t, link_timer); |
1502 | struct net_device *dev = gp->dev; | 1502 | struct net_device *dev = gp->dev; |
1503 | int restart_aneg = 0; | 1503 | int restart_aneg = 0; |
1504 | 1504 | ||
@@ -2910,7 +2910,7 @@ static int gem_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
2910 | 2910 | ||
2911 | gp->msg_enable = DEFAULT_MSG; | 2911 | gp->msg_enable = DEFAULT_MSG; |
2912 | 2912 | ||
2913 | setup_timer(&gp->link_timer, gem_link_timer, (unsigned long)gp); | 2913 | timer_setup(&gp->link_timer, gem_link_timer, 0); |
2914 | 2914 | ||
2915 | INIT_WORK(&gp->reset_task, gem_reset_task); | 2915 | INIT_WORK(&gp->reset_task, gem_reset_task); |
2916 | 2916 | ||
diff --git a/drivers/net/ethernet/sun/sunhme.c b/drivers/net/ethernet/sun/sunhme.c index 9e983e1d8249..0431f1e5f511 100644 --- a/drivers/net/ethernet/sun/sunhme.c +++ b/drivers/net/ethernet/sun/sunhme.c | |||
@@ -685,9 +685,9 @@ static int is_lucent_phy(struct happy_meal *hp) | |||
685 | return ret; | 685 | return ret; |
686 | } | 686 | } |
687 | 687 | ||
688 | static void happy_meal_timer(unsigned long data) | 688 | static void happy_meal_timer(struct timer_list *t) |
689 | { | 689 | { |
690 | struct happy_meal *hp = (struct happy_meal *) data; | 690 | struct happy_meal *hp = from_timer(hp, t, happy_timer); |
691 | void __iomem *tregs = hp->tcvregs; | 691 | void __iomem *tregs = hp->tcvregs; |
692 | int restart_timer = 0; | 692 | int restart_timer = 0; |
693 | 693 | ||
@@ -1413,8 +1413,6 @@ force_link: | |||
1413 | 1413 | ||
1414 | hp->timer_ticks = 0; | 1414 | hp->timer_ticks = 0; |
1415 | hp->happy_timer.expires = jiffies + (12 * HZ)/10; /* 1.2 sec. */ | 1415 | 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; | ||
1418 | add_timer(&hp->happy_timer); | 1416 | add_timer(&hp->happy_timer); |
1419 | } | 1417 | } |
1420 | 1418 | ||
@@ -2819,7 +2817,7 @@ static int happy_meal_sbus_probe_one(struct platform_device *op, int is_qfe) | |||
2819 | hp->timer_state = asleep; | 2817 | hp->timer_state = asleep; |
2820 | hp->timer_ticks = 0; | 2818 | hp->timer_ticks = 0; |
2821 | 2819 | ||
2822 | init_timer(&hp->happy_timer); | 2820 | timer_setup(&hp->happy_timer, happy_meal_timer, 0); |
2823 | 2821 | ||
2824 | hp->dev = dev; | 2822 | hp->dev = dev; |
2825 | dev->netdev_ops = &hme_netdev_ops; | 2823 | dev->netdev_ops = &hme_netdev_ops; |
@@ -3133,7 +3131,7 @@ static int happy_meal_pci_probe(struct pci_dev *pdev, | |||
3133 | hp->timer_state = asleep; | 3131 | hp->timer_state = asleep; |
3134 | hp->timer_ticks = 0; | 3132 | hp->timer_ticks = 0; |
3135 | 3133 | ||
3136 | init_timer(&hp->happy_timer); | 3134 | timer_setup(&hp->happy_timer, happy_meal_timer, 0); |
3137 | 3135 | ||
3138 | hp->irq = pdev->irq; | 3136 | hp->irq = pdev->irq; |
3139 | hp->dev = dev; | 3137 | hp->dev = dev; |
diff --git a/drivers/net/ethernet/sun/sunvnet.c b/drivers/net/ethernet/sun/sunvnet.c index 0b95105f7060..27fb22638885 100644 --- a/drivers/net/ethernet/sun/sunvnet.c +++ b/drivers/net/ethernet/sun/sunvnet.c | |||
@@ -492,8 +492,7 @@ static int vnet_port_probe(struct vio_dev *vdev, const struct vio_device_id *id) | |||
492 | pr_info("%s: PORT ( remote-mac %pM%s )\n", | 492 | pr_info("%s: PORT ( remote-mac %pM%s )\n", |
493 | vp->dev->name, port->raddr, switch_port ? " switch-port" : ""); | 493 | vp->dev->name, port->raddr, switch_port ? " switch-port" : ""); |
494 | 494 | ||
495 | setup_timer(&port->clean_timer, sunvnet_clean_timer_expire_common, | 495 | timer_setup(&port->clean_timer, sunvnet_clean_timer_expire_common, 0); |
496 | (unsigned long)port); | ||
497 | 496 | ||
498 | napi_enable(&port->napi); | 497 | napi_enable(&port->napi); |
499 | vio_port_up(&port->vio); | 498 | vio_port_up(&port->vio); |
diff --git a/drivers/net/ethernet/sun/sunvnet_common.c b/drivers/net/ethernet/sun/sunvnet_common.c index ecf456c7b6d1..8aa3ce46bb81 100644 --- a/drivers/net/ethernet/sun/sunvnet_common.c +++ b/drivers/net/ethernet/sun/sunvnet_common.c | |||
@@ -1040,9 +1040,9 @@ static inline void vnet_free_skbs(struct sk_buff *skb) | |||
1040 | } | 1040 | } |
1041 | } | 1041 | } |
1042 | 1042 | ||
1043 | void sunvnet_clean_timer_expire_common(unsigned long port0) | 1043 | void sunvnet_clean_timer_expire_common(struct timer_list *t) |
1044 | { | 1044 | { |
1045 | struct vnet_port *port = (struct vnet_port *)port0; | 1045 | struct vnet_port *port = from_timer(port, t, clean_timer); |
1046 | struct sk_buff *freeskbs; | 1046 | struct sk_buff *freeskbs; |
1047 | unsigned pending; | 1047 | unsigned pending; |
1048 | 1048 | ||
diff --git a/drivers/net/ethernet/sun/sunvnet_common.h b/drivers/net/ethernet/sun/sunvnet_common.h index b20d6fa7ef25..656673c31066 100644 --- a/drivers/net/ethernet/sun/sunvnet_common.h +++ b/drivers/net/ethernet/sun/sunvnet_common.h | |||
@@ -129,7 +129,7 @@ struct vnet { | |||
129 | ((__port)->vsw ? (__port)->dev : (__port)->vp->dev) | 129 | ((__port)->vsw ? (__port)->dev : (__port)->vp->dev) |
130 | 130 | ||
131 | /* Common funcs */ | 131 | /* Common funcs */ |
132 | void sunvnet_clean_timer_expire_common(unsigned long port0); | 132 | void sunvnet_clean_timer_expire_common(struct timer_list *t); |
133 | int sunvnet_open_common(struct net_device *dev); | 133 | int sunvnet_open_common(struct net_device *dev); |
134 | int sunvnet_close_common(struct net_device *dev); | 134 | int sunvnet_close_common(struct net_device *dev); |
135 | void sunvnet_set_rx_mode_common(struct net_device *dev, struct vnet *vp); | 135 | void sunvnet_set_rx_mode_common(struct net_device *dev, struct vnet *vp); |