* [PATCH] xen: notifier: refine 'notifier_head', use 'list_head' directly
@ 2019-05-31 2:35 ` Baodong Chen
0 siblings, 0 replies; 6+ messages in thread
From: Baodong Chen @ 2019-05-31 2:35 UTC (permalink / raw)
To: xen-devel
Cc: Stefano Stabellini, Wei Liu, Konrad Rzeszutek Wilk,
George Dunlap, Andrew Cooper, Ian Jackson, Tim Deegan,
Julien Grall, Jan Beulich, Baodong Chen
Signed-off-by: Baodong Chen <chenbaodong@mxnavi.com>
---
xen/common/notifier.c | 25 ++++++-------------------
xen/include/xen/notifier.h | 21 +++++++++++++++------
2 files changed, 21 insertions(+), 25 deletions(-)
diff --git a/xen/common/notifier.c b/xen/common/notifier.c
index 34488a8..f959a79 100644
--- a/xen/common/notifier.c
+++ b/xen/common/notifier.c
@@ -21,10 +21,10 @@
void __init notifier_chain_register(
struct notifier_head *nh, struct notifier_block *n)
{
- struct list_head *chain = &nh->head.chain;
+ struct list_head *chain = &nh->head;
struct notifier_block *nb;
- while ( chain->next != &nh->head.chain )
+ while ( chain->next != &nh->head )
{
nb = list_entry(chain->next, struct notifier_block, chain);
if ( n->priority > nb->priority )
@@ -35,19 +35,6 @@ void __init notifier_chain_register(
list_add(&n->chain, chain);
}
-/**
- * notifier_chain_unregister - Remove notifier from a raw notifier chain
- * @nh: Pointer to head of the raw notifier chain
- * @n: Entry to remove from notifier chain
- *
- * Removes a notifier from a raw notifier chain.
- * All locking must be provided by the caller.
- */
-void __init notifier_chain_unregister(
- struct notifier_head *nh, struct notifier_block *n)
-{
- list_del(&n->chain);
-}
/**
* notifier_call_chain - Informs the registered notifiers about an event.
@@ -71,16 +58,16 @@ int notifier_call_chain(
{
int ret = NOTIFY_DONE;
struct list_head *cursor;
- struct notifier_block *nb;
+ struct notifier_block *nb = NULL;
bool_t reverse = !!(val & NOTIFY_REVERSE);
- cursor = &(pcursor && *pcursor ? *pcursor : &nh->head)->chain;
+ cursor = (pcursor && *pcursor ? &(*pcursor)->chain : &nh->head);
do {
cursor = reverse ? cursor->prev : cursor->next;
- nb = list_entry(cursor, struct notifier_block, chain);
- if ( cursor == &nh->head.chain )
+ if ( cursor == &nh->head )
break;
+ nb = list_entry(cursor, struct notifier_block, chain);
ret = nb->notifier_call(nb, val, v);
} while ( !(ret & NOTIFY_STOP_MASK) );
diff --git a/xen/include/xen/notifier.h b/xen/include/xen/notifier.h
index d1ff9b1..b1961cb 100644
--- a/xen/include/xen/notifier.h
+++ b/xen/include/xen/notifier.h
@@ -29,18 +29,27 @@ struct notifier_block {
};
struct notifier_head {
- struct notifier_block head;
+ struct list_head head;
};
-#define NOTIFIER_INIT(name) { .head.chain = LIST_HEAD_INIT(name.head.chain) }
+#define NOTIFIER_HEAD(name) \
+ struct notifier_head name = {.head = LIST_HEAD_INIT(name.head)}
-#define NOTIFIER_HEAD(name) \
- struct notifier_head name = NOTIFIER_INIT(name)
void notifier_chain_register(
struct notifier_head *nh, struct notifier_block *nb);
-void notifier_chain_unregister(
- struct notifier_head *nh, struct notifier_block *nb);
+
+/**
+ * notifier_chain_unregister - Remove notifier from a raw notifier chain
+ * @n: Entry to remove from notifier chain
+ *
+ * Removes a notifier from a raw notifier chain.
+ * All locking must be provided by the caller.
+ */
+static inline void notifier_chain_unregister(struct notifier_block *n)
+{
+ list_del(&n->chain);
+}
int notifier_call_chain(
struct notifier_head *nh, unsigned long val, void *v,
--
2.7.4
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [Xen-devel] [PATCH] xen: notifier: refine 'notifier_head', use 'list_head' directly
@ 2019-05-31 2:35 ` Baodong Chen
0 siblings, 0 replies; 6+ messages in thread
From: Baodong Chen @ 2019-05-31 2:35 UTC (permalink / raw)
To: xen-devel
Cc: Stefano Stabellini, Wei Liu, Konrad Rzeszutek Wilk,
George Dunlap, Andrew Cooper, Ian Jackson, Tim Deegan,
Julien Grall, Jan Beulich, Baodong Chen
Signed-off-by: Baodong Chen <chenbaodong@mxnavi.com>
---
xen/common/notifier.c | 25 ++++++-------------------
xen/include/xen/notifier.h | 21 +++++++++++++++------
2 files changed, 21 insertions(+), 25 deletions(-)
diff --git a/xen/common/notifier.c b/xen/common/notifier.c
index 34488a8..f959a79 100644
--- a/xen/common/notifier.c
+++ b/xen/common/notifier.c
@@ -21,10 +21,10 @@
void __init notifier_chain_register(
struct notifier_head *nh, struct notifier_block *n)
{
- struct list_head *chain = &nh->head.chain;
+ struct list_head *chain = &nh->head;
struct notifier_block *nb;
- while ( chain->next != &nh->head.chain )
+ while ( chain->next != &nh->head )
{
nb = list_entry(chain->next, struct notifier_block, chain);
if ( n->priority > nb->priority )
@@ -35,19 +35,6 @@ void __init notifier_chain_register(
list_add(&n->chain, chain);
}
-/**
- * notifier_chain_unregister - Remove notifier from a raw notifier chain
- * @nh: Pointer to head of the raw notifier chain
- * @n: Entry to remove from notifier chain
- *
- * Removes a notifier from a raw notifier chain.
- * All locking must be provided by the caller.
- */
-void __init notifier_chain_unregister(
- struct notifier_head *nh, struct notifier_block *n)
-{
- list_del(&n->chain);
-}
/**
* notifier_call_chain - Informs the registered notifiers about an event.
@@ -71,16 +58,16 @@ int notifier_call_chain(
{
int ret = NOTIFY_DONE;
struct list_head *cursor;
- struct notifier_block *nb;
+ struct notifier_block *nb = NULL;
bool_t reverse = !!(val & NOTIFY_REVERSE);
- cursor = &(pcursor && *pcursor ? *pcursor : &nh->head)->chain;
+ cursor = (pcursor && *pcursor ? &(*pcursor)->chain : &nh->head);
do {
cursor = reverse ? cursor->prev : cursor->next;
- nb = list_entry(cursor, struct notifier_block, chain);
- if ( cursor == &nh->head.chain )
+ if ( cursor == &nh->head )
break;
+ nb = list_entry(cursor, struct notifier_block, chain);
ret = nb->notifier_call(nb, val, v);
} while ( !(ret & NOTIFY_STOP_MASK) );
diff --git a/xen/include/xen/notifier.h b/xen/include/xen/notifier.h
index d1ff9b1..b1961cb 100644
--- a/xen/include/xen/notifier.h
+++ b/xen/include/xen/notifier.h
@@ -29,18 +29,27 @@ struct notifier_block {
};
struct notifier_head {
- struct notifier_block head;
+ struct list_head head;
};
-#define NOTIFIER_INIT(name) { .head.chain = LIST_HEAD_INIT(name.head.chain) }
+#define NOTIFIER_HEAD(name) \
+ struct notifier_head name = {.head = LIST_HEAD_INIT(name.head)}
-#define NOTIFIER_HEAD(name) \
- struct notifier_head name = NOTIFIER_INIT(name)
void notifier_chain_register(
struct notifier_head *nh, struct notifier_block *nb);
-void notifier_chain_unregister(
- struct notifier_head *nh, struct notifier_block *nb);
+
+/**
+ * notifier_chain_unregister - Remove notifier from a raw notifier chain
+ * @n: Entry to remove from notifier chain
+ *
+ * Removes a notifier from a raw notifier chain.
+ * All locking must be provided by the caller.
+ */
+static inline void notifier_chain_unregister(struct notifier_block *n)
+{
+ list_del(&n->chain);
+}
int notifier_call_chain(
struct notifier_head *nh, unsigned long val, void *v,
--
2.7.4
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] xen: notifier: refine 'notifier_head', use 'list_head' directly
@ 2019-05-31 10:22 ` Julien Grall
0 siblings, 0 replies; 6+ messages in thread
From: Julien Grall @ 2019-05-31 10:22 UTC (permalink / raw)
To: Baodong Chen, xen-devel
Cc: Stefano Stabellini, Wei Liu, Konrad Rzeszutek Wilk,
George Dunlap, Andrew Cooper, Ian Jackson, Tim Deegan,
Jan Beulich
Hi,
Missing commit message here.
On 5/31/19 3:35 AM, Baodong Chen wrote:
> Signed-off-by: Baodong Chen <chenbaodong@mxnavi.com>
> ---
> xen/common/notifier.c | 25 ++++++-------------------
> xen/include/xen/notifier.h | 21 +++++++++++++++------
> 2 files changed, 21 insertions(+), 25 deletions(-)
>
> diff --git a/xen/common/notifier.c b/xen/common/notifier.c
> index 34488a8..f959a79 100644
> --- a/xen/common/notifier.c
> +++ b/xen/common/notifier.c
> @@ -21,10 +21,10 @@
> void __init notifier_chain_register(
> struct notifier_head *nh, struct notifier_block *n)
> {
> - struct list_head *chain = &nh->head.chain;
> + struct list_head *chain = &nh->head;
> struct notifier_block *nb;
>
> - while ( chain->next != &nh->head.chain )
> + while ( chain->next != &nh->head )
> {
> nb = list_entry(chain->next, struct notifier_block, chain);
> if ( n->priority > nb->priority )
> @@ -35,19 +35,6 @@ void __init notifier_chain_register(
> list_add(&n->chain, chain);
> }
>
> -/**
> - * notifier_chain_unregister - Remove notifier from a raw notifier chain
> - * @nh: Pointer to head of the raw notifier chain
> - * @n: Entry to remove from notifier chain
> - *
> - * Removes a notifier from a raw notifier chain.
> - * All locking must be provided by the caller.
> - */
> -void __init notifier_chain_unregister(
> - struct notifier_head *nh, struct notifier_block *n)
> -{
> - list_del(&n->chain);
> -}
Why did you move the function?
Cheers,
--
Julien Grall
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Xen-devel] [PATCH] xen: notifier: refine 'notifier_head', use 'list_head' directly
@ 2019-05-31 10:22 ` Julien Grall
0 siblings, 0 replies; 6+ messages in thread
From: Julien Grall @ 2019-05-31 10:22 UTC (permalink / raw)
To: Baodong Chen, xen-devel
Cc: Stefano Stabellini, Wei Liu, Konrad Rzeszutek Wilk,
George Dunlap, Andrew Cooper, Ian Jackson, Tim Deegan,
Jan Beulich
Hi,
Missing commit message here.
On 5/31/19 3:35 AM, Baodong Chen wrote:
> Signed-off-by: Baodong Chen <chenbaodong@mxnavi.com>
> ---
> xen/common/notifier.c | 25 ++++++-------------------
> xen/include/xen/notifier.h | 21 +++++++++++++++------
> 2 files changed, 21 insertions(+), 25 deletions(-)
>
> diff --git a/xen/common/notifier.c b/xen/common/notifier.c
> index 34488a8..f959a79 100644
> --- a/xen/common/notifier.c
> +++ b/xen/common/notifier.c
> @@ -21,10 +21,10 @@
> void __init notifier_chain_register(
> struct notifier_head *nh, struct notifier_block *n)
> {
> - struct list_head *chain = &nh->head.chain;
> + struct list_head *chain = &nh->head;
> struct notifier_block *nb;
>
> - while ( chain->next != &nh->head.chain )
> + while ( chain->next != &nh->head )
> {
> nb = list_entry(chain->next, struct notifier_block, chain);
> if ( n->priority > nb->priority )
> @@ -35,19 +35,6 @@ void __init notifier_chain_register(
> list_add(&n->chain, chain);
> }
>
> -/**
> - * notifier_chain_unregister - Remove notifier from a raw notifier chain
> - * @nh: Pointer to head of the raw notifier chain
> - * @n: Entry to remove from notifier chain
> - *
> - * Removes a notifier from a raw notifier chain.
> - * All locking must be provided by the caller.
> - */
> -void __init notifier_chain_unregister(
> - struct notifier_head *nh, struct notifier_block *n)
> -{
> - list_del(&n->chain);
> -}
Why did you move the function?
Cheers,
--
Julien Grall
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] xen: notifier: refine 'notifier_head', use 'list_head' directly
@ 2019-06-03 1:25 ` chenbaodong
0 siblings, 0 replies; 6+ messages in thread
From: chenbaodong @ 2019-06-03 1:25 UTC (permalink / raw)
To: Julien Grall, xen-devel
Cc: Stefano Stabellini, Wei Liu, Konrad Rzeszutek Wilk,
George Dunlap, Andrew Cooper, Ian Jackson, Tim Deegan,
Jan Beulich
On 5/31/19 18:22, Julien Grall wrote:
> Hi,
>
> Missing commit message here.
>
Yes, will be added.
> On 5/31/19 3:35 AM, Baodong Chen wrote:
>> Signed-off-by: Baodong Chen <chenbaodong@mxnavi.com>
>> ---
>> xen/common/notifier.c | 25 ++++++-------------------
>> xen/include/xen/notifier.h | 21 +++++++++++++++------
>> 2 files changed, 21 insertions(+), 25 deletions(-)
>>
>> diff --git a/xen/common/notifier.c b/xen/common/notifier.c
>> index 34488a8..f959a79 100644
>> --- a/xen/common/notifier.c
>> +++ b/xen/common/notifier.c
>> @@ -21,10 +21,10 @@
>> void __init notifier_chain_register(
>> struct notifier_head *nh, struct notifier_block *n)
>> {
>> - struct list_head *chain = &nh->head.chain;
>> + struct list_head *chain = &nh->head;
>> struct notifier_block *nb;
>> - while ( chain->next != &nh->head.chain )
>> + while ( chain->next != &nh->head )
>> {
>> nb = list_entry(chain->next, struct notifier_block, chain);
>> if ( n->priority > nb->priority )
>> @@ -35,19 +35,6 @@ void __init notifier_chain_register(
>> list_add(&n->chain, chain);
>> }
>> -/**
>> - * notifier_chain_unregister - Remove notifier from a raw notifier
>> chain
>> - * @nh: Pointer to head of the raw notifier chain
>> - * @n: Entry to remove from notifier chain
>> - *
>> - * Removes a notifier from a raw notifier chain.
>> - * All locking must be provided by the caller.
>> - */
>> -void __init notifier_chain_unregister(
>> - struct notifier_head *nh, struct notifier_block *n)
>> -{
>> - list_del(&n->chain);
>> -}
>
> Why did you move the function?
My fault, should NOT touch this at all.
Patch will be resent.
>
>
> Cheers,
>
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Xen-devel] [PATCH] xen: notifier: refine 'notifier_head', use 'list_head' directly
@ 2019-06-03 1:25 ` chenbaodong
0 siblings, 0 replies; 6+ messages in thread
From: chenbaodong @ 2019-06-03 1:25 UTC (permalink / raw)
To: Julien Grall, xen-devel
Cc: Stefano Stabellini, Wei Liu, Konrad Rzeszutek Wilk,
George Dunlap, Andrew Cooper, Ian Jackson, Tim Deegan,
Jan Beulich
On 5/31/19 18:22, Julien Grall wrote:
> Hi,
>
> Missing commit message here.
>
Yes, will be added.
> On 5/31/19 3:35 AM, Baodong Chen wrote:
>> Signed-off-by: Baodong Chen <chenbaodong@mxnavi.com>
>> ---
>> xen/common/notifier.c | 25 ++++++-------------------
>> xen/include/xen/notifier.h | 21 +++++++++++++++------
>> 2 files changed, 21 insertions(+), 25 deletions(-)
>>
>> diff --git a/xen/common/notifier.c b/xen/common/notifier.c
>> index 34488a8..f959a79 100644
>> --- a/xen/common/notifier.c
>> +++ b/xen/common/notifier.c
>> @@ -21,10 +21,10 @@
>> void __init notifier_chain_register(
>> struct notifier_head *nh, struct notifier_block *n)
>> {
>> - struct list_head *chain = &nh->head.chain;
>> + struct list_head *chain = &nh->head;
>> struct notifier_block *nb;
>> - while ( chain->next != &nh->head.chain )
>> + while ( chain->next != &nh->head )
>> {
>> nb = list_entry(chain->next, struct notifier_block, chain);
>> if ( n->priority > nb->priority )
>> @@ -35,19 +35,6 @@ void __init notifier_chain_register(
>> list_add(&n->chain, chain);
>> }
>> -/**
>> - * notifier_chain_unregister - Remove notifier from a raw notifier
>> chain
>> - * @nh: Pointer to head of the raw notifier chain
>> - * @n: Entry to remove from notifier chain
>> - *
>> - * Removes a notifier from a raw notifier chain.
>> - * All locking must be provided by the caller.
>> - */
>> -void __init notifier_chain_unregister(
>> - struct notifier_head *nh, struct notifier_block *n)
>> -{
>> - list_del(&n->chain);
>> -}
>
> Why did you move the function?
My fault, should NOT touch this at all.
Patch will be resent.
>
>
> Cheers,
>
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2019-06-03 1:26 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-31 2:35 [PATCH] xen: notifier: refine 'notifier_head', use 'list_head' directly Baodong Chen
2019-05-31 2:35 ` [Xen-devel] " Baodong Chen
2019-05-31 10:22 ` Julien Grall
2019-05-31 10:22 ` [Xen-devel] " Julien Grall
2019-06-03 1:25 ` chenbaodong
2019-06-03 1:25 ` [Xen-devel] " chenbaodong
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.