aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/wireless/airo.c40
1 files changed, 16 insertions, 24 deletions
diff --git a/drivers/net/wireless/airo.c b/drivers/net/wireless/airo.c
index 16befbcea58c..e088ceefb4a3 100644
--- a/drivers/net/wireless/airo.c
+++ b/drivers/net/wireless/airo.c
@@ -47,6 +47,7 @@
47#include <linux/pci.h> 47#include <linux/pci.h>
48#include <asm/uaccess.h> 48#include <asm/uaccess.h>
49#include <net/ieee80211.h> 49#include <net/ieee80211.h>
50#include <linux/kthread.h>
50 51
51#include "airo.h" 52#include "airo.h"
52 53
@@ -1187,11 +1188,10 @@ struct airo_info {
1187 int whichbap); 1188 int whichbap);
1188 unsigned short *flash; 1189 unsigned short *flash;
1189 tdsRssiEntry *rssi; 1190 tdsRssiEntry *rssi;
1190 struct task_struct *task; 1191 struct task_struct *list_bss_task;
1192 struct task_struct *airo_thread_task;
1191 struct semaphore sem; 1193 struct semaphore sem;
1192 pid_t thr_pid;
1193 wait_queue_head_t thr_wait; 1194 wait_queue_head_t thr_wait;
1194 struct completion thr_exited;
1195 unsigned long expires; 1195 unsigned long expires;
1196 struct { 1196 struct {
1197 struct sk_buff *skb; 1197 struct sk_buff *skb;
@@ -1733,12 +1733,12 @@ static int readBSSListRid(struct airo_info *ai, int first,
1733 cmd.cmd=CMD_LISTBSS; 1733 cmd.cmd=CMD_LISTBSS;
1734 if (down_interruptible(&ai->sem)) 1734 if (down_interruptible(&ai->sem))
1735 return -ERESTARTSYS; 1735 return -ERESTARTSYS;
1736 ai->list_bss_task = current;
1736 issuecommand(ai, &cmd, &rsp); 1737 issuecommand(ai, &cmd, &rsp);
1737 up(&ai->sem); 1738 up(&ai->sem);
1738 /* Let the command take effect */ 1739 /* Let the command take effect */
1739 ai->task = current; 1740 schedule_timeout_uninterruptible(3 * HZ);
1740 ssleep(3); 1741 ai->list_bss_task = NULL;
1741 ai->task = NULL;
1742 } 1742 }
1743 rc = PC4500_readrid(ai, first ? ai->bssListFirst : ai->bssListNext, 1743 rc = PC4500_readrid(ai, first ? ai->bssListFirst : ai->bssListNext,
1744 list, ai->bssListRidLen, 1); 1744 list, ai->bssListRidLen, 1);
@@ -2400,8 +2400,7 @@ void stop_airo_card( struct net_device *dev, int freeres )
2400 clear_bit(FLAG_REGISTERED, &ai->flags); 2400 clear_bit(FLAG_REGISTERED, &ai->flags);
2401 } 2401 }
2402 set_bit(JOB_DIE, &ai->jobs); 2402 set_bit(JOB_DIE, &ai->jobs);
2403 kill_proc(ai->thr_pid, SIGTERM, 1); 2403 kthread_stop(ai->airo_thread_task);
2404 wait_for_completion(&ai->thr_exited);
2405 2404
2406 /* 2405 /*
2407 * Clean out tx queue 2406 * Clean out tx queue
@@ -2811,9 +2810,8 @@ static struct net_device *_init_airo_card( unsigned short irq, int port,
2811 ai->config.len = 0; 2810 ai->config.len = 0;
2812 ai->pci = pci; 2811 ai->pci = pci;
2813 init_waitqueue_head (&ai->thr_wait); 2812 init_waitqueue_head (&ai->thr_wait);
2814 init_completion (&ai->thr_exited); 2813 ai->airo_thread_task = kthread_run(airo_thread, dev, dev->name);
2815 ai->thr_pid = kernel_thread(airo_thread, dev, CLONE_FS | CLONE_FILES); 2814 if (IS_ERR(ai->airo_thread_task))
2816 if (ai->thr_pid < 0)
2817 goto err_out_free; 2815 goto err_out_free;
2818 ai->tfm = NULL; 2816 ai->tfm = NULL;
2819 rc = add_airo_dev( dev ); 2817 rc = add_airo_dev( dev );
@@ -2930,8 +2928,7 @@ err_out_unlink:
2930 del_airo_dev(dev); 2928 del_airo_dev(dev);
2931err_out_thr: 2929err_out_thr:
2932 set_bit(JOB_DIE, &ai->jobs); 2930 set_bit(JOB_DIE, &ai->jobs);
2933 kill_proc(ai->thr_pid, SIGTERM, 1); 2931 kthread_stop(ai->airo_thread_task);
2934 wait_for_completion(&ai->thr_exited);
2935err_out_free: 2932err_out_free:
2936 free_netdev(dev); 2933 free_netdev(dev);
2937 return NULL; 2934 return NULL;
@@ -3063,13 +3060,7 @@ static int airo_thread(void *data) {
3063 struct airo_info *ai = dev->priv; 3060 struct airo_info *ai = dev->priv;
3064 int locked; 3061 int locked;
3065 3062
3066 daemonize("%s", dev->name);
3067 allow_signal(SIGTERM);
3068
3069 while(1) { 3063 while(1) {
3070 if (signal_pending(current))
3071 flush_signals(current);
3072
3073 /* make swsusp happy with our thread */ 3064 /* make swsusp happy with our thread */
3074 try_to_freeze(); 3065 try_to_freeze();
3075 3066
@@ -3097,7 +3088,7 @@ static int airo_thread(void *data) {
3097 set_bit(JOB_AUTOWEP, &ai->jobs); 3088 set_bit(JOB_AUTOWEP, &ai->jobs);
3098 break; 3089 break;
3099 } 3090 }
3100 if (!signal_pending(current)) { 3091 if (!kthread_should_stop()) {
3101 unsigned long wake_at; 3092 unsigned long wake_at;
3102 if (!ai->expires || !ai->scan_timeout) { 3093 if (!ai->expires || !ai->scan_timeout) {
3103 wake_at = max(ai->expires, 3094 wake_at = max(ai->expires,
@@ -3109,7 +3100,7 @@ static int airo_thread(void *data) {
3109 schedule_timeout(wake_at - jiffies); 3100 schedule_timeout(wake_at - jiffies);
3110 continue; 3101 continue;
3111 } 3102 }
3112 } else if (!signal_pending(current)) { 3103 } else if (!kthread_should_stop()) {
3113 schedule(); 3104 schedule();
3114 continue; 3105 continue;
3115 } 3106 }
@@ -3154,7 +3145,8 @@ static int airo_thread(void *data) {
3154 else /* Shouldn't get here, but we make sure to unlock */ 3145 else /* Shouldn't get here, but we make sure to unlock */
3155 up(&ai->sem); 3146 up(&ai->sem);
3156 } 3147 }
3157 complete_and_exit (&ai->thr_exited, 0); 3148
3149 return 0;
3158} 3150}
3159 3151
3160static irqreturn_t airo_interrupt ( int irq, void* dev_id, struct pt_regs *regs) { 3152static irqreturn_t airo_interrupt ( int irq, void* dev_id, struct pt_regs *regs) {
@@ -3235,8 +3227,8 @@ static irqreturn_t airo_interrupt ( int irq, void* dev_id, struct pt_regs *regs)
3235 if(newStatus == ASSOCIATED || newStatus == REASSOCIATED) { 3227 if(newStatus == ASSOCIATED || newStatus == REASSOCIATED) {
3236 if (auto_wep) 3228 if (auto_wep)
3237 apriv->expires = 0; 3229 apriv->expires = 0;
3238 if (apriv->task) 3230 if (apriv->list_bss_task)
3239 wake_up_process (apriv->task); 3231 wake_up_process(apriv->list_bss_task);
3240 set_bit(FLAG_UPDATE_UNI, &apriv->flags); 3232 set_bit(FLAG_UPDATE_UNI, &apriv->flags);
3241 set_bit(FLAG_UPDATE_MULTI, &apriv->flags); 3233 set_bit(FLAG_UPDATE_MULTI, &apriv->flags);
3242 3234