d80211: fix workqueue breakage This patch updates d80211 to use the new workqueue API.
Signed-off-by: Michael Wu <[EMAIL PROTECTED]> --- net/d80211/ieee80211.c | 7 ++++--- net/d80211/ieee80211_i.h | 8 +++++--- net/d80211/ieee80211_iface.c | 2 +- net/d80211/ieee80211_sta.c | 26 ++++++++++++++------------ net/d80211/sta_info.c | 7 ++++--- 5 files changed, 28 insertions(+), 22 deletions(-) diff --git a/net/d80211/ieee80211.c b/net/d80211/ieee80211.c index 6e10db5..76ee491 100644 --- a/net/d80211/ieee80211.c +++ b/net/d80211/ieee80211.c @@ -2092,13 +2092,13 @@ void ieee80211_if_shutdown(struct net_de case IEEE80211_IF_TYPE_IBSS: sdata->u.sta.state = IEEE80211_DISABLED; cancel_delayed_work(&sdata->u.sta.work); - if (local->scan_work.data == sdata->dev) { + if (local->scan_dev == sdata->dev) { local->sta_scanning = 0; cancel_delayed_work(&local->scan_work); flush_scheduled_work(); /* see comment in ieee80211_unregister_hw to * understand why this works */ - local->scan_work.data = NULL; + local->scan_dev = NULL; } else flush_scheduled_work(); break; @@ -4486,6 +4486,7 @@ struct ieee80211_hw *ieee80211_alloc_hw( INIT_LIST_HEAD(&local->sub_if_list); spin_lock_init(&local->generic_lock); + INIT_DELAYED_WORK(&local->scan_work, ieee80211_sta_scan_work); init_timer(&local->stat_timer); local->stat_timer.function = ieee80211_stat_refresh; local->stat_timer.data = (unsigned long) local; @@ -4686,7 +4687,7 @@ void ieee80211_unregister_hw(struct ieee if (local->stat_time) del_timer_sync(&local->stat_timer); - if (local->scan_work.data) { + if (local->scan_dev) { local->sta_scanning = 0; cancel_delayed_work(&local->scan_work); flush_scheduled_work(); diff --git a/net/d80211/ieee80211_i.h b/net/d80211/ieee80211_i.h index ef303da..b7b4b35 100644 --- a/net/d80211/ieee80211_i.h +++ b/net/d80211/ieee80211_i.h @@ -240,7 +240,7 @@ struct ieee80211_if_sta { IEEE80211_ASSOCIATE, IEEE80211_ASSOCIATED, IEEE80211_IBSS_SEARCH, IEEE80211_IBSS_JOINED } state; - struct work_struct work; + struct delayed_work work; u8 bssid[ETH_ALEN], prev_bssid[ETH_ALEN]; u8 ssid[IEEE80211_MAX_SSID_LEN]; size_t ssid_len; @@ -429,7 +429,8 @@ struct ieee80211_local { int scan_channel_idx; enum { SCAN_SET_CHANNEL, SCAN_SEND_PROBE } scan_state; unsigned long last_scan_completed; - struct work_struct scan_work; + struct delayed_work scan_work; + struct net_device *scan_dev; int scan_oper_channel; int scan_oper_channel_val; int scan_oper_power_level; @@ -638,7 +639,8 @@ int ieee80211_set_compression(struct iee struct net_device *dev, struct sta_info *sta); int ieee80211_init_client(struct net_device *dev); /* ieee80211_sta.c */ -void ieee80211_sta_work(void *ptr); +void ieee80211_sta_work(struct work_struct *work); +void ieee80211_sta_scan_work(struct work_struct *work); void ieee80211_sta_rx_mgmt(struct net_device *dev, struct sk_buff *skb, struct ieee80211_rx_status *rx_status); int ieee80211_sta_set_ssid(struct net_device *dev, char *ssid, size_t len); diff --git a/net/d80211/ieee80211_iface.c b/net/d80211/ieee80211_iface.c index 3e9d531..288dce5 100644 --- a/net/d80211/ieee80211_iface.c +++ b/net/d80211/ieee80211_iface.c @@ -185,7 +185,7 @@ void ieee80211_if_set_type(struct net_de struct ieee80211_if_sta *ifsta; ifsta = &sdata->u.sta; - INIT_WORK(&ifsta->work, ieee80211_sta_work, dev); + INIT_DELAYED_WORK(&ifsta->work, ieee80211_sta_work); ifsta->capab = WLAN_CAPABILITY_ESS; ifsta->auth_algs = IEEE80211_AUTH_ALG_OPEN | diff --git a/net/d80211/ieee80211_sta.c b/net/d80211/ieee80211_sta.c index 04bd5cd..35eb5a2 100644 --- a/net/d80211/ieee80211_sta.c +++ b/net/d80211/ieee80211_sta.c @@ -1837,10 +1837,11 @@ static void ieee80211_sta_merge_ibss(str } -void ieee80211_sta_work(void *ptr) +void ieee80211_sta_work(struct work_struct *work) { - struct net_device *dev = ptr; - struct ieee80211_sub_if_data *sdata; + struct ieee80211_sub_if_data *sdata = + container_of(work, struct ieee80211_sub_if_data, u.sta.work.work); + struct net_device *dev = sdata->dev; struct ieee80211_if_sta *ifsta; if (!netif_running(dev)) @@ -2407,7 +2408,7 @@ static int ieee80211_active_scan(struct void ieee80211_scan_completed(struct ieee80211_hw *hw) { struct ieee80211_local *local = hw_to_local(hw); - struct net_device *dev = local->scan_work.data; + struct net_device *dev = local->scan_dev; struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); union iwreq_data wrqu; @@ -2428,10 +2429,11 @@ void ieee80211_scan_completed(struct iee } EXPORT_SYMBOL(ieee80211_scan_completed); -static void ieee80211_sta_scan_work(void *ptr) +void ieee80211_sta_scan_work(struct work_struct *work) { - struct net_device *dev = ptr; - struct ieee80211_local *local = dev->ieee80211_ptr; + struct ieee80211_local *local = + container_of(work, struct ieee80211_local, scan_work.work); + struct net_device *dev = local->scan_dev; struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); struct ieee80211_hw_modes *mode; struct ieee80211_channel *chan; @@ -2514,7 +2516,7 @@ static void ieee80211_sta_scan_work(void if (next_delay) schedule_delayed_work(&local->scan_work, next_delay); else - schedule_work(&local->scan_work); + schedule_work(&local->scan_work.work); } } @@ -2547,7 +2549,7 @@ int ieee80211_sta_req_scan(struct net_de * scan */ if (local->sta_scanning) { - if (local->scan_work.data == dev) + if (local->scan_dev == dev) return 0; return -EBUSY; } @@ -2559,7 +2561,7 @@ int ieee80211_sta_req_scan(struct net_de ssid, ssid_len); if (!rc) { local->sta_scanning = 1; - local->scan_work.data = dev; + local->scan_dev = dev; } return rc; } @@ -2577,8 +2579,8 @@ int ieee80211_sta_req_scan(struct net_de local->scan_state = SCAN_SET_CHANNEL; local->scan_hw_mode_idx = 0; local->scan_channel_idx = 0; - INIT_WORK(&local->scan_work, ieee80211_sta_scan_work, dev); - schedule_work(&local->scan_work); + local->scan_dev = dev; + schedule_work(&local->scan_work.work); return 0; } diff --git a/net/d80211/sta_info.c b/net/d80211/sta_info.c index 0c42ae8..1e52e22 100644 --- a/net/d80211/sta_info.c +++ b/net/d80211/sta_info.c @@ -342,9 +342,10 @@ static void sta_info_cleanup(unsigned lo } -static void sta_info_proc_add_task(void *data) +static void sta_info_proc_add_task(struct work_struct *work) { - struct ieee80211_local *local = data; + struct ieee80211_local *local = + container_of(work, struct ieee80211_local, sta_proc_add); struct sta_info *sta, *tmp; while (1) { @@ -395,7 +396,7 @@ void sta_info_init(struct ieee80211_loca local->sta_cleanup.data = (unsigned long) local; local->sta_cleanup.function = sta_info_cleanup; - INIT_WORK(&local->sta_proc_add, sta_info_proc_add_task, local); + INIT_WORK(&local->sta_proc_add, sta_info_proc_add_task); } int sta_info_start(struct ieee80211_local *local)
pgpI9bYwMFPLu.pgp
Description: PGP signature