Skip to contentSkip to conversation

staging: rtl8712: usb_intf: Remove flush_scheduled_work()

PATCH Superseded Bhaktipriya Shridhar 3 participants 3 messages Mar 12, 2016 – Mar 16, 2016 Staging

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 staging: rtl8712: usb_intf: Remove flush_scheduled_work()

flush_scheduled_work() flushes out all work items in system_wq. Since one doesn't know what could be running there, flushinf work items individually is preferred.

Since there are finite number of work items to be flushed,(viz pwrpriv->SetPSModeWorkItem,pwrpriv->SetPSModeWorkItem,pLed->BlinkWorkItem) instead of flushing system_wq, each work item is separately flushed.

---
 drivers/staging/rtl8712/usb_intf.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/staging/rtl8712/usb_intf.c +3 -1
index c1a0ca49..32c5798 100644
@@ -627,7 +627,9 @@ static void r871xu_dev_remove(struct usb_interface *pusb_intf)
 		if (drvpriv.drv_registered)
 			padapter->bSurpriseRemoved = true;
 		unregister_netdev(pnetdev); /* will call netdev_close() */
-		flush_scheduled_work();
+		cancel_delayed_work(&pwrpriv->SetPSModeWorkItem);
+		cancel_delayed_work(&pwrpriv->rpwm_workitem);
+		cancel_delayed_work(&pLed->BlinkWorkItem);
 		udelay(1);
 		/* Stop driver mlme relation timer */
 		r8712_stop_drv_timers(padapter);

--
2.1.4

#1 lore raw
Quoted 2 lines · Bhaktipriya Shridhar

flush_scheduled_work() flushes out all work items in system_wq. Since one doesn't know what could be running there, flushinf work items

flushinf -> flushing

Quoted 36 lines

individually is preferred.

Since there are finite number of work items to be flushed,(viz pwrpriv->SetPSModeWorkItem,pwrpriv->SetPSModeWorkItem,pLed->BlinkWorkItem) instead of flushing system_wq, each work item is separately flushed.

---
 drivers/staging/rtl8712/usb_intf.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/staging/rtl8712/usb_intf.c +3 -2
index c1a0ca49..32c5798 100644
@@ -627,7 +627,9 @@ static void r871xu_dev_remove(struct usb_interface *pusb_intf)
 		if (drvpriv.drv_registered)
 			padapter->bSurpriseRemoved = true;
 		unregister_netdev(pnetdev); /* will call netdev_close() */
-		flush_scheduled_work();
+		cancel_delayed_work(&pwrpriv->SetPSModeWorkItem);
+		cancel_delayed_work(&pwrpriv->rpwm_workitem);
+		cancel_delayed_work(&pLed->BlinkWorkItem);
 		udelay(1);
 		/* Stop driver mlme relation timer */
 		r8712_stop_drv_timers(padapter);
--

2.1.4

Signature · 5 lines
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/20160312183227.GA17219%40Karyakshetra.
For more options, visit https://groups.google.com/d/optout.
Acked-by on v1 1/1
#2 lore raw
In reply to Bhaktipriya Shridhar

Hello, Bhaktipriya.

Quoted 3 lines · Bhaktipriya Shridhar

flush_scheduled_work() flushes out all work items in system_wq. Since one doesn't know what could be running there, flushinf work items individually is preferred.

And flush_scheduled_work() is deprecated as its behavior is unpredictable and it makes system_wq less useful.

Quoted 5 lines

Since there are finite number of work items to be flushed,(viz pwrpriv->SetPSModeWorkItem,pwrpriv->SetPSModeWorkItem,pLed->BlinkWorkItem) instead of flushing system_wq, each work item is separately flushed.

Thanks a lot!

Signature · 1 line
tejun