diff options
Diffstat (limited to 'drivers/usb/gadget/f_phonet.c')
-rw-r--r-- | drivers/usb/gadget/f_phonet.c | 21 |
1 files changed, 7 insertions, 14 deletions
diff --git a/drivers/usb/gadget/f_phonet.c b/drivers/usb/gadget/f_phonet.c index c1abeb89b413..96fb118355b0 100644 --- a/drivers/usb/gadget/f_phonet.c +++ b/drivers/usb/gadget/f_phonet.c | |||
@@ -188,8 +188,7 @@ static struct usb_descriptor_header *hs_pn_function[] = { | |||
188 | 188 | ||
189 | static int pn_net_open(struct net_device *dev) | 189 | static int pn_net_open(struct net_device *dev) |
190 | { | 190 | { |
191 | if (netif_carrier_ok(dev)) | 191 | netif_wake_queue(dev); |
192 | netif_wake_queue(dev); | ||
193 | return 0; | 192 | return 0; |
194 | } | 193 | } |
195 | 194 | ||
@@ -219,8 +218,7 @@ static void pn_tx_complete(struct usb_ep *ep, struct usb_request *req) | |||
219 | } | 218 | } |
220 | 219 | ||
221 | dev_kfree_skb_any(skb); | 220 | dev_kfree_skb_any(skb); |
222 | if (netif_carrier_ok(dev)) | 221 | netif_wake_queue(dev); |
223 | netif_wake_queue(dev); | ||
224 | } | 222 | } |
225 | 223 | ||
226 | static int pn_net_xmit(struct sk_buff *skb, struct net_device *dev) | 224 | static int pn_net_xmit(struct sk_buff *skb, struct net_device *dev) |
@@ -255,7 +253,7 @@ out_unlock: | |||
255 | spin_unlock_irqrestore(&port->lock, flags); | 253 | spin_unlock_irqrestore(&port->lock, flags); |
256 | out: | 254 | out: |
257 | if (unlikely(skb)) { | 255 | if (unlikely(skb)) { |
258 | dev_kfree_skb_any(skb); | 256 | dev_kfree_skb(skb); |
259 | dev->stats.tx_dropped++; | 257 | dev->stats.tx_dropped++; |
260 | } | 258 | } |
261 | return 0; | 259 | return 0; |
@@ -383,7 +381,6 @@ static void __pn_reset(struct usb_function *f) | |||
383 | struct phonet_port *port = netdev_priv(dev); | 381 | struct phonet_port *port = netdev_priv(dev); |
384 | 382 | ||
385 | netif_carrier_off(dev); | 383 | netif_carrier_off(dev); |
386 | netif_stop_queue(dev); | ||
387 | port->usb = NULL; | 384 | port->usb = NULL; |
388 | 385 | ||
389 | usb_ep_disable(fp->out_ep); | 386 | usb_ep_disable(fp->out_ep); |
@@ -427,8 +424,6 @@ static int pn_set_alt(struct usb_function *f, unsigned intf, unsigned alt) | |||
427 | fp->in_ep->driver_data = fp; | 424 | fp->in_ep->driver_data = fp; |
428 | 425 | ||
429 | netif_carrier_on(dev); | 426 | netif_carrier_on(dev); |
430 | if (netif_running(dev)) | ||
431 | netif_wake_queue(dev); | ||
432 | for (i = 0; i < phonet_rxq_size; i++) | 427 | for (i = 0; i < phonet_rxq_size; i++) |
433 | pn_rx_submit(fp, fp->out_reqv[i], GFP_ATOMIC); | 428 | pn_rx_submit(fp, fp->out_reqv[i], GFP_ATOMIC); |
434 | } | 429 | } |
@@ -574,9 +569,10 @@ static struct net_device *dev; | |||
574 | int __init phonet_bind_config(struct usb_configuration *c) | 569 | int __init phonet_bind_config(struct usb_configuration *c) |
575 | { | 570 | { |
576 | struct f_phonet *fp; | 571 | struct f_phonet *fp; |
577 | int err; | 572 | int err, size; |
578 | 573 | ||
579 | fp = kzalloc(sizeof(*fp), GFP_KERNEL); | 574 | size = sizeof(*fp) + (phonet_rxq_size * sizeof(struct usb_request *)); |
575 | fp = kzalloc(size, GFP_KERNEL); | ||
580 | if (!fp) | 576 | if (!fp) |
581 | return -ENOMEM; | 577 | return -ENOMEM; |
582 | 578 | ||
@@ -601,16 +597,13 @@ int __init gphonet_setup(struct usb_gadget *gadget) | |||
601 | 597 | ||
602 | /* Create net device */ | 598 | /* Create net device */ |
603 | BUG_ON(dev); | 599 | BUG_ON(dev); |
604 | dev = alloc_netdev(sizeof(*port) | 600 | dev = alloc_netdev(sizeof(*port), "upnlink%d", pn_net_setup); |
605 | + (phonet_rxq_size * sizeof(struct usb_request *)), | ||
606 | "upnlink%d", pn_net_setup); | ||
607 | if (!dev) | 601 | if (!dev) |
608 | return -ENOMEM; | 602 | return -ENOMEM; |
609 | 603 | ||
610 | port = netdev_priv(dev); | 604 | port = netdev_priv(dev); |
611 | spin_lock_init(&port->lock); | 605 | spin_lock_init(&port->lock); |
612 | netif_carrier_off(dev); | 606 | netif_carrier_off(dev); |
613 | netif_stop_queue(dev); | ||
614 | SET_NETDEV_DEV(dev, &gadget->dev); | 607 | SET_NETDEV_DEV(dev, &gadget->dev); |
615 | 608 | ||
616 | err = register_netdev(dev); | 609 | err = register_netdev(dev); |