diff mbox

[1/2] workqueue:introduce INIT_WORK_KEY()

Message ID 20091211030431.GA7772@sli10-desk.sh.intel.com (mailing list archive)
State RFC, archived
Headers show

Commit Message

Shaohua Li Dec. 11, 2009, 3:04 a.m. UTC
None
diff mbox

Patch

Index: linux/include/linux/workqueue.h
===================================================================
--- linux.orig/include/linux/workqueue.h	2009-12-10 10:14:56.000000000 +0800
+++ linux/include/linux/workqueue.h	2009-12-10 10:39:30.000000000 +0800
@@ -99,15 +99,20 @@  struct execute_work {
  * to generate better code.
  */
 #ifdef CONFIG_LOCKDEP
-#define INIT_WORK(_work, _func)						\
+#define INIT_WORK_KEY(_work, _func, _key, _key_name) 			\
 	do {								\
-		static struct lock_class_key __key;			\
-									\
 		(_work)->data = (atomic_long_t) WORK_DATA_INIT();	\
-		lockdep_init_map(&(_work)->lockdep_map, #_work, &__key, 0);\
+		lockdep_init_map(&(_work)->lockdep_map, _key_name, 	\
+				&_key, 0);				\
 		INIT_LIST_HEAD(&(_work)->entry);			\
 		PREPARE_WORK((_work), (_func));				\
 	} while (0)
+
+#define INIT_WORK(_work, _func)						\
+	do {								\
+		static struct lock_class_key __key;			\
+		INIT_WORK_KEY(_work, _func, __key, #_work);		\
+	} while (0)
 #else
 #define INIT_WORK(_work, _func)						\
 	do {								\
@@ -115,6 +120,9 @@  struct execute_work {
 		INIT_LIST_HEAD(&(_work)->entry);			\
 		PREPARE_WORK((_work), (_func));				\
 	} while (0)
+
+#define INIT_WORK_KEY(_work, _func, _key, _key_name) 			\
+	INIT_WORK(_work, _func)
 #endif
 
 #define INIT_DELAYED_WORK(_work, _func)				\