diff options
Diffstat (limited to 'drivers/net/usb')
| -rw-r--r-- | drivers/net/usb/lan78xx.c | 19 | ||||
| -rw-r--r-- | drivers/net/usb/r8152.c | 7 | ||||
| -rw-r--r-- | drivers/net/usb/rtl8150.c | 11 | ||||
| -rw-r--r-- | drivers/net/usb/usbnet.c | 2 | 
4 files changed, 28 insertions, 11 deletions
| diff --git a/drivers/net/usb/lan78xx.c b/drivers/net/usb/lan78xx.c index 42d35cc6b421..00397a807393 100644 --- a/drivers/net/usb/lan78xx.c +++ b/drivers/net/usb/lan78xx.c @@ -1175,10 +1175,13 @@ static int lan78xx_write_raw_eeprom(struct lan78xx_net *dev, u32 offset,  	}  write_raw_eeprom_done: -	if (dev->chipid == ID_REV_CHIP_ID_7800_) -		return lan78xx_write_reg(dev, HW_CFG, saved); - -	return 0; +	if (dev->chipid == ID_REV_CHIP_ID_7800_) { +		int rc = lan78xx_write_reg(dev, HW_CFG, saved); +		/* If USB fails, there is nothing to do */ +		if (rc < 0) +			return rc; +	} +	return ret;  }  static int lan78xx_read_raw_otp(struct lan78xx_net *dev, u32 offset, @@ -3247,10 +3250,6 @@ static int lan78xx_reset(struct lan78xx_net *dev)  		}  	} while (buf & HW_CFG_LRST_); -	ret = lan78xx_init_mac_address(dev); -	if (ret < 0) -		return ret; -  	/* save DEVID for later usage */  	ret = lan78xx_read_reg(dev, ID_REV, &buf);  	if (ret < 0) @@ -3259,6 +3258,10 @@ static int lan78xx_reset(struct lan78xx_net *dev)  	dev->chipid = (buf & ID_REV_CHIP_ID_MASK_) >> 16;  	dev->chiprev = buf & ID_REV_CHIP_REV_MASK_; +	ret = lan78xx_init_mac_address(dev); +	if (ret < 0) +		return ret; +  	/* Respond to the IN token with a NAK */  	ret = lan78xx_read_reg(dev, USB_CFG0, &buf);  	if (ret < 0) diff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c index 44cba7acfe7d..a22d4bb2cf3b 100644 --- a/drivers/net/usb/r8152.c +++ b/drivers/net/usb/r8152.c @@ -10122,7 +10122,12 @@ static int __init rtl8152_driver_init(void)  	ret = usb_register_device_driver(&rtl8152_cfgselector_driver, THIS_MODULE);  	if (ret)  		return ret; -	return usb_register(&rtl8152_driver); + +	ret = usb_register(&rtl8152_driver); +	if (ret) +		usb_deregister_device_driver(&rtl8152_cfgselector_driver); + +	return ret;  }  static void __exit rtl8152_driver_exit(void) diff --git a/drivers/net/usb/rtl8150.c b/drivers/net/usb/rtl8150.c index 92add3daadbb..278e6cb6f4d9 100644 --- a/drivers/net/usb/rtl8150.c +++ b/drivers/net/usb/rtl8150.c @@ -685,9 +685,16 @@ static netdev_tx_t rtl8150_start_xmit(struct sk_buff *skb,  	rtl8150_t *dev = netdev_priv(netdev);  	int count, res; +	/* pad the frame and ensure terminating USB packet, datasheet 9.2.3 */ +	count = max(skb->len, ETH_ZLEN); +	if (count % 64 == 0) +		count++; +	if (skb_padto(skb, count)) { +		netdev->stats.tx_dropped++; +		return NETDEV_TX_OK; +	} +  	netif_stop_queue(netdev); -	count = (skb->len < 60) ? 60 : skb->len; -	count = (count & 0x3f) ? count : count + 1;  	dev->tx_skb = skb;  	usb_fill_bulk_urb(dev->tx_urb, dev->udev, usb_sndbulkpipe(dev->udev, 2),  		      skb->data, count, write_bulk_callback, dev); diff --git a/drivers/net/usb/usbnet.c b/drivers/net/usb/usbnet.c index 511c4154cf74..bf01f2728531 100644 --- a/drivers/net/usb/usbnet.c +++ b/drivers/net/usb/usbnet.c @@ -702,6 +702,7 @@ void usbnet_resume_rx(struct usbnet *dev)  	struct sk_buff *skb;  	int num = 0; +	local_bh_disable();  	clear_bit(EVENT_RX_PAUSED, &dev->flags);  	while ((skb = skb_dequeue(&dev->rxq_pause)) != NULL) { @@ -710,6 +711,7 @@ void usbnet_resume_rx(struct usbnet *dev)  	}  	queue_work(system_bh_wq, &dev->bh_work); +	local_bh_enable();  	netif_dbg(dev, rx_status, dev->net,  		  "paused rx queue disabled, %d skbs requeued\n", num); | 
