[PATCH 4/11] USB: make the autosuspend workqueue thread freezable

Alan Stern <[email protected]>
Newsgroups gmane.linux.usb.devel
Message-ID <[email protected]>
This patch (as881) makes the ksuspend_usb_wq workqueue freezable.  We
don't want a rogue workqueue thread running around, unexpectedly
suspending or resuming USB devices in the middle of a system sleep
transition.

Signed-off-by: Alan Stern <[email protected]>

---

Index: usb-2.6/include/linux/workqueue.h
===================================================================
--- usb-2.6.orig/include/linux/workqueue.h
+++ usb-2.6/include/linux/workqueue.h
@@ -164,6 +164,8 @@ extern struct workqueue_struct *__create
 #define create_workqueue(name) __create_workqueue((name), 0, 0)
 #define create_freezeable_workqueue(name) __create_workqueue((name), 0, 1)
 #define create_singlethread_workqueue(name) __create_workqueue((name), 1, 0)
+#define create_singlethread_freezeable_workqueue(name) \
+		__create_workqueue((name), 1, 1)
 
 extern void destroy_workqueue(struct workqueue_struct *wq);
 
Index: usb-2.6/drivers/usb/core/usb.c
===================================================================
--- usb-2.6.orig/drivers/usb/core/usb.c
+++ usb-2.6/drivers/usb/core/usb.c
@@ -206,7 +206,8 @@ struct device_type usb_device_type = {
 
 static int ksuspend_usb_init(void)
 {
-	ksuspend_usb_wq = create_singlethread_workqueue("ksuspend_usbd");
+	ksuspend_usb_wq = create_singlethread_freezeable_workqueue(
+			"ksuspend_usbd");
 	if (!ksuspend_usb_wq)
 		return -ENOMEM;
 	return 0;


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
[email protected]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.