usbnet.c (d7e57676e3ed7ab9b2c7c4bcb7873e51eacbdb84) usbnet.c (a33e9e7f35ef6dcab528e0327f29188475f60691)
1/*
2 * USB Network driver infrastructure
3 * Copyright (C) 2000-2005 by David Brownell
4 * Copyright (C) 2003-2005 David Hollis <dhollis@davehollis.com>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or

--- 561 unchanged lines hidden (view full) ---

570
571/*-------------------------------------------------------------------------*/
572
573// precondition: never called in_interrupt
574
575int usbnet_stop (struct net_device *net)
576{
577 struct usbnet *dev = netdev_priv(net);
1/*
2 * USB Network driver infrastructure
3 * Copyright (C) 2000-2005 by David Brownell
4 * Copyright (C) 2003-2005 David Hollis <dhollis@davehollis.com>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or

--- 561 unchanged lines hidden (view full) ---

570
571/*-------------------------------------------------------------------------*/
572
573// precondition: never called in_interrupt
574
575int usbnet_stop (struct net_device *net)
576{
577 struct usbnet *dev = netdev_priv(net);
578 struct driver_info *info = dev->driver_info;
578 int temp;
579 int temp;
580 int retval;
579 DECLARE_WAIT_QUEUE_HEAD_ONSTACK (unlink_wakeup);
580 DECLARE_WAITQUEUE (wait, current);
581
582 netif_stop_queue (net);
583
584 if (netif_msg_ifdown (dev))
585 devinfo (dev, "stop stats: rx/tx %ld/%ld, errs %ld/%ld",
586 net->stats.rx_packets, net->stats.tx_packets,
587 net->stats.rx_errors, net->stats.tx_errors
588 );
589
581 DECLARE_WAIT_QUEUE_HEAD_ONSTACK (unlink_wakeup);
582 DECLARE_WAITQUEUE (wait, current);
583
584 netif_stop_queue (net);
585
586 if (netif_msg_ifdown (dev))
587 devinfo (dev, "stop stats: rx/tx %ld/%ld, errs %ld/%ld",
588 net->stats.rx_packets, net->stats.tx_packets,
589 net->stats.rx_errors, net->stats.tx_errors
590 );
591
592 /* allow minidriver to stop correctly (wireless devices to turn off
593 * radio etc) */
594 if (info->stop) {
595 retval = info->stop(dev);
596 if (retval < 0 && netif_msg_ifdown(dev))
597 devinfo(dev,
598 "stop fail (%d) usbnet usb-%s-%s, %s",
599 retval,
600 dev->udev->bus->bus_name, dev->udev->devpath,
601 info->description);
602 }
603
590 // ensure there are no more active urbs
591 add_wait_queue (&unlink_wakeup, &wait);
592 dev->wait = &unlink_wakeup;
593 temp = unlink_urbs (dev, &dev->txq) + unlink_urbs (dev, &dev->rxq);
594
595 // maybe wait for deletions to finish.
596 while (!skb_queue_empty(&dev->rxq)
597 && !skb_queue_empty(&dev->txq)

--- 758 unchanged lines hidden ---
604 // ensure there are no more active urbs
605 add_wait_queue (&unlink_wakeup, &wait);
606 dev->wait = &unlink_wakeup;
607 temp = unlink_urbs (dev, &dev->txq) + unlink_urbs (dev, &dev->rxq);
608
609 // maybe wait for deletions to finish.
610 while (!skb_queue_empty(&dev->rxq)
611 && !skb_queue_empty(&dev->txq)

--- 758 unchanged lines hidden ---