On 27/03/2019 16:39, Andrew Cooper wrote: > On 18/03/2019 13:11, Juergen Gross wrote: >> Add a helper cpu_notifier_call_chain() to call notifier_call_chain() >> for a cpu with a specified action, returning an errno value. >> >> This avoids coding the same pattern multiple times. >> >> Signed-off-by: Juergen Gross <jgr...@suse.com> >> --- >> xen/common/cpu.c | 50 +++++++++++++++++++++----------------------------- >> 1 file changed, 21 insertions(+), 29 deletions(-) >> >> diff --git a/xen/common/cpu.c b/xen/common/cpu.c >> index 836c62f97f..c436c0de7f 100644 >> --- a/xen/common/cpu.c >> +++ b/xen/common/cpu.c >> @@ -71,11 +71,18 @@ void __init register_cpu_notifier(struct notifier_block >> *nb) >> spin_unlock(&cpu_add_remove_lock); >> } >> >> +static int cpu_notifier_call_chain(unsigned int cpu, unsigned long action, >> + struct notifier_block **nb) >> +{ >> + void *hcpu = (void *)(long)cpu; >> + int notifier_rc = notifier_call_chain(&cpu_chain, action, hcpu, nb); >> + >> + return (notifier_rc == NOTIFY_DONE) ? 0 : >> notifier_to_errno(notifier_rc); >> +} >> + >> static void _take_cpu_down(void *unused) >> { >> - void *hcpu = (void *)(long)smp_processor_id(); >> - int notifier_rc = notifier_call_chain(&cpu_chain, CPU_DYING, hcpu, >> NULL); >> - BUG_ON(notifier_rc != NOTIFY_DONE); >> + BUG_ON(cpu_notifier_call_chain(smp_processor_id(), CPU_DYING, NULL)); > > Where possible, we're trying to remove side effects from macros. > > Could I please talk you into writing this as: > > int rc = cpu_notifier_call_chain(smp_processor_id(), CPU_DYING, NULL); > > BUG_ON(rc);
Fine with me. Juergen _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel