aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/usb/r8152.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/usb/r8152.c')
-rw-r--r--drivers/net/usb/r8152.c32
1 files changed, 17 insertions, 15 deletions
diff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c
index e8fac732c6f1..adb12f349a61 100644
--- a/drivers/net/usb/r8152.c
+++ b/drivers/net/usb/r8152.c
@@ -449,9 +449,6 @@ enum rtl8152_flags {
449#define MCU_TYPE_PLA 0x0100 449#define MCU_TYPE_PLA 0x0100
450#define MCU_TYPE_USB 0x0000 450#define MCU_TYPE_USB 0x0000
451 451
452#define REALTEK_USB_DEVICE(vend, prod) \
453 USB_DEVICE_INTERFACE_CLASS(vend, prod, USB_CLASS_VENDOR_SPEC)
454
455struct rx_desc { 452struct rx_desc {
456 __le32 opts1; 453 __le32 opts1;
457#define RX_LEN_MASK 0x7fff 454#define RX_LEN_MASK 0x7fff
@@ -2273,22 +2270,21 @@ static int rtl8152_open(struct net_device *netdev)
2273 struct r8152 *tp = netdev_priv(netdev); 2270 struct r8152 *tp = netdev_priv(netdev);
2274 int res = 0; 2271 int res = 0;
2275 2272
2273 rtl8152_set_speed(tp, AUTONEG_ENABLE,
2274 tp->mii.supports_gmii ? SPEED_1000 : SPEED_100,
2275 DUPLEX_FULL);
2276 tp->speed = 0;
2277 netif_carrier_off(netdev);
2278 netif_start_queue(netdev);
2279 set_bit(WORK_ENABLE, &tp->flags);
2276 res = usb_submit_urb(tp->intr_urb, GFP_KERNEL); 2280 res = usb_submit_urb(tp->intr_urb, GFP_KERNEL);
2277 if (res) { 2281 if (res) {
2278 if (res == -ENODEV) 2282 if (res == -ENODEV)
2279 netif_device_detach(tp->netdev); 2283 netif_device_detach(tp->netdev);
2280 netif_warn(tp, ifup, netdev, "intr_urb submit failed: %d\n", 2284 netif_warn(tp, ifup, netdev, "intr_urb submit failed: %d\n",
2281 res); 2285 res);
2282 return res;
2283 } 2286 }
2284 2287
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 2288
2293 return res; 2289 return res;
2294} 2290}
@@ -2298,8 +2294,8 @@ static int rtl8152_close(struct net_device *netdev)
2298 struct r8152 *tp = netdev_priv(netdev); 2294 struct r8152 *tp = netdev_priv(netdev);
2299 int res = 0; 2295 int res = 0;
2300 2296
2301 usb_kill_urb(tp->intr_urb);
2302 clear_bit(WORK_ENABLE, &tp->flags); 2297 clear_bit(WORK_ENABLE, &tp->flags);
2298 usb_kill_urb(tp->intr_urb);
2303 cancel_delayed_work_sync(&tp->schedule); 2299 cancel_delayed_work_sync(&tp->schedule);
2304 netif_stop_queue(netdev); 2300 netif_stop_queue(netdev);
2305 tasklet_disable(&tp->tl); 2301 tasklet_disable(&tp->tl);
@@ -2740,6 +2736,12 @@ static int rtl8152_probe(struct usb_interface *intf,
2740 struct net_device *netdev; 2736 struct net_device *netdev;
2741 int ret; 2737 int ret;
2742 2738
2739 if (udev->actconfig->desc.bConfigurationValue != 1) {
2740 usb_driver_set_configuration(udev, 1);
2741 return -ENODEV;
2742 }
2743
2744 usb_reset_device(udev);
2743 netdev = alloc_etherdev(sizeof(struct r8152)); 2745 netdev = alloc_etherdev(sizeof(struct r8152));
2744 if (!netdev) { 2746 if (!netdev) {
2745 dev_err(&intf->dev, "Out of memory\n"); 2747 dev_err(&intf->dev, "Out of memory\n");
@@ -2820,9 +2822,9 @@ static void rtl8152_disconnect(struct usb_interface *intf)
2820 2822
2821/* table of devices that work with this driver */ 2823/* table of devices that work with this driver */
2822static struct usb_device_id rtl8152_table[] = { 2824static struct usb_device_id rtl8152_table[] = {
2823 {REALTEK_USB_DEVICE(VENDOR_ID_REALTEK, PRODUCT_ID_RTL8152)}, 2825 {USB_DEVICE(VENDOR_ID_REALTEK, PRODUCT_ID_RTL8152)},
2824 {REALTEK_USB_DEVICE(VENDOR_ID_REALTEK, PRODUCT_ID_RTL8153)}, 2826 {USB_DEVICE(VENDOR_ID_REALTEK, PRODUCT_ID_RTL8153)},
2825 {REALTEK_USB_DEVICE(VENDOR_ID_SAMSUNG, PRODUCT_ID_SAMSUNG)}, 2827 {USB_DEVICE(VENDOR_ID_SAMSUNG, PRODUCT_ID_SAMSUNG)},
2826 {} 2828 {}
2827}; 2829};
2828 2830