diff options
author | John W. Linville <linville@tuxdriver.com> | 2008-11-11 16:00:06 -0500 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2008-11-21 11:08:17 -0500 |
commit | 2ba4b32ecf748d5f45f298fc9677fa46d1dd9aff (patch) | |
tree | ebdf68be060014d9f5c799cf1cb54462bc896140 /drivers/net/wireless/hostap/hostap_hw.c | |
parent | 274bfb8dc5ffa16cb073801bebe76ab7f4e2e73d (diff) |
lib80211: consolidate crypt init routines
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/hostap/hostap_hw.c')
-rw-r--r-- | drivers/net/wireless/hostap/hostap_hw.c | 61 |
1 files changed, 2 insertions, 59 deletions
diff --git a/drivers/net/wireless/hostap/hostap_hw.c b/drivers/net/wireless/hostap/hostap_hw.c index 066299fc9259..0f27059bbe85 100644 --- a/drivers/net/wireless/hostap/hostap_hw.c +++ b/drivers/net/wireless/hostap/hostap_hw.c | |||
@@ -2788,46 +2788,6 @@ static void prism2_check_sta_fw_version(local_info_t *local) | |||
2788 | } | 2788 | } |
2789 | 2789 | ||
2790 | 2790 | ||
2791 | static void prism2_crypt_deinit_entries(local_info_t *local, int force) | ||
2792 | { | ||
2793 | struct list_head *ptr, *n; | ||
2794 | struct lib80211_crypt_data *entry; | ||
2795 | |||
2796 | for (ptr = local->crypt_info.crypt_deinit_list.next, n = ptr->next; | ||
2797 | ptr != &local->crypt_info.crypt_deinit_list; | ||
2798 | ptr = n, n = ptr->next) { | ||
2799 | entry = list_entry(ptr, struct lib80211_crypt_data, list); | ||
2800 | |||
2801 | if (atomic_read(&entry->refcnt) != 0 && !force) | ||
2802 | continue; | ||
2803 | |||
2804 | list_del(ptr); | ||
2805 | |||
2806 | if (entry->ops) | ||
2807 | entry->ops->deinit(entry->priv); | ||
2808 | kfree(entry); | ||
2809 | } | ||
2810 | } | ||
2811 | |||
2812 | |||
2813 | static void prism2_crypt_deinit_handler(unsigned long data) | ||
2814 | { | ||
2815 | local_info_t *local = (local_info_t *) data; | ||
2816 | unsigned long flags; | ||
2817 | |||
2818 | spin_lock_irqsave(&local->lock, flags); | ||
2819 | prism2_crypt_deinit_entries(local, 0); | ||
2820 | if (!list_empty(&local->crypt_info.crypt_deinit_list)) { | ||
2821 | printk(KERN_DEBUG "%s: entries remaining in delayed crypt " | ||
2822 | "deletion list\n", local->dev->name); | ||
2823 | local->crypt_info.crypt_deinit_timer.expires = jiffies + HZ; | ||
2824 | add_timer(&local->crypt_info.crypt_deinit_timer); | ||
2825 | } | ||
2826 | spin_unlock_irqrestore(&local->lock, flags); | ||
2827 | |||
2828 | } | ||
2829 | |||
2830 | |||
2831 | static void hostap_passive_scan(unsigned long data) | 2791 | static void hostap_passive_scan(unsigned long data) |
2832 | { | 2792 | { |
2833 | local_info_t *local = (local_info_t *) data; | 2793 | local_info_t *local = (local_info_t *) data; |
@@ -3252,12 +3212,7 @@ while (0) | |||
3252 | INIT_LIST_HEAD(&local->cmd_queue); | 3212 | INIT_LIST_HEAD(&local->cmd_queue); |
3253 | init_waitqueue_head(&local->hostscan_wq); | 3213 | init_waitqueue_head(&local->hostscan_wq); |
3254 | 3214 | ||
3255 | local->crypt_info.name = dev->name; | 3215 | lib80211_crypt_info_init(&local->crypt_info, dev->name, &local->lock); |
3256 | local->crypt_info.lock = &local->lock; | ||
3257 | INIT_LIST_HEAD(&local->crypt_info.crypt_deinit_list); | ||
3258 | init_timer(&local->crypt_info.crypt_deinit_timer); | ||
3259 | local->crypt_info.crypt_deinit_timer.data = (unsigned long) local; | ||
3260 | local->crypt_info.crypt_deinit_timer.function = prism2_crypt_deinit_handler; | ||
3261 | 3216 | ||
3262 | init_timer(&local->passive_scan_timer); | 3217 | init_timer(&local->passive_scan_timer); |
3263 | local->passive_scan_timer.data = (unsigned long) local; | 3218 | local->passive_scan_timer.data = (unsigned long) local; |
@@ -3358,9 +3313,7 @@ static void prism2_free_local_data(struct net_device *dev) | |||
3358 | 3313 | ||
3359 | flush_scheduled_work(); | 3314 | flush_scheduled_work(); |
3360 | 3315 | ||
3361 | if (timer_pending(&local->crypt_info.crypt_deinit_timer)) | 3316 | lib80211_crypt_info_free(&local->crypt_info); |
3362 | del_timer(&local->crypt_info.crypt_deinit_timer); | ||
3363 | prism2_crypt_deinit_entries(local, 1); | ||
3364 | 3317 | ||
3365 | if (timer_pending(&local->passive_scan_timer)) | 3318 | if (timer_pending(&local->passive_scan_timer)) |
3366 | del_timer(&local->passive_scan_timer); | 3319 | del_timer(&local->passive_scan_timer); |
@@ -3377,16 +3330,6 @@ static void prism2_free_local_data(struct net_device *dev) | |||
3377 | if (local->dev_enabled) | 3330 | if (local->dev_enabled) |
3378 | prism2_callback(local, PRISM2_CALLBACK_DISABLE); | 3331 | prism2_callback(local, PRISM2_CALLBACK_DISABLE); |
3379 | 3332 | ||
3380 | for (i = 0; i < WEP_KEYS; i++) { | ||
3381 | struct lib80211_crypt_data *crypt = local->crypt_info.crypt[i]; | ||
3382 | if (crypt) { | ||
3383 | if (crypt->ops) | ||
3384 | crypt->ops->deinit(crypt->priv); | ||
3385 | kfree(crypt); | ||
3386 | local->crypt_info.crypt[i] = NULL; | ||
3387 | } | ||
3388 | } | ||
3389 | |||
3390 | if (local->ap != NULL) | 3333 | if (local->ap != NULL) |
3391 | hostap_free_data(local->ap); | 3334 | hostap_free_data(local->ap); |
3392 | 3335 | ||