* [PATCH 1/2] klist: implement KLIST_INIT() and DEFINE_KLIST()
@ 2008-04-22 9:57 Tejun Heo
2008-04-22 9:58 ` [PATCH] klist: implement klist_add_{after|before}() Tejun Heo
2008-04-22 12:57 ` [PATCH 1/2] klist: implement KLIST_INIT() and DEFINE_KLIST() Peter Zijlstra
0 siblings, 2 replies; 12+ messages in thread
From: Tejun Heo @ 2008-04-22 9:57 UTC (permalink / raw)
To: James Bottomley, Alan Stern, Andrew Morton, Greg KH, oliver,
Alan Cox, zaitcev, Linux Kernel Mailing List, linux-usb
klist is missing static initializers and definition helper. Add them.
Signed-off-by: Tejun Heo <htejun@gmail.com>
---
I can't tell who's in charge of this code, so I'm including last two
people who made changes and Andrew :-) This will be used by later USB
mode switch support, so I'm cc'ing USB people too.
Thanks.
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..c6b697c 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(klist.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.2.4
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH] klist: implement klist_add_{after|before}()
2008-04-22 9:57 [PATCH 1/2] klist: implement KLIST_INIT() and DEFINE_KLIST() Tejun Heo
@ 2008-04-22 9:58 ` Tejun Heo
2008-04-28 23:51 ` patch klist-implement-klist_add_-after-before.patch added to gregkh-2.6 tree gregkh
2008-04-22 12:57 ` [PATCH 1/2] klist: implement KLIST_INIT() and DEFINE_KLIST() Peter Zijlstra
1 sibling, 1 reply; 12+ messages in thread
From: Tejun Heo @ 2008-04-22 9:58 UTC (permalink / raw)
To: James Bottomley, Alan Stern, Andrew Morton, Greg KH, oliver,
Alan Cox, zaitcev, Linux Kernel Mailing List, linux-usb
Add klist_add_after() and klist_add_before() which puts a new node
after and before an existing node, respectively. This is useful for
callers which need to keep klist ordered. Note that synchronizing
between simultaneous additions for ordering is the caller's
responsibility.
Signed-off-by: Tejun Heo <htejun@gmail.com>
---
include/linux/klist.h | 2 ++
lib/klist.c | 38 ++++++++++++++++++++++++++++++++++++++
2 files changed, 40 insertions(+), 0 deletions(-)
diff --git a/include/linux/klist.h b/include/linux/klist.h
index c6b697c..80658c4 100644
--- a/include/linux/klist.h
+++ b/include/linux/klist.h
@@ -46,6 +46,8 @@ struct klist_node {
extern void klist_add_tail(struct klist_node * n, struct klist * k);
extern void klist_add_head(struct klist_node * n, struct klist * k);
+extern void klist_add_after(struct klist_node * n, struct klist_node * pos);
+extern void klist_add_before(struct klist_node * n, struct klist_node * pos);
extern void klist_del(struct klist_node * n);
extern void klist_remove(struct klist_node * n);
diff --git a/lib/klist.c b/lib/klist.c
index 120bd17..ffe9cb6 100644
--- a/lib/klist.c
+++ b/lib/klist.c
@@ -120,6 +120,44 @@ void klist_add_tail(struct klist_node * n, struct klist * k)
EXPORT_SYMBOL_GPL(klist_add_tail);
+/**
+ * klist_add_after - Init a klist_node and add it after an existing node
+ * @n: node we're adding.
+ * @pos: node to put @n after
+ */
+
+void klist_add_after(struct klist_node * n, struct klist_node * pos)
+{
+ struct klist *k = pos->n_klist;
+
+ klist_node_init(k, n);
+ spin_lock(&k->k_lock);
+ list_add(&n->n_node, &pos->n_node);
+ spin_unlock(&k->k_lock);
+}
+
+EXPORT_SYMBOL_GPL(klist_add_after);
+
+
+/**
+ * klist_add_before - Init a klist_node and add it before an existing node
+ * @n: node we're adding.
+ * @pos: node to put @n after
+ */
+
+void klist_add_before(struct klist_node * n, struct klist_node * pos)
+{
+ struct klist *k = pos->n_klist;
+
+ klist_node_init(k, n);
+ spin_lock(&k->k_lock);
+ list_add_tail(&n->n_node, &pos->n_node);
+ spin_unlock(&k->k_lock);
+}
+
+EXPORT_SYMBOL_GPL(klist_add_before);
+
+
static void klist_release(struct kref * kref)
{
struct klist_node * n = container_of(kref, struct klist_node, n_ref);
--
1.5.2.4
^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: [PATCH 1/2] klist: implement KLIST_INIT() and DEFINE_KLIST()
2008-04-22 9:57 [PATCH 1/2] klist: implement KLIST_INIT() and DEFINE_KLIST() Tejun Heo
2008-04-22 9:58 ` [PATCH] klist: implement klist_add_{after|before}() Tejun Heo
@ 2008-04-22 12:57 ` Peter Zijlstra
2008-04-22 13:03 ` Tejun Heo
1 sibling, 1 reply; 12+ messages in thread
From: Peter Zijlstra @ 2008-04-22 12:57 UTC (permalink / raw)
To: Tejun Heo
Cc: James Bottomley, Alan Stern, Andrew Morton, Greg KH, oliver,
Alan Cox, zaitcev, Linux Kernel Mailing List, linux-usb
On Tue, 2008-04-22 at 18:57 +0900, Tejun Heo wrote:
> klist is missing static initializers and definition helper. Add them.
>
> Signed-off-by: Tejun Heo <htejun@gmail.com>
> ---
> I can't tell who's in charge of this code, so I'm including last two
> people who made changes and Andrew :-) This will be used by later USB
> mode switch support, so I'm cc'ing USB people too.
>
> Thanks.
>
> 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..c6b697c 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(klist.k_lock), \
May I ask you make that: __SPIN_LOCK_UNLOCKED(_name.k_lock)
Otherwise we'll end up with multiple classes that have the same name.
> + .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 *));
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 1/2] klist: implement KLIST_INIT() and DEFINE_KLIST()
2008-04-22 12:57 ` [PATCH 1/2] klist: implement KLIST_INIT() and DEFINE_KLIST() Peter Zijlstra
@ 2008-04-22 13:03 ` Tejun Heo
2008-04-22 13:06 ` Peter Zijlstra
0 siblings, 1 reply; 12+ messages in thread
From: Tejun Heo @ 2008-04-22 13:03 UTC (permalink / raw)
To: Peter Zijlstra
Cc: James Bottomley, Alan Stern, Andrew Morton, Greg KH, oliver,
Alan Cox, zaitcev, Linux Kernel Mailing List, linux-usb
Peter Zijlstra wrote:
> On Tue, 2008-04-22 at 18:57 +0900, Tejun Heo wrote:
>> klist is missing static initializers and definition helper. Add them.
>>
>> Signed-off-by: Tejun Heo <htejun@gmail.com>
>> ---
>> I can't tell who's in charge of this code, so I'm including last two
>> people who made changes and Andrew :-) This will be used by later USB
>> mode switch support, so I'm cc'ing USB people too.
>>
>> Thanks.
>>
>> 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..c6b697c 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(klist.k_lock), \
>
> May I ask you make that: __SPIN_LOCK_UNLOCKED(_name.k_lock)
>
> Otherwise we'll end up with multiple classes that have the same name.
These locks don't nest so being in the same class should be okay and I
was following what (at least some of) other __SPIN_LOCK_UNLOCKED users
are doing. If putting these locks into separate classes is the RTTD, sure.
Thanks.
--
tejun
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 1/2] klist: implement KLIST_INIT() and DEFINE_KLIST()
2008-04-22 13:03 ` Tejun Heo
@ 2008-04-22 13:06 ` Peter Zijlstra
2008-04-22 13:10 ` Tejun Heo
0 siblings, 1 reply; 12+ messages in thread
From: Peter Zijlstra @ 2008-04-22 13:06 UTC (permalink / raw)
To: Tejun Heo
Cc: James Bottomley, Alan Stern, Andrew Morton, Greg KH, oliver,
Alan Cox, zaitcev, Linux Kernel Mailing List, linux-usb
On Tue, 2008-04-22 at 22:03 +0900, Tejun Heo wrote:
> Peter Zijlstra wrote:
> > On Tue, 2008-04-22 at 18:57 +0900, Tejun Heo wrote:
> >> klist is missing static initializers and definition helper. Add them.
> >>
> >> Signed-off-by: Tejun Heo <htejun@gmail.com>
> >> ---
> >> I can't tell who's in charge of this code, so I'm including last two
> >> people who made changes and Andrew :-) This will be used by later USB
> >> mode switch support, so I'm cc'ing USB people too.
> >>
> >> Thanks.
> >>
> >> 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..c6b697c 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(klist.k_lock), \
> >
> > May I ask you make that: __SPIN_LOCK_UNLOCKED(_name.k_lock)
> >
> > Otherwise we'll end up with multiple classes that have the same name.
>
> These locks don't nest so being in the same class should be okay and I
> was following what (at least some of) other __SPIN_LOCK_UNLOCKED users
> are doing. If putting these locks into separate classes is the RTTD, sure.
Ah, they'll actually be in seprate classes all of the same name. So I
think it is cleaner to cause them to have separate names too.
see look_up_lock_class() in kernel/lockdep.c:
/*
* Static locks do not have their class-keys yet - for them the key
* is the lock object itself:
*/
if (unlikely(!lock->key))
lock->key = (void *)lock;
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 1/2] klist: implement KLIST_INIT() and DEFINE_KLIST()
2008-04-22 13:06 ` Peter Zijlstra
@ 2008-04-22 13:10 ` Tejun Heo
2008-04-25 16:37 ` Greg KH
0 siblings, 1 reply; 12+ messages in thread
From: Tejun Heo @ 2008-04-22 13:10 UTC (permalink / raw)
To: Peter Zijlstra
Cc: James Bottomley, Alan Stern, Andrew Morton, Greg KH, oliver,
Alan Cox, zaitcev, Linux Kernel Mailing List, linux-usb
Peter Zijlstra wrote:
>> These locks don't nest so being in the same class should be okay and I
>> was following what (at least some of) other __SPIN_LOCK_UNLOCKED users
>> are doing. If putting these locks into separate classes is the RTTD, sure.
>
> Ah, they'll actually be in seprate classes all of the same name. So I
> think it is cleaner to cause them to have separate names too.
>
> see look_up_lock_class() in kernel/lockdep.c:
>
> /*
> * Static locks do not have their class-keys yet - for them the key
> * is the lock object itself:
> */
> if (unlikely(!lock->key))
> lock->key = (void *)lock;
Ah.. I'll put change it to name. Thanks.
--
tejun
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 1/2] klist: implement KLIST_INIT() and DEFINE_KLIST()
2008-04-22 13:10 ` Tejun Heo
@ 2008-04-25 16:37 ` Greg KH
2008-04-25 18:16 ` [PATCH 1/2 UPDATED] " Tejun Heo
0 siblings, 1 reply; 12+ messages in thread
From: Greg KH @ 2008-04-25 16:37 UTC (permalink / raw)
To: Tejun Heo
Cc: Peter Zijlstra, James Bottomley, Alan Stern, Andrew Morton,
oliver, Alan Cox, zaitcev, Linux Kernel Mailing List, linux-usb
On Tue, Apr 22, 2008 at 10:10:11PM +0900, Tejun Heo wrote:
> Peter Zijlstra wrote:
>>> These locks don't nest so being in the same class should be okay and I
>>> was following what (at least some of) other __SPIN_LOCK_UNLOCKED users
>>> are doing. If putting these locks into separate classes is the RTTD,
>>> sure.
>> Ah, they'll actually be in seprate classes all of the same name. So I
>> think it is cleaner to cause them to have separate names too.
>> see look_up_lock_class() in kernel/lockdep.c:
>> /*
>> * Static locks do not have their class-keys yet - for them the
>> key
>> * is the lock object itself:
>> */
>> if (unlikely(!lock->key))
>> lock->key = (void *)lock;
>
> Ah.. I'll put change it to name. Thanks.
Do you have a new revision of this patch series that I can apply to my
trees?
thanks,
greg k-h
^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH 1/2 UPDATED] klist: implement KLIST_INIT() and DEFINE_KLIST()
2008-04-25 16:37 ` Greg KH
@ 2008-04-25 18:16 ` Tejun Heo
2008-04-25 22:30 ` Greg KH
2008-04-28 23:51 ` patch klist-implement-klist_init-and-define_klist.patch added to gregkh-2.6 tree gregkh
0 siblings, 2 replies; 12+ messages in thread
From: Tejun Heo @ 2008-04-25 18:16 UTC (permalink / raw)
To: Greg KH
Cc: Peter Zijlstra, James Bottomley, Alan Stern, Andrew Morton,
oliver, Alan Cox, zaitcev, Linux Kernel Mailing List, linux-usb
klist is missing static initializers and definition helper. Add them.
Signed-off-by: Tejun Heo <htejun@gmail.com>
Cc: Peter Zijlstra <peterz@infradead.org>
---
Updated to use _name.k_lock as advised.
Thanks.
include/linux/klist.h | 8 ++++++++
1 file changed, 8 insertions(+)
Index: work/include/linux/klist.h
===================================================================
--- work.orig/include/linux/klist.h
+++ work/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 *));
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 1/2 UPDATED] klist: implement KLIST_INIT() and DEFINE_KLIST()
2008-04-25 18:16 ` [PATCH 1/2 UPDATED] " Tejun Heo
@ 2008-04-25 22:30 ` Greg KH
2008-04-25 22:40 ` Tejun Heo
2008-04-28 23:51 ` patch klist-implement-klist_init-and-define_klist.patch added to gregkh-2.6 tree gregkh
1 sibling, 1 reply; 12+ messages in thread
From: Greg KH @ 2008-04-25 22:30 UTC (permalink / raw)
To: Tejun Heo
Cc: Peter Zijlstra, James Bottomley, Alan Stern, Andrew Morton,
oliver, Alan Cox, zaitcev, Linux Kernel Mailing List, linux-usb
On Sat, Apr 26, 2008 at 03:16:04AM +0900, Tejun Heo wrote:
> klist is missing static initializers and definition helper. Add them.
>
> Signed-off-by: Tejun Heo <htejun@gmail.com>
> Cc: Peter Zijlstra <peterz@infradead.org>
> ---
> Updated to use _name.k_lock as advised.
Thanks, was there a 2/2 patch in this series as well that I should be
applying?
greg k-h
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 1/2 UPDATED] klist: implement KLIST_INIT() and DEFINE_KLIST()
2008-04-25 22:30 ` Greg KH
@ 2008-04-25 22:40 ` Tejun Heo
0 siblings, 0 replies; 12+ messages in thread
From: Tejun Heo @ 2008-04-25 22:40 UTC (permalink / raw)
To: Greg KH
Cc: Peter Zijlstra, James Bottomley, Alan Stern, Andrew Morton,
oliver, Alan Cox, zaitcev, Linux Kernel Mailing List, linux-usb
Greg KH wrote:
> On Sat, Apr 26, 2008 at 03:16:04AM +0900, Tejun Heo wrote:
>> klist is missing static initializers and definition helper. Add them.
>>
>> Signed-off-by: Tejun Heo <htejun@gmail.com>
>> Cc: Peter Zijlstra <peterz@infradead.org>
>> ---
>> Updated to use _name.k_lock as advised.
>
> Thanks, was there a 2/2 patch in this series as well that I should be
> applying?
Yeap, it's named "[PATCH] klist: implement klist_add_{after|before}()".
I forgot to add "2/2".
Thanks.
--
tejun
^ permalink raw reply [flat|nested] 12+ messages in thread
* patch klist-implement-klist_add_-after-before.patch added to gregkh-2.6 tree
2008-04-22 9:58 ` [PATCH] klist: implement klist_add_{after|before}() Tejun Heo
@ 2008-04-28 23:51 ` gregkh
0 siblings, 0 replies; 12+ messages in thread
From: gregkh @ 2008-04-28 23:51 UTC (permalink / raw)
To: htejun, akpm, alan, gregkh, greg, James.Bottomley, linux-kernel,
stern
This is a note to let you know that I've just added the patch titled
Subject: klist: implement klist_add_{after|before}()
to my gregkh-2.6 tree. Its filename is
klist-implement-klist_add_-after-before.patch
This tree can be found at
http://www.kernel.org/pub/linux/kernel/people/gregkh/gregkh-2.6/patches/
>From htejun@gmail.com Tue Apr 22 02:58:55 2008
From: Tejun Heo <htejun@gmail.com>
Date: Tue, 22 Apr 2008 18:58:46 +0900
Subject: klist: implement klist_add_{after|before}()
To: James Bottomley <James.Bottomley@HansenPartnership.com>, Alan Stern <stern@rowland.harvard.edu>, Andrew Morton <akpm@linux-foundation.org>, Greg KH <greg@kroah.com>, oliver@neukum.org, Alan Cox <alan@lxorguk.ukuu.org.uk>, zaitcev@redhat.com, Linux Kernel Mailing List <linux-kernel@vger.kernel.org>, linux-usb@vger.kernel.org
Message-ID: <480DB6D6.5040808@gmail.com>
Add klist_add_after() and klist_add_before() which puts a new node
after and before an existing node, respectively. This is useful for
callers which need to keep klist ordered. Note that synchronizing
between simultaneous additions for ordering is the caller's
responsibility.
Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
---
include/linux/klist.h | 2 ++
lib/klist.c | 38 ++++++++++++++++++++++++++++++++++++++
2 files changed, 40 insertions(+)
--- a/include/linux/klist.h
+++ b/include/linux/klist.h
@@ -46,6 +46,8 @@ struct klist_node {
extern void klist_add_tail(struct klist_node * n, struct klist * k);
extern void klist_add_head(struct klist_node * n, struct klist * k);
+extern void klist_add_after(struct klist_node * n, struct klist_node * pos);
+extern void klist_add_before(struct klist_node * n, struct klist_node * pos);
extern void klist_del(struct klist_node * n);
extern void klist_remove(struct klist_node * n);
--- a/lib/klist.c
+++ b/lib/klist.c
@@ -120,6 +120,44 @@ void klist_add_tail(struct klist_node *
EXPORT_SYMBOL_GPL(klist_add_tail);
+/**
+ * klist_add_after - Init a klist_node and add it after an existing node
+ * @n: node we're adding.
+ * @pos: node to put @n after
+ */
+
+void klist_add_after(struct klist_node * n, struct klist_node * pos)
+{
+ struct klist *k = pos->n_klist;
+
+ klist_node_init(k, n);
+ spin_lock(&k->k_lock);
+ list_add(&n->n_node, &pos->n_node);
+ spin_unlock(&k->k_lock);
+}
+
+EXPORT_SYMBOL_GPL(klist_add_after);
+
+
+/**
+ * klist_add_before - Init a klist_node and add it before an existing node
+ * @n: node we're adding.
+ * @pos: node to put @n after
+ */
+
+void klist_add_before(struct klist_node * n, struct klist_node * pos)
+{
+ struct klist *k = pos->n_klist;
+
+ klist_node_init(k, n);
+ spin_lock(&k->k_lock);
+ list_add_tail(&n->n_node, &pos->n_node);
+ spin_unlock(&k->k_lock);
+}
+
+EXPORT_SYMBOL_GPL(klist_add_before);
+
+
static void klist_release(struct kref * kref)
{
struct klist_node * n = container_of(kref, struct klist_node, n_ref);
Patches currently in gregkh-2.6 which might be from htejun@gmail.com are
driver-core/sysfs-add-sys-dev-char-block-to-lookup-sysfs-path-by-major-minor.patch
driver-core/klist-implement-klist_add_-after-before.patch
driver-core/klist-implement-klist_init-and-define_klist.patch
^ permalink raw reply [flat|nested] 12+ messages in thread
* patch klist-implement-klist_init-and-define_klist.patch added to gregkh-2.6 tree
2008-04-25 18:16 ` [PATCH 1/2 UPDATED] " Tejun Heo
2008-04-25 22:30 ` Greg KH
@ 2008-04-28 23:51 ` gregkh
1 sibling, 0 replies; 12+ messages in thread
From: gregkh @ 2008-04-28 23:51 UTC (permalink / raw)
To: htejun, akpm, alan, gregkh, greg, James.Bottomley, linux-kernel,
peterz, stern
This is a note to let you know that I've just added the patch titled
Subject: klist: implement KLIST_INIT() and DEFINE_KLIST()
to my gregkh-2.6 tree. Its filename is
klist-implement-klist_init-and-define_klist.patch
This tree can be found at
http://www.kernel.org/pub/linux/kernel/people/gregkh/gregkh-2.6/patches/
>From linux-usb-owner@vger.kernel.org Fri Apr 25 11:19:08 2008
From: Tejun Heo <htejun@gmail.com>
Date: Sat, 26 Apr 2008 03:16:04 +0900
Subject: klist: implement KLIST_INIT() and DEFINE_KLIST()
To: Greg KH <greg@kroah.com>
Cc: Peter Zijlstra <peterz@infradead.org>, James Bottomley <James.Bottomley@HansenPartnership.com>, Alan Stern <stern@rowland.harvard.edu>, Andrew Morton <akpm@linux-foundation.org>, oliver@neukum.org, Alan Cox <alan@lxorguk.ukuu.org.uk>, zaitcev@redhat.com, Linux Kernel Mailing List <linux-kernel@vger.kernel.org>, linux-usb@vger.kernel.org
Message-ID: <48121FE4.5010803@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 file changed, 8 insertions(+)
--- 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 *));
Patches currently in gregkh-2.6 which might be from htejun@gmail.com are
driver-core/sysfs-add-sys-dev-char-block-to-lookup-sysfs-path-by-major-minor.patch
driver-core/klist-implement-klist_add_-after-before.patch
driver-core/klist-implement-klist_init-and-define_klist.patch
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2008-04-28 23:56 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-04-22 9:57 [PATCH 1/2] klist: implement KLIST_INIT() and DEFINE_KLIST() Tejun Heo
2008-04-22 9:58 ` [PATCH] klist: implement klist_add_{after|before}() Tejun Heo
2008-04-28 23:51 ` patch klist-implement-klist_add_-after-before.patch added to gregkh-2.6 tree gregkh
2008-04-22 12:57 ` [PATCH 1/2] klist: implement KLIST_INIT() and DEFINE_KLIST() Peter Zijlstra
2008-04-22 13:03 ` Tejun Heo
2008-04-22 13:06 ` Peter Zijlstra
2008-04-22 13:10 ` Tejun Heo
2008-04-25 16:37 ` Greg KH
2008-04-25 18:16 ` [PATCH 1/2 UPDATED] " Tejun Heo
2008-04-25 22:30 ` Greg KH
2008-04-25 22:40 ` Tejun Heo
2008-04-28 23:51 ` patch klist-implement-klist_init-and-define_klist.patch added to gregkh-2.6 tree gregkh
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox