aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/usb
diff options
context:
space:
mode:
authorhayeswang <hayeswang@realtek.com>2014-02-05 22:55:48 -0500
committerDavid S. Miller <davem@davemloft.net>2014-02-07 00:18:06 -0500
commit3d55f44f563de2ab83209e8ead48d922b0d56a65 (patch)
treeed33c0c241f233ab0422a41efeae1242a46d5d01 /drivers/net/usb
parent656493d6e730690b76d6e74253d0208841cf4dd9 (diff)
r8152: fix the submission of the interrupt transfer
The submission of the interrupt transfer should be done after setting the bit of WORK_ENABLE, otherwise the callback function would have the opportunity to be returned directly. Clear the bit of WORK_ENABLE before killing the interrupt transfer. Signed-off-by: Hayes Wang <hayeswang@realtek.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/usb')
-rw-r--r--drivers/net/usb/r8152.c17
1 files changed, 8 insertions, 9 deletions
diff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c
index e8fac732c6f1..d89dbe395ad2 100644
--- a/drivers/net/usb/r8152.c
+++ b/drivers/net/usb/r8152.c
@@ -2273,22 +2273,21 @@ static int rtl8152_open(struct net_device *netdev)
2273 struct r8152 *tp = netdev_priv(netdev); 2273 struct r8152 *tp = netdev_priv(netdev);
2274 int res = 0; 2274 int res = 0;
2275 2275
2276 rtl8152_set_speed(tp, AUTONEG_ENABLE,
2277 tp->mii.supports_gmii ? SPEED_1000 : SPEED_100,
2278 DUPLEX_FULL);
2279 tp->speed = 0;
2280 netif_carrier_off(netdev);
2281 netif_start_queue(netdev);
2282 set_bit(WORK_ENABLE, &tp->flags);
2276 res = usb_submit_urb(tp->intr_urb, GFP_KERNEL); 2283 res = usb_submit_urb(tp->intr_urb, GFP_KERNEL);
2277 if (res) { 2284 if (res) {
2278 if (res == -ENODEV) 2285 if (res == -ENODEV)
2279 netif_device_detach(tp->netdev); 2286 netif_device_detach(tp->netdev);
2280 netif_warn(tp, ifup, netdev, "intr_urb submit failed: %d\n", 2287 netif_warn(tp, ifup, netdev, "intr_urb submit failed: %d\n",
2281 res); 2288 res);
2282 return res;
2283 } 2289 }
2284 2290
2285 rtl8152_set_speed(tp, AUTONEG_ENABLE,
2286 tp->mii.supports_gmii ? SPEED_1000 : SPEED_100,
2287 DUPLEX_FULL);
2288 tp->speed = 0;
2289 netif_carrier_off(netdev);
2290 netif_start_queue(netdev);
2291 set_bit(WORK_ENABLE, &tp->flags);
2292 2291
2293 return res; 2292 return res;
2294} 2293}
@@ -2298,8 +2297,8 @@ static int rtl8152_close(struct net_device *netdev)
2298 struct r8152 *tp = netdev_priv(netdev); 2297 struct r8152 *tp = netdev_priv(netdev);
2299 int res = 0; 2298 int res = 0;
2300 2299
2301 usb_kill_urb(tp->intr_urb);
2302 clear_bit(WORK_ENABLE, &tp->flags); 2300 clear_bit(WORK_ENABLE, &tp->flags);
2301 usb_kill_urb(tp->intr_urb);
2303 cancel_delayed_work_sync(&tp->schedule); 2302 cancel_delayed_work_sync(&tp->schedule);
2304 netif_stop_queue(netdev); 2303 netif_stop_queue(netdev);
2305 tasklet_disable(&tp->tl); 2304 tasklet_disable(&tp->tl);