* [PATCH RESEND] xen: notifier: refine 'notifier_head', use 'list_head' directly
@ 2019-06-03 1:33 ` Baodong Chen
0 siblings, 0 replies; 10+ messages in thread
From: Baodong Chen @ 2019-06-03 1:33 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
'notifier_block' can be replaced with 'list_head' when used for
'notifier_head', this make the a little more clear.
Signed-off-by: Baodong Chen <chenbaodong@mxnavi.com>
---
xen/common/notifier.c | 12 ++++++------
xen/include/xen/notifier.h | 7 +++----
2 files changed, 9 insertions(+), 10 deletions(-)
diff --git a/xen/common/notifier.c b/xen/common/notifier.c
index 34488a8..c7b0669 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 )
@@ -71,16 +71,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..2e58bd9 100644
--- a/xen/include/xen/notifier.h
+++ b/xen/include/xen/notifier.h
@@ -29,13 +29,12 @@ 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);
--
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] 10+ messages in thread
* [Xen-devel] [PATCH RESEND] xen: notifier: refine 'notifier_head', use 'list_head' directly
@ 2019-06-03 1:33 ` Baodong Chen
0 siblings, 0 replies; 10+ messages in thread
From: Baodong Chen @ 2019-06-03 1:33 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
'notifier_block' can be replaced with 'list_head' when used for
'notifier_head', this make the a little more clear.
Signed-off-by: Baodong Chen <chenbaodong@mxnavi.com>
---
xen/common/notifier.c | 12 ++++++------
xen/include/xen/notifier.h | 7 +++----
2 files changed, 9 insertions(+), 10 deletions(-)
diff --git a/xen/common/notifier.c b/xen/common/notifier.c
index 34488a8..c7b0669 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 )
@@ -71,16 +71,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..2e58bd9 100644
--- a/xen/include/xen/notifier.h
+++ b/xen/include/xen/notifier.h
@@ -29,13 +29,12 @@ 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);
--
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] 10+ messages in thread
* Re: [PATCH RESEND] xen: notifier: refine 'notifier_head', use 'list_head' directly
@ 2019-06-03 9:27 ` Jan Beulich
0 siblings, 0 replies; 10+ messages in thread
From: Jan Beulich @ 2019-06-03 9:27 UTC (permalink / raw)
To: Baodong Chen
Cc: Stefano Stabellini, Wei Liu, Konrad Rzeszutek Wilk,
George Dunlap, Andrew Cooper, Ian Jackson, Tim Deegan,
Julien Grall, xen-devel
>>> On 03.06.19 at 03:33, <chenbaodong@mxnavi.com> wrote:
> 'notifier_block' can be replaced with 'list_head' when used for
> 'notifier_head', this make the a little more clear.
I guess you mean "... makes the code a little ..."?
> @@ -71,16 +71,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);
The outermost parentheses are now not really needed anymore.
> --- a/xen/include/xen/notifier.h
> +++ b/xen/include/xen/notifier.h
> @@ -29,13 +29,12 @@ 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) }
Note the blanks immediately inside the figure braces - ...
> +#define NOTIFIER_HEAD(name) \
> + struct notifier_head name = {.head = LIST_HEAD_INIT(name.head)}
... please don't break such style aspects, unless you know
it is something that needs fixing (for being in violation of our
style guidelines).
Jan
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [Xen-devel] [PATCH RESEND] xen: notifier: refine 'notifier_head', use 'list_head' directly
@ 2019-06-03 9:27 ` Jan Beulich
0 siblings, 0 replies; 10+ messages in thread
From: Jan Beulich @ 2019-06-03 9:27 UTC (permalink / raw)
To: Baodong Chen
Cc: Stefano Stabellini, Wei Liu, Konrad Rzeszutek Wilk,
George Dunlap, Andrew Cooper, Ian Jackson, Tim Deegan,
Julien Grall, xen-devel
>>> On 03.06.19 at 03:33, <chenbaodong@mxnavi.com> wrote:
> 'notifier_block' can be replaced with 'list_head' when used for
> 'notifier_head', this make the a little more clear.
I guess you mean "... makes the code a little ..."?
> @@ -71,16 +71,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);
The outermost parentheses are now not really needed anymore.
> --- a/xen/include/xen/notifier.h
> +++ b/xen/include/xen/notifier.h
> @@ -29,13 +29,12 @@ 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) }
Note the blanks immediately inside the figure braces - ...
> +#define NOTIFIER_HEAD(name) \
> + struct notifier_head name = {.head = LIST_HEAD_INIT(name.head)}
... please don't break such style aspects, unless you know
it is something that needs fixing (for being in violation of our
style guidelines).
Jan
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH RESEND] xen: notifier: refine 'notifier_head', use 'list_head' directly
@ 2019-06-03 9:28 ` Jan Beulich
0 siblings, 0 replies; 10+ messages in thread
From: Jan Beulich @ 2019-06-03 9:28 UTC (permalink / raw)
To: Baodong Chen
Cc: Stefano Stabellini, WeiLiu, Konrad Rzeszutek Wilk, George Dunlap,
Andrew Cooper, Ian Jackson, Tim Deegan, Julien Grall, xen-devel
>>> On 03.06.19 at 03:33, <chenbaodong@mxnavi.com> wrote:
> 'notifier_block' can be replaced with 'list_head' when used for
> 'notifier_head', this make the a little more clear.
>
> Signed-off-by: Baodong Chen <chenbaodong@mxnavi.com>
Oh, and also a remark regarding the title: Why "RESEND"? This
should be used only if you re-send an entirely unchanged patch,
perhaps because of a correction to the recipients list. Otherwise
please increment the version number.
Jan
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [Xen-devel] [PATCH RESEND] xen: notifier: refine 'notifier_head', use 'list_head' directly
@ 2019-06-03 9:28 ` Jan Beulich
0 siblings, 0 replies; 10+ messages in thread
From: Jan Beulich @ 2019-06-03 9:28 UTC (permalink / raw)
To: Baodong Chen
Cc: Stefano Stabellini, WeiLiu, Konrad Rzeszutek Wilk, George Dunlap,
Andrew Cooper, Ian Jackson, Tim Deegan, Julien Grall, xen-devel
>>> On 03.06.19 at 03:33, <chenbaodong@mxnavi.com> wrote:
> 'notifier_block' can be replaced with 'list_head' when used for
> 'notifier_head', this make the a little more clear.
>
> Signed-off-by: Baodong Chen <chenbaodong@mxnavi.com>
Oh, and also a remark regarding the title: Why "RESEND"? This
should be used only if you re-send an entirely unchanged patch,
perhaps because of a correction to the recipients list. Otherwise
please increment the version number.
Jan
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH RESEND] xen: notifier: refine 'notifier_head', use 'list_head' directly
@ 2019-06-03 9:44 ` chenbaodong
0 siblings, 0 replies; 10+ messages in thread
From: chenbaodong @ 2019-06-03 9:44 UTC (permalink / raw)
To: Jan Beulich
Cc: Stefano Stabellini, WeiLiu, Konrad Rzeszutek Wilk, George Dunlap,
Andrew Cooper, Ian Jackson, Tim Deegan, Julien Grall, xen-devel
On 6/3/19 17:28, Jan Beulich wrote:
>>>> On 03.06.19 at 03:33, <chenbaodong@mxnavi.com> wrote:
>> 'notifier_block' can be replaced with 'list_head' when used for
>> 'notifier_head', this make the a little more clear.
>>
>> Signed-off-by: Baodong Chen <chenbaodong@mxnavi.com>
> Oh, and also a remark regarding the title: Why "RESEND"? This
> should be used only if you re-send an entirely unchanged patch,
> perhaps because of a correction to the recipients list. Otherwise
> please increment the version number.
Hello Jan, Thanks for guiding me to the right direction.
This is my first experience sending patch using mail list.
I will use version number instead of resend next time.
> Jan
>
>
> .
>
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [Xen-devel] [PATCH RESEND] xen: notifier: refine 'notifier_head', use 'list_head' directly
@ 2019-06-03 9:44 ` chenbaodong
0 siblings, 0 replies; 10+ messages in thread
From: chenbaodong @ 2019-06-03 9:44 UTC (permalink / raw)
To: Jan Beulich
Cc: Stefano Stabellini, WeiLiu, Konrad Rzeszutek Wilk, George Dunlap,
Andrew Cooper, Ian Jackson, Tim Deegan, Julien Grall, xen-devel
On 6/3/19 17:28, Jan Beulich wrote:
>>>> On 03.06.19 at 03:33, <chenbaodong@mxnavi.com> wrote:
>> 'notifier_block' can be replaced with 'list_head' when used for
>> 'notifier_head', this make the a little more clear.
>>
>> Signed-off-by: Baodong Chen <chenbaodong@mxnavi.com>
> Oh, and also a remark regarding the title: Why "RESEND"? This
> should be used only if you re-send an entirely unchanged patch,
> perhaps because of a correction to the recipients list. Otherwise
> please increment the version number.
Hello Jan, Thanks for guiding me to the right direction.
This is my first experience sending patch using mail list.
I will use version number instead of resend next time.
> Jan
>
>
> .
>
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH RESEND] xen: notifier: refine 'notifier_head', use 'list_head' directly
@ 2019-06-03 10:00 ` chenbaodong
0 siblings, 0 replies; 10+ messages in thread
From: chenbaodong @ 2019-06-03 10:00 UTC (permalink / raw)
To: Jan Beulich
Cc: Stefano Stabellini, Wei Liu, Konrad Rzeszutek Wilk,
George Dunlap, Andrew Cooper, Ian Jackson, Tim Deegan,
Julien Grall, xen-devel
On 6/3/19 17:27, Jan Beulich wrote:
>>>> On 03.06.19 at 03:33, <chenbaodong@mxnavi.com> wrote:
>> 'notifier_block' can be replaced with 'list_head' when used for
>> 'notifier_head', this make the a little more clear.
> I guess you mean "... makes the code a little ..."?
Yes, fixed, see v1.
>> @@ -71,16 +71,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);
> The outermost parentheses are now not really needed anymore.
Yes, fixed, see v1.
>
>> --- a/xen/include/xen/notifier.h
>> +++ b/xen/include/xen/notifier.h
>> @@ -29,13 +29,12 @@ 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) }
> Note the blanks immediately inside the figure braces - ...
Yes, fixed, see v1.
>
>> +#define NOTIFIER_HEAD(name) \
>> + struct notifier_head name = {.head = LIST_HEAD_INIT(name.head)}
> ... please don't break such style aspects, unless you know
> it is something that needs fixing (for being in violation of our
> style guidelines).
Yes, fixed, see v1.
>
> Jan
>
>
> .
>
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [Xen-devel] [PATCH RESEND] xen: notifier: refine 'notifier_head', use 'list_head' directly
@ 2019-06-03 10:00 ` chenbaodong
0 siblings, 0 replies; 10+ messages in thread
From: chenbaodong @ 2019-06-03 10:00 UTC (permalink / raw)
To: Jan Beulich
Cc: Stefano Stabellini, Wei Liu, Konrad Rzeszutek Wilk,
George Dunlap, Andrew Cooper, Ian Jackson, Tim Deegan,
Julien Grall, xen-devel
On 6/3/19 17:27, Jan Beulich wrote:
>>>> On 03.06.19 at 03:33, <chenbaodong@mxnavi.com> wrote:
>> 'notifier_block' can be replaced with 'list_head' when used for
>> 'notifier_head', this make the a little more clear.
> I guess you mean "... makes the code a little ..."?
Yes, fixed, see v1.
>> @@ -71,16 +71,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);
> The outermost parentheses are now not really needed anymore.
Yes, fixed, see v1.
>
>> --- a/xen/include/xen/notifier.h
>> +++ b/xen/include/xen/notifier.h
>> @@ -29,13 +29,12 @@ 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) }
> Note the blanks immediately inside the figure braces - ...
Yes, fixed, see v1.
>
>> +#define NOTIFIER_HEAD(name) \
>> + struct notifier_head name = {.head = LIST_HEAD_INIT(name.head)}
> ... please don't break such style aspects, unless you know
> it is something that needs fixing (for being in violation of our
> style guidelines).
Yes, fixed, see v1.
>
> Jan
>
>
> .
>
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2019-06-03 10:00 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-03 1:33 [PATCH RESEND] xen: notifier: refine 'notifier_head', use 'list_head' directly Baodong Chen
2019-06-03 1:33 ` [Xen-devel] " Baodong Chen
2019-06-03 9:27 ` Jan Beulich
2019-06-03 9:27 ` [Xen-devel] " Jan Beulich
2019-06-03 10:00 ` chenbaodong
2019-06-03 10:00 ` [Xen-devel] " chenbaodong
2019-06-03 9:28 ` Jan Beulich
2019-06-03 9:28 ` [Xen-devel] " Jan Beulich
2019-06-03 9:44 ` chenbaodong
2019-06-03 9:44 ` [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.