Skip to contentSkip to conversation

staging: rtl8712: usb_intf: Remove flush_scheduled_work()

PATCH In review Bhaktipriya Shridhar 2 participants 2 messages Mar 13, 2016 – Mar 21, 2016 Staging

lore
Share & tools
lore
#0 lore raw

PATCH v2 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, flushing 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.

---
Changes in v2:
-Fixed typo in commit message.

 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

maintainer
#1 lore raw
Quoted 33 lines · Bhaktipriya Shridhar

flush_scheduled_work() flushes out all work items in system_wq. Since one doesn't know what could be running there, flushing 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.

---
Changes in v2:
-Fixed typo in commit message.

 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);
--
Quoted 1 line

2.1.4

This patch does not even build!

Please always test build your patches, to not do so makes maintainers very grumpy...