aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/net/pegasus.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/usb/net/pegasus.c')
-rw-r--r--drivers/usb/net/pegasus.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/drivers/usb/net/pegasus.c b/drivers/usb/net/pegasus.c
index d48c024cff59..a05fd97e5bc2 100644
--- a/drivers/usb/net/pegasus.c
+++ b/drivers/usb/net/pegasus.c
@@ -316,6 +316,7 @@ static int update_eth_regs_async(pegasus_t * pegasus)
316 return ret; 316 return ret;
317} 317}
318 318
319/* Returns 0 on success, error on failure */
319static int read_mii_word(pegasus_t * pegasus, __u8 phy, __u8 indx, __u16 * regd) 320static int read_mii_word(pegasus_t * pegasus, __u8 phy, __u8 indx, __u16 * regd)
320{ 321{
321 int i; 322 int i;
@@ -574,7 +575,6 @@ static void fill_skb_pool(pegasus_t * pegasus)
574 */ 575 */
575 if (pegasus->rx_pool[i] == NULL) 576 if (pegasus->rx_pool[i] == NULL)
576 return; 577 return;
577 pegasus->rx_pool[i]->dev = pegasus->net;
578 skb_reserve(pegasus->rx_pool[i], 2); 578 skb_reserve(pegasus->rx_pool[i], 2);
579 } 579 }
580} 580}
@@ -847,10 +847,6 @@ static void intr_callback(struct urb *urb)
847 * d[0].NO_CARRIER kicks in only with failed TX. 847 * d[0].NO_CARRIER kicks in only with failed TX.
848 * ... so monitoring with MII may be safest. 848 * ... so monitoring with MII may be safest.
849 */ 849 */
850 if (d[0] & NO_CARRIER)
851 netif_carrier_off(net);
852 else
853 netif_carrier_on(net);
854 850
855 /* bytes 3-4 == rx_lostpkt, reg 2E/2F */ 851 /* bytes 3-4 == rx_lostpkt, reg 2E/2F */
856 pegasus->stats.rx_missed_errors += ((d[3] & 0x7f) << 8) | d[4]; 852 pegasus->stats.rx_missed_errors += ((d[3] & 0x7f) << 8) | d[4];
@@ -883,7 +879,7 @@ static int pegasus_start_xmit(struct sk_buff *skb, struct net_device *net)
883 netif_stop_queue(net); 879 netif_stop_queue(net);
884 880
885 ((__le16 *) pegasus->tx_buff)[0] = cpu_to_le16(l16); 881 ((__le16 *) pegasus->tx_buff)[0] = cpu_to_le16(l16);
886 memcpy(pegasus->tx_buff + 2, skb->data, skb->len); 882 skb_copy_from_linear_data(skb, pegasus->tx_buff + 2, skb->len);
887 usb_fill_bulk_urb(pegasus->tx_urb, pegasus->usb, 883 usb_fill_bulk_urb(pegasus->tx_urb, pegasus->usb,
888 usb_sndbulkpipe(pegasus->usb, 2), 884 usb_sndbulkpipe(pegasus->usb, 2),
889 pegasus->tx_buff, count, 885 pegasus->tx_buff, count,
@@ -950,7 +946,7 @@ static void set_carrier(struct net_device *net)
950 pegasus_t *pegasus = netdev_priv(net); 946 pegasus_t *pegasus = netdev_priv(net);
951 u16 tmp; 947 u16 tmp;
952 948
953 if (!read_mii_word(pegasus, pegasus->phy, MII_BMSR, &tmp)) 949 if (read_mii_word(pegasus, pegasus->phy, MII_BMSR, &tmp))
954 return; 950 return;
955 951
956 if (tmp & BMSR_LSTATUS) 952 if (tmp & BMSR_LSTATUS)
@@ -1408,8 +1404,10 @@ static void pegasus_disconnect(struct usb_interface *intf)
1408 unlink_all_urbs(pegasus); 1404 unlink_all_urbs(pegasus);
1409 free_all_urbs(pegasus); 1405 free_all_urbs(pegasus);
1410 free_skb_pool(pegasus); 1406 free_skb_pool(pegasus);
1411 if (pegasus->rx_skb) 1407 if (pegasus->rx_skb != NULL) {
1412 dev_kfree_skb(pegasus->rx_skb); 1408 dev_kfree_skb(pegasus->rx_skb);
1409 pegasus->rx_skb = NULL;
1410 }
1413 free_netdev(pegasus->net); 1411 free_netdev(pegasus->net);
1414} 1412}
1415 1413