]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - releases/3.3.4/8139cp-set-intr-mask-after-its-handler-is-registered.patch
4.9-stable patches
[thirdparty/kernel/stable-queue.git] / releases / 3.3.4 / 8139cp-set-intr-mask-after-its-handler-is-registered.patch
1 From 129d0087682b1513a94b6bbae155dee823fcdf03 Mon Sep 17 00:00:00 2001
2 From: Jason Wang <jasowang@redhat.com>
3 Date: Wed, 11 Apr 2012 22:10:54 +0000
4 Subject: [PATCH 16/28] 8139cp: set intr mask after its handler is registered
5
6
7 From: Jason Wang <jasowang@redhat.com>
8
9 [ Upstream commit a8c9cb106fe79c28d6b7f1397652cadd228715ff ]
10
11 We set intr mask before its handler is registered, this does not work well when
12 8139cp is sharing irq line with other devices. As the irq could be enabled by
13 the device before 8139cp's hander is registered which may lead unhandled
14 irq. Fix this by introducing an helper cp_irq_enable() and call it after
15 request_irq().
16
17 Signed-off-by: Jason Wang <jasowang@redhat.com>
18 Reviewed-by: Flavio Leitner <fbl@redhat.com>
19 Signed-off-by: David S. Miller <davem@davemloft.net>
20 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
21 ---
22 drivers/net/ethernet/realtek/8139cp.c | 10 ++++++++--
23 1 file changed, 8 insertions(+), 2 deletions(-)
24
25 --- a/drivers/net/ethernet/realtek/8139cp.c
26 +++ b/drivers/net/ethernet/realtek/8139cp.c
27 @@ -958,6 +958,11 @@ static inline void cp_start_hw (struct c
28 cpw8(Cmd, RxOn | TxOn);
29 }
30
31 +static void cp_enable_irq(struct cp_private *cp)
32 +{
33 + cpw16_f(IntrMask, cp_intr_mask);
34 +}
35 +
36 static void cp_init_hw (struct cp_private *cp)
37 {
38 struct net_device *dev = cp->dev;
39 @@ -997,8 +1002,6 @@ static void cp_init_hw (struct cp_privat
40
41 cpw16(MultiIntr, 0);
42
43 - cpw16_f(IntrMask, cp_intr_mask);
44 -
45 cpw8_f(Cfg9346, Cfg9346_Lock);
46 }
47
48 @@ -1130,6 +1133,8 @@ static int cp_open (struct net_device *d
49 if (rc)
50 goto err_out_hw;
51
52 + cp_enable_irq(cp);
53 +
54 netif_carrier_off(dev);
55 mii_check_media(&cp->mii_if, netif_msg_link(cp), true);
56 netif_start_queue(dev);
57 @@ -2031,6 +2036,7 @@ static int cp_resume (struct pci_dev *pd
58 /* FIXME: sh*t may happen if the Rx ring buffer is depleted */
59 cp_init_rings_index (cp);
60 cp_init_hw (cp);
61 + cp_enable_irq(cp);
62 netif_start_queue (dev);
63
64 spin_lock_irqsave (&cp->lock, flags);