提交 a33e9e7f 编写于 作者: J Jussi Kivilinna 提交者: John W. Linville

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: NJussi Kivilinna <jussi.kivilinna@mbnet.fi>
Acked-by: NDavid Brownell <dbrownell@users.sourceforge.net>
Acked-by: NDavid S. Miller <davem@davemloft.net>
Signed-off-by: NJohn W. Linville <linville@tuxdriver.com>
上级 d75ec2b7
...@@ -575,7 +575,9 @@ EXPORT_SYMBOL_GPL(usbnet_unlink_rx_urbs); ...@@ -575,7 +575,9 @@ EXPORT_SYMBOL_GPL(usbnet_unlink_rx_urbs);
int usbnet_stop (struct net_device *net) int usbnet_stop (struct net_device *net)
{ {
struct usbnet *dev = netdev_priv(net); struct usbnet *dev = netdev_priv(net);
struct driver_info *info = dev->driver_info;
int temp; int temp;
int retval;
DECLARE_WAIT_QUEUE_HEAD_ONSTACK (unlink_wakeup); DECLARE_WAIT_QUEUE_HEAD_ONSTACK (unlink_wakeup);
DECLARE_WAITQUEUE (wait, current); DECLARE_WAITQUEUE (wait, current);
...@@ -587,6 +589,18 @@ int usbnet_stop (struct net_device *net) ...@@ -587,6 +589,18 @@ int usbnet_stop (struct net_device *net)
net->stats.rx_errors, net->stats.tx_errors 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 // ensure there are no more active urbs
add_wait_queue (&unlink_wakeup, &wait); add_wait_queue (&unlink_wakeup, &wait);
dev->wait = &unlink_wakeup; dev->wait = &unlink_wakeup;
......
...@@ -97,6 +97,9 @@ struct driver_info { ...@@ -97,6 +97,9 @@ struct driver_info {
/* reset device ... can sleep */ /* reset device ... can sleep */
int (*reset)(struct usbnet *); int (*reset)(struct usbnet *);
/* stop device ... can sleep */
int (*stop)(struct usbnet *);
/* see if peer is connected ... can sleep */ /* see if peer is connected ... can sleep */
int (*check_connect)(struct usbnet *); int (*check_connect)(struct usbnet *);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册