usbnet: Add stop function pointer to 'struct rndis_data'.
authorJussi Kivilinna <jussi.kivilinna@mbnet.fi>
Tue, 16 Jun 2009 14:17:27 +0000 (17:17 +0300)
committerJohn W. Linville <linville@tuxdriver.com>
Fri, 10 Jul 2009 18:57:52 +0000 (14:57 -0400)
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>
drivers/net/usb/usbnet.c
include/linux/usb/usbnet.h

index edfd9e10ceba28fcdc6454dd9c7f386a6ac9f6ac..25e435c4904039303b61cd8c584fea78db49d2fe 100644 (file)
@@ -575,7 +575,9 @@ EXPORT_SYMBOL_GPL(usbnet_unlink_rx_urbs);
 int usbnet_stop (struct net_device *net)
 {
        struct usbnet           *dev = netdev_priv(net);
+       struct driver_info      *info = dev->driver_info;
        int                     temp;
+       int                     retval;
        DECLARE_WAIT_QUEUE_HEAD_ONSTACK (unlink_wakeup);
        DECLARE_WAITQUEUE (wait, current);
 
@@ -587,6 +589,18 @@ int usbnet_stop (struct net_device *net)
                        net->stats.rx_errors, net->stats.tx_errors
                        );
 
+       /* allow minidriver to stop correctly (wireless devices to turn off
+        * radio etc) */
+       if (info->stop) {
+               retval = info->stop(dev);
+               if (retval < 0 && netif_msg_ifdown(dev))
+                       devinfo(dev,
+                               "stop fail (%d) usbnet usb-%s-%s, %s",
+                               retval,
+                               dev->udev->bus->bus_name, dev->udev->devpath,
+                               info->description);
+       }
+
        // ensure there are no more active urbs
        add_wait_queue (&unlink_wakeup, &wait);
        dev->wait = &unlink_wakeup;
index 310e18a880fff5da371f000225a871008afbb84e..7c17b2efba867c50af2706961b1fff3991744cfd 100644 (file)
@@ -97,6 +97,9 @@ struct driver_info {
        /* reset device ... can sleep */
        int     (*reset)(struct usbnet *);
 
+       /* stop device ... can sleep */
+       int     (*stop)(struct usbnet *);
+
        /* see if peer is connected ... can sleep */
        int     (*check_connect)(struct usbnet *);