aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/libertas
diff options
context:
space:
mode:
authorAndres Salomon <dilinger@debian.org>2007-11-20 17:43:55 -0500
committerDavid S. Miller <davem@davemloft.net>2008-01-28 18:04:51 -0500
commitbe13f1897f76a4b395c3d572a18b2802fd521946 (patch)
tree377723a5010c45f56099f44f91b9ed798c893a76 /drivers/net/wireless/libertas
parent4fb910fd3ada36cd9fbf6e037b87f2a83fd740b7 (diff)
libertas: reset devices upon disconnect rather than module unloading
1) Do not reset libertas devices upon module unload. We're unloading the module, we're not killing off devices. 2) Instead, reset libertas devices inside if_usb_disconnect, as we're killing off interfaces and so on. 3) Resetting via disconnect callback means we no longer need to keep track of probed libertas devices; kill off that list (and its wonderful lack of locking..), as well. Drop a useless comment as well. Signed-off-by: Andres Salomon <dilinger@debian.org> Signed-off-by: Dan Williams <dcbw@redhat.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/libertas')
-rw-r--r--drivers/net/wireless/libertas/if_usb.c26
-rw-r--r--drivers/net/wireless/libertas/if_usb.h3
2 files changed, 4 insertions, 25 deletions
diff --git a/drivers/net/wireless/libertas/if_usb.c b/drivers/net/wireless/libertas/if_usb.c
index f7d2b46340e8..4d4f757a9279 100644
--- a/drivers/net/wireless/libertas/if_usb.c
+++ b/drivers/net/wireless/libertas/if_usb.c
@@ -5,7 +5,6 @@
5#include <linux/moduleparam.h> 5#include <linux/moduleparam.h>
6#include <linux/firmware.h> 6#include <linux/firmware.h>
7#include <linux/netdevice.h> 7#include <linux/netdevice.h>
8#include <linux/list.h>
9#include <linux/usb.h> 8#include <linux/usb.h>
10 9
11#define DRV_NAME "usb8xxx" 10#define DRV_NAME "usb8xxx"
@@ -23,15 +22,6 @@ static const char usbdriver_name[] = "usb8xxx";
23static char *lbs_fw_name = "usb8388.bin"; 22static char *lbs_fw_name = "usb8388.bin";
24module_param_named(fw_name, lbs_fw_name, charp, 0644); 23module_param_named(fw_name, lbs_fw_name, charp, 0644);
25 24
26/*
27 * We need to send a RESET command to all USB devices before
28 * we tear down the USB connection. Otherwise we would not
29 * be able to re-init device the device if the module gets
30 * loaded again. This is a list of all initialized USB devices,
31 * for the reset code see if_usb_reset_device()
32*/
33static LIST_HEAD(usb_devices);
34
35static struct usb_device_id if_usb_table[] = { 25static struct usb_device_id if_usb_table[] = {
36 /* Enter the device signature inside */ 26 /* Enter the device signature inside */
37 { USB_DEVICE(0x1286, 0x2001) }, 27 { USB_DEVICE(0x1286, 0x2001) },
@@ -244,8 +234,6 @@ static int if_usb_probe(struct usb_interface *intf,
244 if (lbs_start_card(priv)) 234 if (lbs_start_card(priv))
245 goto err_start_card; 235 goto err_start_card;
246 236
247 list_add_tail(&cardp->list, &usb_devices);
248
249 usb_get_dev(udev); 237 usb_get_dev(udev);
250 usb_set_intfdata(intf, cardp); 238 usb_set_intfdata(intf, cardp);
251 239
@@ -279,8 +267,6 @@ static void if_usb_disconnect(struct usb_interface *intf)
279 /* Update Surprise removed to TRUE */ 267 /* Update Surprise removed to TRUE */
280 cardp->surprise_removed = 1; 268 cardp->surprise_removed = 1;
281 269
282 list_del(&cardp->list);
283
284 if (priv) { 270 if (priv) {
285 lbs_adapter *adapter = priv->adapter; 271 lbs_adapter *adapter = priv->adapter;
286 272
@@ -290,6 +276,10 @@ static void if_usb_disconnect(struct usb_interface *intf)
290 lbs_remove_card(priv); 276 lbs_remove_card(priv);
291 } 277 }
292 278
279 /* this is (apparently?) necessary for future usage of the device */
280 lbs_prepare_and_send_command(priv, CMD_802_11_RESET, CMD_ACT_HALT,
281 0, 0, NULL);
282
293 /* Unlink and free urb */ 283 /* Unlink and free urb */
294 if_usb_free(cardp); 284 if_usb_free(cardp);
295 285
@@ -1034,16 +1024,8 @@ static int __init if_usb_init_module(void)
1034 1024
1035static void __exit if_usb_exit_module(void) 1025static void __exit if_usb_exit_module(void)
1036{ 1026{
1037 struct usb_card_rec *cardp, *cardp_temp;
1038
1039 lbs_deb_enter(LBS_DEB_MAIN); 1027 lbs_deb_enter(LBS_DEB_MAIN);
1040 1028
1041 list_for_each_entry_safe(cardp, cardp_temp, &usb_devices, list) {
1042 lbs_prepare_and_send_command(cardp->priv, CMD_802_11_RESET,
1043 CMD_ACT_HALT, 0, 0, NULL);
1044 }
1045
1046 /* API unregisters the driver from USB subsystem */
1047 usb_deregister(&if_usb_driver); 1029 usb_deregister(&if_usb_driver);
1048 1030
1049 lbs_deb_leave(LBS_DEB_MAIN); 1031 lbs_deb_leave(LBS_DEB_MAIN);
diff --git a/drivers/net/wireless/libertas/if_usb.h b/drivers/net/wireless/libertas/if_usb.h
index 9b4230864c43..f53ddb251586 100644
--- a/drivers/net/wireless/libertas/if_usb.h
+++ b/drivers/net/wireless/libertas/if_usb.h
@@ -1,8 +1,6 @@
1#ifndef _LBS_IF_USB_H 1#ifndef _LBS_IF_USB_H
2#define _LBS_IF_USB_H 2#define _LBS_IF_USB_H
3 3
4#include <linux/list.h>
5
6/** 4/**
7 * This file contains definition for USB interface. 5 * This file contains definition for USB interface.
8 */ 6 */
@@ -44,7 +42,6 @@ struct read_cb_info {
44 42
45/** USB card description structure*/ 43/** USB card description structure*/
46struct usb_card_rec { 44struct usb_card_rec {
47 struct list_head list;
48 struct net_device *eth_dev; 45 struct net_device *eth_dev;
49 struct usb_device *udev; 46 struct usb_device *udev;
50 struct urb *rx_urb, *tx_urb; 47 struct urb *rx_urb, *tx_urb;