From 5c4df6da580b9317dc0856e235232b95cbc8251c Mon Sep 17 00:00:00 2001 From: Johannes Berg Date: Fri, 6 Jan 2006 01:43:45 +0100 Subject: [PATCH] [PATCH] softmac: convert to use global workqueue Convert softmac to use global workqueue instead of private one... Signed-off-by: John W. Linville --- include/net/ieee80211softmac.h | 3 --- net/ieee80211/softmac/ieee80211softmac_assoc.c | 4 ++-- net/ieee80211/softmac/ieee80211softmac_auth.c | 6 +++--- net/ieee80211/softmac/ieee80211softmac_event.c | 2 +- net/ieee80211/softmac/ieee80211softmac_module.c | 7 +------ net/ieee80211/softmac/ieee80211softmac_scan.c | 4 ++-- net/ieee80211/softmac/ieee80211softmac_wx.c | 6 +++--- 7 files changed, 12 insertions(+), 20 deletions(-) diff --git a/include/net/ieee80211softmac.h b/include/net/ieee80211softmac.h index 0b5f2df29f02..7264bd87c7d7 100644 --- a/include/net/ieee80211softmac.h +++ b/include/net/ieee80211softmac.h @@ -177,9 +177,6 @@ struct ieee80211softmac_device { u8 scanning:1, /* protects scanning from being done multiple times at once */ associated:1; - /* workquere for scannning, ... */ - struct workqueue_struct *workqueue; - struct ieee80211softmac_scaninfo *scaninfo; struct ieee80211softmac_assoc_info associnfo; diff --git a/net/ieee80211/softmac/ieee80211softmac_assoc.c b/net/ieee80211/softmac/ieee80211softmac_assoc.c index d491005d6cfd..98487448f2d3 100644 --- a/net/ieee80211/softmac/ieee80211softmac_assoc.c +++ b/net/ieee80211/softmac/ieee80211softmac_assoc.c @@ -29,7 +29,7 @@ ieee80211softmac_assoc(struct ieee80211softmac_device *mac, struct ieee80211soft /* Set a timer for timeout */ /* FIXME: make timeout configurable */ - queue_delayed_work(mac->workqueue, &mac->associnfo.timeout, 5 * HZ); + schedule_delayed_work(&mac->associnfo.timeout, 5 * HZ); } void @@ -324,7 +324,7 @@ ieee80211softmac_handle_assoc_response(struct net_device * dev, network->authenticated = 0; /* we don't want to do this more than once ... */ network->auth_desynced_once = 1; - queue_work(mac->workqueue, &mac->associnfo.work); + schedule_work(&mac->associnfo.work); break; } default: diff --git a/net/ieee80211/softmac/ieee80211softmac_auth.c b/net/ieee80211/softmac/ieee80211softmac_auth.c index 286f0718eb7e..5a773528110f 100644 --- a/net/ieee80211/softmac/ieee80211softmac_auth.c +++ b/net/ieee80211/softmac/ieee80211softmac_auth.c @@ -36,7 +36,7 @@ ieee80211softmac_auth_req(struct ieee80211softmac_device *mac, /* add to list */ list_add_tail(&auth->list, &mac->auth_queue); - queue_work(mac->workqueue, &auth->work); + schedule_work(&auth->work); spin_unlock_irqrestore(&mac->lock, flags); return 0; @@ -67,7 +67,7 @@ ieee80211softmac_auth_queue(void *data) net->authenticated = 0; net->authenticating = 1; /* add a timeout call so we eventually give up waiting for an auth reply */ - queue_delayed_work(mac->workqueue, &auth->work, IEEE80211SOFTMAC_AUTH_TIMEOUT); + schedule_delayed_work(&auth->work, IEEE80211SOFTMAC_AUTH_TIMEOUT); auth->retry--; spin_unlock_irqrestore(&mac->lock, flags); if (ieee80211softmac_send_mgt_frame(mac, auth->net, IEEE80211_STYPE_AUTH, auth->state)) @@ -279,7 +279,7 @@ ieee80211softmac_deauth_from_net(struct ieee80211softmac_device *mac, kfree(net); /* let's try to re-associate */ - queue_work(mac->workqueue, &mac->associnfo.work); + schedule_work(&mac->associnfo.work); spin_unlock_irqrestore(&mac->lock, flags); } diff --git a/net/ieee80211/softmac/ieee80211softmac_event.c b/net/ieee80211/softmac/ieee80211softmac_event.c index 0d0a8327252f..b640a58a2687 100644 --- a/net/ieee80211/softmac/ieee80211softmac_event.c +++ b/net/ieee80211/softmac/ieee80211softmac_event.c @@ -118,7 +118,7 @@ ieee80211softmac_call_events_locked(struct ieee80211softmac_device *mac, int eve if ((eventptr->event_type == event || eventptr->event_type == -1) && (eventptr->event_context == NULL || eventptr->event_context == event_ctx)) { list_del(&eventptr->list); - queue_work(mac->workqueue, &eventptr->work); + schedule_work(&eventptr->work); } } } diff --git a/net/ieee80211/softmac/ieee80211softmac_module.c b/net/ieee80211/softmac/ieee80211softmac_module.c index 1244a659cd83..79ef959a2c11 100644 --- a/net/ieee80211/softmac/ieee80211softmac_module.c +++ b/net/ieee80211/softmac/ieee80211softmac_module.c @@ -22,10 +22,6 @@ struct net_device *alloc_ieee80211softmac(int sizeof_priv) * (once they're written) */ - softmac->workqueue = create_workqueue("80211softmac"); - if (!softmac->workqueue) - goto err_free_ieee80211; - INIT_LIST_HEAD(&softmac->auth_queue); INIT_LIST_HEAD(&softmac->network_list); INIT_LIST_HEAD(&softmac->events); @@ -90,7 +86,7 @@ ieee80211softmac_clear_pending_work(struct ieee80211softmac_device *sm) cancel_delayed_work(&eventptr->work); spin_unlock_irqrestore(&sm->lock, flags); - flush_workqueue(sm->workqueue); + flush_scheduled_work(); // now we should be save and no longer need locking... spin_lock_irqsave(&sm->lock, flags); @@ -121,7 +117,6 @@ void free_ieee80211softmac(struct net_device *dev) { struct ieee80211softmac_device *sm = ieee80211_priv(dev); ieee80211softmac_clear_pending_work(sm); - destroy_workqueue(sm->workqueue); kfree(sm->scaninfo); kfree(sm->wpa.IE); free_ieee80211(dev); diff --git a/net/ieee80211/softmac/ieee80211softmac_scan.c b/net/ieee80211/softmac/ieee80211softmac_scan.c index b4b44fa8727d..1a1eda434cfd 100644 --- a/net/ieee80211/softmac/ieee80211softmac_scan.c +++ b/net/ieee80211/softmac/ieee80211softmac_scan.c @@ -93,7 +93,7 @@ void ieee80211softmac_scan(void *d) // TODO: is this if correct, or should we do this only if scanning from assoc request? if (sm->associnfo.req_essid.len) ieee80211softmac_send_mgt_frame(sm, &sm->associnfo.req_essid, IEEE80211_STYPE_PROBE_REQ, 0); - queue_delayed_work(sm->workqueue, &si->softmac_scan, IEEE80211SOFTMAC_PROBE_DELAY); + schedule_delayed_work(&si->softmac_scan, IEEE80211SOFTMAC_PROBE_DELAY); return; } else { dprintk(PFX "Not probing Channel %d (not allowed here)\n", si->channels[current_channel_idx].channel); @@ -158,7 +158,7 @@ int ieee80211softmac_start_scan_implementation(struct net_device *dev) sm->scaninfo->current_channel_idx = 0; sm->scaninfo->started = 1; INIT_COMPLETION(sm->scaninfo->finished); - queue_work(sm->workqueue, &sm->scaninfo->softmac_scan); + schedule_work(&sm->scaninfo->softmac_scan); spin_unlock_irqrestore(&sm->lock, flags); return 0; } diff --git a/net/ieee80211/softmac/ieee80211softmac_wx.c b/net/ieee80211/softmac/ieee80211softmac_wx.c index bae5fcc11967..ca11737de6f5 100644 --- a/net/ieee80211/softmac/ieee80211softmac_wx.c +++ b/net/ieee80211/softmac/ieee80211softmac_wx.c @@ -58,7 +58,7 @@ ieee80211softmac_wx_set_essid(struct net_device *net_dev, sm->associnfo.req_essid.len = length; /* queue lower level code to do work (if necessary) */ - queue_work(sm->workqueue, &sm->associnfo.work); + schedule_work(&sm->associnfo.work); spin_unlock_irqrestore(&sm->lock, flags); return 0; @@ -286,7 +286,7 @@ ieee80211softmac_wx_set_wap(struct net_device *net_dev, spin_lock_irqsave(&mac->lock, flags); if (!memcmp(any, data->ap_addr.sa_data, ETH_ALEN) || !memcmp(off, data->ap_addr.sa_data, ETH_ALEN)) { - queue_work(mac->workqueue, &mac->associnfo.work); + schedule_work(&mac->associnfo.work); goto out; } else { if (!memcmp(mac->associnfo.bssid, data->ap_addr.sa_data, ETH_ALEN)) { @@ -299,7 +299,7 @@ ieee80211softmac_wx_set_wap(struct net_device *net_dev, memcpy(mac->associnfo.bssid, data->ap_addr.sa_data, ETH_ALEN); } /* queue associate if new bssid or (old one again and not associated) */ - queue_work(mac->workqueue,&mac->associnfo.work); + schedule_work(&mac->associnfo.work); } out: -- 2.30.2