aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/zd1211rw
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/wireless/zd1211rw')
-rw-r--r--drivers/net/wireless/zd1211rw/zd_chip.c5
-rw-r--r--drivers/net/wireless/zd1211rw/zd_def.h6
-rw-r--r--drivers/net/wireless/zd1211rw/zd_mac.c6
-rw-r--r--drivers/net/wireless/zd1211rw/zd_mac.h2
-rw-r--r--drivers/net/wireless/zd1211rw/zd_rf.c2
-rw-r--r--drivers/net/wireless/zd1211rw/zd_usb.c7
6 files changed, 15 insertions, 13 deletions
diff --git a/drivers/net/wireless/zd1211rw/zd_chip.c b/drivers/net/wireless/zd1211rw/zd_chip.c
index e7e92eccff5e..58419985e00f 100644
--- a/drivers/net/wireless/zd1211rw/zd_chip.c
+++ b/drivers/net/wireless/zd1211rw/zd_chip.c
@@ -42,12 +42,11 @@ void zd_chip_init(struct zd_chip *chip,
42 42
43void zd_chip_clear(struct zd_chip *chip) 43void zd_chip_clear(struct zd_chip *chip)
44{ 44{
45 mutex_lock(&chip->mutex); 45 ZD_ASSERT(!mutex_is_locked(&chip->mutex));
46 zd_usb_clear(&chip->usb); 46 zd_usb_clear(&chip->usb);
47 zd_rf_clear(&chip->rf); 47 zd_rf_clear(&chip->rf);
48 mutex_unlock(&chip->mutex);
49 mutex_destroy(&chip->mutex); 48 mutex_destroy(&chip->mutex);
50 memset(chip, 0, sizeof(*chip)); 49 ZD_MEMCLEAR(chip, sizeof(*chip));
51} 50}
52 51
53static int scnprint_mac_oui(const u8 *addr, char *buffer, size_t size) 52static int scnprint_mac_oui(const u8 *addr, char *buffer, size_t size)
diff --git a/drivers/net/wireless/zd1211rw/zd_def.h b/drivers/net/wireless/zd1211rw/zd_def.h
index 465906812fc4..a13ec72eb304 100644
--- a/drivers/net/wireless/zd1211rw/zd_def.h
+++ b/drivers/net/wireless/zd1211rw/zd_def.h
@@ -45,4 +45,10 @@ do { \
45# define ZD_ASSERT(x) do { } while (0) 45# define ZD_ASSERT(x) do { } while (0)
46#endif 46#endif
47 47
48#ifdef DEBUG
49# define ZD_MEMCLEAR(pointer, size) memset((pointer), 0xff, (size))
50#else
51# define ZD_MEMCLEAR(pointer, size) do { } while (0)
52#endif
53
48#endif /* _ZD_DEF_H */ 54#endif /* _ZD_DEF_H */
diff --git a/drivers/net/wireless/zd1211rw/zd_mac.c b/drivers/net/wireless/zd1211rw/zd_mac.c
index d6f3e02a0b54..0eda534a648c 100644
--- a/drivers/net/wireless/zd1211rw/zd_mac.c
+++ b/drivers/net/wireless/zd1211rw/zd_mac.c
@@ -127,11 +127,9 @@ out:
127 127
128void zd_mac_clear(struct zd_mac *mac) 128void zd_mac_clear(struct zd_mac *mac)
129{ 129{
130 /* Aquire the lock. */
131 spin_lock(&mac->lock);
132 spin_unlock(&mac->lock);
133 zd_chip_clear(&mac->chip); 130 zd_chip_clear(&mac->chip);
134 memset(mac, 0, sizeof(*mac)); 131 ZD_ASSERT(!spin_is_locked(&mac->lock));
132 ZD_MEMCLEAR(mac, sizeof(struct zd_mac));
135} 133}
136 134
137static int reset_mode(struct zd_mac *mac) 135static int reset_mode(struct zd_mac *mac)
diff --git a/drivers/net/wireless/zd1211rw/zd_mac.h b/drivers/net/wireless/zd1211rw/zd_mac.h
index 71e382c589ee..082bcf8ec8dc 100644
--- a/drivers/net/wireless/zd1211rw/zd_mac.h
+++ b/drivers/net/wireless/zd1211rw/zd_mac.h
@@ -121,9 +121,9 @@ enum mac_flags {
121}; 121};
122 122
123struct zd_mac { 123struct zd_mac {
124 struct net_device *netdev;
125 struct zd_chip chip; 124 struct zd_chip chip;
126 spinlock_t lock; 125 spinlock_t lock;
126 struct net_device *netdev;
127 /* Unlocked reading possible */ 127 /* Unlocked reading possible */
128 struct iw_statistics iw_stats; 128 struct iw_statistics iw_stats;
129 u8 qual_average; 129 u8 qual_average;
diff --git a/drivers/net/wireless/zd1211rw/zd_rf.c b/drivers/net/wireless/zd1211rw/zd_rf.c
index ccf639a398b7..f50cff3db916 100644
--- a/drivers/net/wireless/zd1211rw/zd_rf.c
+++ b/drivers/net/wireless/zd1211rw/zd_rf.c
@@ -56,7 +56,7 @@ void zd_rf_init(struct zd_rf *rf)
56 56
57void zd_rf_clear(struct zd_rf *rf) 57void zd_rf_clear(struct zd_rf *rf)
58{ 58{
59 memset(rf, 0, sizeof(*rf)); 59 ZD_MEMCLEAR(rf, sizeof(*rf));
60} 60}
61 61
62int zd_rf_init_hw(struct zd_rf *rf, u8 type) 62int zd_rf_init_hw(struct zd_rf *rf, u8 type)
diff --git a/drivers/net/wireless/zd1211rw/zd_usb.c b/drivers/net/wireless/zd1211rw/zd_usb.c
index f721ea57e213..47489fe8ab52 100644
--- a/drivers/net/wireless/zd1211rw/zd_usb.c
+++ b/drivers/net/wireless/zd1211rw/zd_usb.c
@@ -664,7 +664,7 @@ resubmit:
664 usb_submit_urb(urb, GFP_ATOMIC); 664 usb_submit_urb(urb, GFP_ATOMIC);
665} 665}
666 666
667struct urb *alloc_urb(struct zd_usb *usb) 667static struct urb *alloc_urb(struct zd_usb *usb)
668{ 668{
669 struct usb_device *udev = zd_usb_to_usbdev(usb); 669 struct usb_device *udev = zd_usb_to_usbdev(usb);
670 struct urb *urb; 670 struct urb *urb;
@@ -688,7 +688,7 @@ struct urb *alloc_urb(struct zd_usb *usb)
688 return urb; 688 return urb;
689} 689}
690 690
691void free_urb(struct urb *urb) 691static void free_urb(struct urb *urb)
692{ 692{
693 if (!urb) 693 if (!urb)
694 return; 694 return;
@@ -908,7 +908,7 @@ void zd_usb_clear(struct zd_usb *usb)
908{ 908{
909 usb_set_intfdata(usb->intf, NULL); 909 usb_set_intfdata(usb->intf, NULL);
910 usb_put_intf(usb->intf); 910 usb_put_intf(usb->intf);
911 memset(usb, 0, sizeof(*usb)); 911 ZD_MEMCLEAR(usb, sizeof(*usb));
912 /* FIXME: usb_interrupt, usb_tx, usb_rx? */ 912 /* FIXME: usb_interrupt, usb_tx, usb_rx? */
913} 913}
914 914
@@ -1099,7 +1099,6 @@ static void disconnect(struct usb_interface *intf)
1099 */ 1099 */
1100 usb_reset_device(interface_to_usbdev(intf)); 1100 usb_reset_device(interface_to_usbdev(intf));
1101 1101
1102 /* If somebody still waits on this lock now, this is an error. */
1103 zd_netdev_free(netdev); 1102 zd_netdev_free(netdev);
1104 dev_dbg(&intf->dev, "disconnected\n"); 1103 dev_dbg(&intf->dev, "disconnected\n");
1105} 1104}