aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJussi Kivilinna <jussi.kivilinna@mbnet.fi>2009-06-16 10:17:27 -0400
committerJohn W. Linville <linville@tuxdriver.com>2009-07-10 14:57:52 -0400
commita33e9e7f35ef6dcab528e0327f29188475f60691 (patch)
treeb49fbe81598cd21fbc1437318f6f525a0e828767
parentd75ec2b7ec27fd6cdba78492fbd63bee4d091a87 (diff)
usbnet: Add stop function pointer to 'struct rndis_data'.
Allow minidriver to know that netdev has stopped. This is to let wireless turn off radio when usbnet dev is stopped. Signed-off-by: Jussi Kivilinna <jussi.kivilinna@mbnet.fi> Acked-by: David Brownell <dbrownell@users.sourceforge.net> Acked-by: David S. Miller <davem@davemloft.net> Signed-off-by: John W. Linville <linville@tuxdriver.com>
-rw-r--r--drivers/net/usb/usbnet.c14
-rw-r--r--include/linux/usb/usbnet.h3
2 files changed, 17 insertions, 0 deletions
diff --git a/drivers/net/usb/usbnet.c b/drivers/net/usb/usbnet.c
index edfd9e10ceba..25e435c49040 100644
--- a/drivers/net/usb/usbnet.c
+++ b/drivers/net/usb/usbnet.c
@@ -575,7 +575,9 @@ EXPORT_SYMBOL_GPL(usbnet_unlink_rx_urbs);
575int usbnet_stop (struct net_device *net) 575int usbnet_stop (struct net_device *net)
576{ 576{
577 struct usbnet *dev = netdev_priv(net); 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); 581 DECLARE_WAIT_QUEUE_HEAD_ONSTACK (unlink_wakeup);
580 DECLARE_WAITQUEUE (wait, current); 582 DECLARE_WAITQUEUE (wait, current);
581 583
@@ -587,6 +589,18 @@ int usbnet_stop (struct net_device *net)
587 net->stats.rx_errors, net->stats.tx_errors 589 net->stats.rx_errors, net->stats.tx_errors
588 ); 590 );
589 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 604 // ensure there are no more active urbs
591 add_wait_queue (&unlink_wakeup, &wait); 605 add_wait_queue (&unlink_wakeup, &wait);
592 dev->wait = &unlink_wakeup; 606 dev->wait = &unlink_wakeup;
diff --git a/include/linux/usb/usbnet.h b/include/linux/usb/usbnet.h
index 310e18a880ff..7c17b2efba86 100644
--- a/include/linux/usb/usbnet.h
+++ b/include/linux/usb/usbnet.h
@@ -97,6 +97,9 @@ struct driver_info {
97 /* reset device ... can sleep */ 97 /* reset device ... can sleep */
98 int (*reset)(struct usbnet *); 98 int (*reset)(struct usbnet *);
99 99
100 /* stop device ... can sleep */
101 int (*stop)(struct usbnet *);
102
100 /* see if peer is connected ... can sleep */ 103 /* see if peer is connected ... can sleep */
101 int (*check_connect)(struct usbnet *); 104 int (*check_connect)(struct usbnet *);
102 105