staging: rtl8192u: Remove create_workqueue()
authorBhaktipriya Shridhar <bhaktipriya96@gmail.com>
Sat, 20 Feb 2016 11:19:50 +0000 (16:49 +0530)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 20 Feb 2016 23:09:57 +0000 (15:09 -0800)
With cmwq, use of dedicated workqueues can be replaced by system_wq.
Removed the dedicated workqueue and used system_wq instead.

Since the work items in the workqueues do not need to
be ordered, increase of concurrency by switching to system_wq should
not break anything.

All work items are sync canceled so it is guaranteed that no work is
running when driver is detached.

Signed-off-by: Bhaktipriya Shridhar <bhaktipriya96@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c
drivers/staging/rtl8192u/r8192U_core.c

index 9bc5aac0ac81e13a0bbdaebe81af8a5d6ea48d5f..f8041f9d61c81ccf31a0ad2ba2c4584d482cf797 100644 (file)
@@ -515,7 +515,7 @@ static void ieee80211_softmac_scan_wq(struct work_struct *work)
                ieee80211_send_probe_requests(ieee);
 
 
-       queue_delayed_work(ieee->wq, &ieee->softmac_scan_wq, IEEE80211_SOFTMAC_SCAN_TIME);
+       schedule_delayed_work(&ieee->softmac_scan_wq, IEEE80211_SOFTMAC_SCAN_TIME);
 
        up(&ieee->scan_sem);
        return;
@@ -614,7 +614,7 @@ static void ieee80211_start_scan(struct ieee80211_device *ieee)
        if (ieee->softmac_features & IEEE_SOFTMAC_SCAN){
                if (ieee->scanning == 0) {
                        ieee->scanning = 1;
-                       queue_delayed_work(ieee->wq, &ieee->softmac_scan_wq, 0);
+                       schedule_delayed_work(&ieee->softmac_scan_wq, 0);
                }
        }else
                ieee->start_scan(ieee->dev);
@@ -1241,7 +1241,7 @@ void ieee80211_associate_abort(struct ieee80211_device *ieee)
 
        ieee->state = IEEE80211_ASSOCIATING_RETRY;
 
-       queue_delayed_work(ieee->wq, &ieee->associate_retry_wq, \
+       schedule_delayed_work(&ieee->associate_retry_wq, \
                           IEEE80211_SOFTMAC_ASSOC_RETRY_TIME);
 
        spin_unlock_irqrestore(&ieee->lock, flags);
@@ -1382,7 +1382,7 @@ static void ieee80211_associate_complete(struct ieee80211_device *ieee)
 
        ieee->state = IEEE80211_LINKED;
        //ieee->UpdateHalRATRTableHandler(dev, ieee->dot11HTOperationalRateSet);
-       queue_work(ieee->wq, &ieee->associate_complete_wq);
+       schedule_work(&ieee->associate_complete_wq);
 }
 
 static void ieee80211_associate_procedure_wq(struct work_struct *work)
@@ -1483,7 +1483,7 @@ inline void ieee80211_softmac_new_net(struct ieee80211_device *ieee, struct ieee
                                        }
 
                                        ieee->state = IEEE80211_ASSOCIATING;
-                                       queue_work(ieee->wq, &ieee->associate_procedure_wq);
+                                       schedule_work(&ieee->associate_procedure_wq);
                                }else{
                                        if(ieee80211_is_54g(&ieee->current_network) &&
                                                (ieee->modulation & IEEE80211_OFDM_MODULATION)){
@@ -2044,7 +2044,7 @@ ieee80211_rx_frame_softmac(struct ieee80211_device *ieee, struct sk_buff *skb,
                                        "Association response status code 0x%x\n",
                                        errcode);
                                if(ieee->AsocRetryCount < RT_ASOC_RETRY_LIMIT) {
-                                       queue_work(ieee->wq, &ieee->associate_procedure_wq);
+                                       schedule_work(&ieee->associate_procedure_wq);
                                } else {
                                        ieee80211_associate_abort(ieee);
                                }
@@ -2100,7 +2100,7 @@ ieee80211_rx_frame_softmac(struct ieee80211_device *ieee, struct sk_buff *skb,
                        notify_wx_assoc_event(ieee);
                        //HTSetConnectBwMode(ieee, HT_CHANNEL_WIDTH_20, HT_EXTCHNL_OFFSET_NO_EXT);
                        RemovePeerTS(ieee, header->addr2);
-                       queue_work(ieee->wq, &ieee->associate_procedure_wq);
+                       schedule_work(&ieee->associate_procedure_wq);
                }
                break;
        case IEEE80211_STYPE_MANAGE_ACT:
@@ -2442,7 +2442,7 @@ static void ieee80211_start_ibss_wq(struct work_struct *work)
 
 inline void ieee80211_start_ibss(struct ieee80211_device *ieee)
 {
-       queue_delayed_work(ieee->wq, &ieee->start_ibss_wq, 150);
+       schedule_delayed_work(&ieee->start_ibss_wq, 150);
 }
 
 /* this is called only in user context, with wx_sem held */
@@ -2725,7 +2725,6 @@ void ieee80211_softmac_init(struct ieee80211_device *ieee)
        setup_timer(&ieee->beacon_timer, ieee80211_send_beacon_cb,
                    (unsigned long)ieee);
 
-       ieee->wq = create_workqueue(DRV_NAME);
 
        INIT_DELAYED_WORK(&ieee->start_ibss_wq, ieee80211_start_ibss_wq);
        INIT_WORK(&ieee->associate_complete_wq, ieee80211_associate_complete_wq);
@@ -2755,7 +2754,6 @@ void ieee80211_softmac_free(struct ieee80211_device *ieee)
        del_timer_sync(&ieee->associate_timer);
 
        cancel_delayed_work(&ieee->associate_retry_wq);
-       destroy_workqueue(ieee->wq);
 
        up(&ieee->wx_sem);
 }
index 3c589636139a8e7016754b6db6e4a7f3bf98e2f1..3a93218f320b787e1a5070249cebbb6b280a050e 100644 (file)
@@ -1962,7 +1962,7 @@ static int rtl8192_qos_handle_probe_response(struct r8192_priv *priv,
                     network->qos_data.param_count)) {
                        network->qos_data.old_param_count =
                                network->qos_data.param_count;
-                       queue_work(priv->priv_wq, &priv->qos_activate);
+                       schedule_work(&priv->qos_activate);
                        RT_TRACE(COMP_QOS,
                                 "QoS parameters change call qos_activate\n");
                }
@@ -1971,7 +1971,7 @@ static int rtl8192_qos_handle_probe_response(struct r8192_priv *priv,
                       &def_qos_parameters, size);
 
                if ((network->qos_data.active == 1) && (active_network == 1)) {
-                       queue_work(priv->priv_wq, &priv->qos_activate);
+                       schedule_work(&priv->qos_activate);
                        RT_TRACE(COMP_QOS,
                                 "QoS was disabled call qos_activate\n");
                }
@@ -1990,7 +1990,7 @@ static int rtl8192_handle_beacon(struct net_device *dev,
        struct r8192_priv *priv = ieee80211_priv(dev);
 
        rtl8192_qos_handle_probe_response(priv, 1, network);
-       queue_delayed_work(priv->priv_wq, &priv->update_beacon_wq, 0);
+       schedule_delayed_work(&priv->update_beacon_wq, 0);
        return 0;
 
 }
@@ -2042,7 +2042,7 @@ static int rtl8192_qos_association_resp(struct r8192_priv *priv,
                 network->flags,
                 priv->ieee80211->current_network.qos_data.active);
        if (set_qos_param == 1)
-               queue_work(priv->priv_wq, &priv->qos_activate);
+               schedule_work(&priv->qos_activate);
 
 
        return 0;
@@ -2387,7 +2387,6 @@ static void rtl8192_init_priv_task(struct net_device *dev)
 {
        struct r8192_priv *priv = ieee80211_priv(dev);
 
-       priv->priv_wq = create_workqueue(DRV_NAME);
 
        INIT_WORK(&priv->reset_wq, rtl8192_restart);
 
@@ -3518,7 +3517,7 @@ static void watch_dog_timer_callback(unsigned long data)
 {
        struct r8192_priv *priv = ieee80211_priv((struct net_device *)data);
 
-       queue_delayed_work(priv->priv_wq, &priv->watch_dog_wq, 0);
+       schedule_delayed_work(&priv->watch_dog_wq, 0);
        mod_timer(&priv->watch_dog_timer,
                  jiffies + msecs_to_jiffies(IEEE80211_WATCH_DOG_TIME));
 }
@@ -5022,7 +5021,6 @@ fail2:
        kfree(priv->pFirmware);
        priv->pFirmware = NULL;
        rtl8192_usb_deleteendpoints(dev);
-       destroy_workqueue(priv->priv_wq);
        mdelay(10);
 fail:
        free_ieee80211(dev);
@@ -5060,7 +5058,6 @@ static void rtl8192_usb_disconnect(struct usb_interface *intf)
                kfree(priv->pFirmware);
                priv->pFirmware = NULL;
                rtl8192_usb_deleteendpoints(dev);
-               destroy_workqueue(priv->priv_wq);
                mdelay(10);
        }
        free_ieee80211(dev);