xen: notifier: refine 'notifier_head', use 'list_head' directly
PATCH RESEND 1/1 xen: notifier: refine 'notifier_head', use 'list_head' directly
'notifier_block' can be replaced with 'list_head' when used for 'notifier_head', this make the a little more clear.
--- xen/common/notifier.c | 12 ++++++------ xen/include/xen/notifier.h | 7 +++---- 2 files changed, 9 insertions(+), 10 deletions(-)
xen/common/notifier.c +6 -6
@@ -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 ) );
xen/include/xen/notifier.h +3 -4
@@ -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);
Signature · 7 lines
2.7.4 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 3 lines
Quoted 1 line
Quoted 1 line · On 03.06.19 at 03:33, <[email protected]> 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 ..."?
xen/common/notifier.c int notifier_call_chain( · line 77
Quoted 10 lines
xen/common/notifier.c +2
-2@@ -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.
xen/include/xen/notifier.h struct notifier_block { · line 35
Quoted 11 lines
xen/include/xen/notifier.h +1
-2@@ -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 - ...
xen/include/xen/notifier.h struct notifier_block { · line 36
Quoted 2 lines
xen/include/xen/notifier.h +2
-0+#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
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 4 lines · Jan Beulich
Quoted 3 lines
Quoted 1 line
Quoted 1 line · On 03.06.19 at 03:33, <[email protected]> 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.
Quoted 11 lines
xen/common/notifier.c int notifier_call_chain( · line 77
Quoted 10 lines
xen/common/notifier.c +2
-2@@ -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.
Quoted 6 lines
Quoted 6 lines
xen/include/xen/notifier.h +0
-0@@ -29,13 +29,12 @@ struct notifier_block { };
Quoted 7 lines
xen/include/xen/notifier.h struct notifier_block { · line 35
Quoted 6 lines
xen/include/xen/notifier.h +1
-2struct 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.
Quoted 6 lines
xen/include/xen/notifier.h struct notifier_block { · line 36
Quoted 3 lines
xen/include/xen/notifier.h +2
-0+#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.
Quoted 6 lines
Jan
.
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 5 lines
Quoted 1 line
Quoted 1 line · On 03.06.19 at 03:33, <[email protected]> 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 <[email protected]>
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
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 9 lines · Jan Beulich
Quoted 5 lines
Quoted 1 line
Quoted 1 line · On 03.06.19 at 03:33, <[email protected]> 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 <[email protected]>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.
Quoted 5 lines
Jan
.
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel