login
Header Space

 
 

[PATCH 02/11] klist: implement KLIST_INIT() and DEFINE_KLIST()

Score:
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: <linux-kernel@...>
Cc: Tejun Heo <htejun@...>, Peter Zijlstra <peterz@...>, Greg Kroah-Hartman <gregkh@...>
Date: Wednesday, April 30, 2008 - 7:57 pm

From: Tejun Heo <htejun@gmail.com>

klist is missing static initializers and definition helper.  Add them.

Signed-off-by: Tejun Heo <htejun@gmail.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
---
 include/linux/klist.h |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/include/linux/klist.h b/include/linux/klist.h
index 7407125..a119c0d 100644
--- a/include/linux/klist.h
+++ b/include/linux/klist.h
@@ -25,6 +25,14 @@ struct klist {
 	void			(*put)(struct klist_node *);
 };
 
+#define KLIST_INIT(_name, _get, _put)					\
+	{ .k_lock	= __SPIN_LOCK_UNLOCKED(_name.k_lock),		\
+	  .k_list	= LIST_HEAD_INIT(_name.k_list),			\
+	  .get		= _get,						\
+	  .put		= _put, }
+
+#define DEFINE_KLIST(_name, _get, _put)					\
+	struct klist _name = KLIST_INIT(_name, _get, _put)
 
 extern void klist_init(struct klist * k, void (*get)(struct klist_node *),
 		       void (*put)(struct klist_node *));
-- 
1.5.5.1

--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH 11/11] klist: fix coding style errors in klist.h and ..., Greg Kroah-Hartman, (Wed Apr 30, 7:57 pm)
[PATCH 10/11] driver core: remove no longer used "struct cla..., Greg Kroah-Hartman, (Wed Apr 30, 7:57 pm)
[PATCH 09/11] pcmcia: remove pccard_sysfs_interface warnings, Greg Kroah-Hartman, (Wed Apr 30, 7:57 pm)
[PATCH 08/11] devres: support addresses greater than an unsi..., Greg Kroah-Hartman, (Wed Apr 30, 7:57 pm)
[PATCH 07/11] kobject: do not copy vargs, just pass them aro..., Greg Kroah-Hartman, (Wed Apr 30, 7:57 pm)
[PATCH 06/11] sysfs: sysfs_update_group stub for CONFIG_SYSF..., Greg Kroah-Hartman, (Wed Apr 30, 7:57 pm)
[PATCH 05/11] DEBUGFS: Correct location of debugfs API docum..., Greg Kroah-Hartman, (Wed Apr 30, 7:57 pm)
[PATCH 04/11] driver core: warn about duplicate driver names..., Greg Kroah-Hartman, (Wed Apr 30, 7:57 pm)
[PATCH 03/11] klist: implement klist_add_{after|before}(), Greg Kroah-Hartman, (Wed Apr 30, 7:57 pm)
[PATCH 02/11] klist: implement KLIST_INIT() and DEFINE_KLIST(), Greg Kroah-Hartman, (Wed Apr 30, 7:57 pm)
[PATCH 01/11] sysfs: Disallow truncation of files in sysfs, Greg Kroah-Hartman, (Wed Apr 30, 7:57 pm)
speck-geostationary