Re: [PATCH] xen/notifier: simplify using notifier_[to|from]_errno()

2022-11-15 Thread Julien Grall

Hi Juergen,

On 28/10/2022 12:41, Juergen Gross wrote:

Today all users of notifier_from_errno() and notifier_to_errno() are
Handling the success case the same way, by using

   !rc ? NOTIFY_DONE : notifier_from_errno(rc)

or

   (notifier_rc == NOTIFY_DONE) ? 0 : notifier_to_errno(notifier_rc);

Simplify the use cases by moving the handling of the success case into
the functions.

Signed-off-by: Juergen Gross 


Acked-by: Julien Grall 

Cheers,

--
Julien Grall



Re: [PATCH] xen/notifier: simplify using notifier_[to|from]_errno()

2022-11-10 Thread Jan Beulich
On 28.10.2022 13:41, Juergen Gross wrote:
> Today all users of notifier_from_errno() and notifier_to_errno() are
> Handling the success case the same way, by using
> 
>   !rc ? NOTIFY_DONE : notifier_from_errno(rc)
> 
> or
> 
>   (notifier_rc == NOTIFY_DONE) ? 0 : notifier_to_errno(notifier_rc);
> 
> Simplify the use cases by moving the handling of the success case into
> the functions.
> 
> Signed-off-by: Juergen Gross 

Acked-by: Jan Beulich 





Re: [PATCH] xen/notifier: simplify using notifier_[to|from]_errno()

2022-11-04 Thread Dario Faggioli
On Fri, 2022-10-28 at 13:41 +0200, Juergen Gross wrote:
> Today all users of notifier_from_errno() and notifier_to_errno() are
> Handling the success case the same way, by using
> 
>   !rc ? NOTIFY_DONE : notifier_from_errno(rc)
> 
> or
> 
>   (notifier_rc == NOTIFY_DONE) ? 0 : notifier_to_errno(notifier_rc);
> 
> Simplify the use cases by moving the handling of the success case
> into
> the functions.
> 
> Signed-off-by: Juergen Gross 
> ---
>  ...
>  xen/common/sched/core.c | 2 +-
>  xen/common/sched/cpupool.c  | 2 +-
>
Reviewed-by: Dario Faggioli 

Regards
-- 
Dario Faggioli, Ph.D
http://about.me/dario.faggioli
Virtualization Software Engineer
SUSE Labs, SUSE https://www.suse.com/
---
<> (Raistlin Majere)


signature.asc
Description: This is a digitally signed message part


[PATCH] xen/notifier: simplify using notifier_[to|from]_errno()

2022-10-28 Thread Juergen Gross
Today all users of notifier_from_errno() and notifier_to_errno() are
Handling the success case the same way, by using

  !rc ? NOTIFY_DONE : notifier_from_errno(rc)

or

  (notifier_rc == NOTIFY_DONE) ? 0 : notifier_to_errno(notifier_rc);

Simplify the use cases by moving the handling of the success case into
the functions.

Signed-off-by: Juergen Gross 
---
 xen/arch/arm/cpuerrata.c| 2 +-
 xen/arch/arm/gic-v3-lpi.c   | 2 +-
 xen/arch/arm/irq.c  | 2 +-
 xen/arch/arm/percpu.c   | 2 +-
 xen/arch/arm/smpboot.c  | 2 +-
 xen/arch/x86/acpi/cpu_idle.c| 2 +-
 xen/arch/x86/cpu/mcheck/mce.c   | 2 +-
 xen/arch/x86/cpu/mcheck/mce_intel.c | 2 +-
 xen/arch/x86/cpu/mwait-idle.c   | 2 +-
 xen/arch/x86/genapic/x2apic.c   | 2 +-
 xen/arch/x86/hvm/hvm.c  | 2 +-
 xen/arch/x86/percpu.c   | 2 +-
 xen/arch/x86/psr.c  | 2 +-
 xen/arch/x86/smpboot.c  | 2 +-
 xen/common/cpu.c| 2 +-
 xen/common/sched/core.c | 2 +-
 xen/common/sched/cpupool.c  | 2 +-
 xen/include/xen/notifier.h  | 4 ++--
 18 files changed, 19 insertions(+), 19 deletions(-)

diff --git a/xen/arch/arm/cpuerrata.c b/xen/arch/arm/cpuerrata.c
index ae649d16ef..5952111b72 100644
--- a/xen/arch/arm/cpuerrata.c
+++ b/xen/arch/arm/cpuerrata.c
@@ -724,7 +724,7 @@ static int cpu_errata_callback(struct notifier_block *nfb,
 break;
 }
 
-return !rc ? NOTIFY_DONE : notifier_from_errno(rc);
+return notifier_from_errno(rc);
 }
 
 static struct notifier_block cpu_errata_nfb = {
diff --git a/xen/arch/arm/gic-v3-lpi.c b/xen/arch/arm/gic-v3-lpi.c
index 61d90eb386..f0b7ef17da 100644
--- a/xen/arch/arm/gic-v3-lpi.c
+++ b/xen/arch/arm/gic-v3-lpi.c
@@ -402,7 +402,7 @@ static int cpu_callback(struct notifier_block *nfb, 
unsigned long action,
 break;
 }
 
-return !rc ? NOTIFY_DONE : notifier_from_errno(rc);
+return notifier_from_errno(rc);
 }
 
 static struct notifier_block cpu_nfb = {
diff --git a/xen/arch/arm/irq.c b/xen/arch/arm/irq.c
index fd0c15fffd..00fadbc354 100644
--- a/xen/arch/arm/irq.c
+++ b/xen/arch/arm/irq.c
@@ -148,7 +148,7 @@ static int cpu_callback(struct notifier_block *nfb, 
unsigned long action,
 break;
 }
 
-return !rc ? NOTIFY_DONE : notifier_from_errno(rc);
+return notifier_from_errno(rc);
 }
 
 static struct notifier_block cpu_nfb = {
diff --git a/xen/arch/arm/percpu.c b/xen/arch/arm/percpu.c
index 25442c48fe..67eb821ff6 100644
--- a/xen/arch/arm/percpu.c
+++ b/xen/arch/arm/percpu.c
@@ -68,7 +68,7 @@ static int cpu_percpu_callback(
 break;
 }
 
-return !rc ? NOTIFY_DONE : notifier_from_errno(rc);
+return notifier_from_errno(rc);
 }
 
 static struct notifier_block cpu_percpu_nfb = {
diff --git a/xen/arch/arm/smpboot.c b/xen/arch/arm/smpboot.c
index f7bda3a18b..bfa988c162 100644
--- a/xen/arch/arm/smpboot.c
+++ b/xen/arch/arm/smpboot.c
@@ -562,7 +562,7 @@ static int cpu_smpboot_callback(struct notifier_block *nfb,
 break;
 }
 
-return !rc ? NOTIFY_DONE : notifier_from_errno(rc);
+return notifier_from_errno(rc);
 }
 
 static struct notifier_block cpu_smpboot_nfb = {
diff --git a/xen/arch/x86/acpi/cpu_idle.c b/xen/arch/x86/acpi/cpu_idle.c
index 557bc6ef86..427c8c89c5 100644
--- a/xen/arch/x86/acpi/cpu_idle.c
+++ b/xen/arch/x86/acpi/cpu_idle.c
@@ -1663,7 +1663,7 @@ static int cf_check cpu_callback(
 break;
 }
 
-return !rc ? NOTIFY_DONE : notifier_from_errno(rc);
+return notifier_from_errno(rc);
 }
 
 static struct notifier_block cpu_nfb = {
diff --git a/xen/arch/x86/cpu/mcheck/mce.c b/xen/arch/x86/cpu/mcheck/mce.c
index f68e31b643..3e93bdd8da 100644
--- a/xen/arch/x86/cpu/mcheck/mce.c
+++ b/xen/arch/x86/cpu/mcheck/mce.c
@@ -757,7 +757,7 @@ static int cf_check cpu_callback(
 break;
 }
 
-return !rc ? NOTIFY_DONE : notifier_from_errno(rc);
+return notifier_from_errno(rc);
 }
 
 static struct notifier_block cpu_nfb = {
diff --git a/xen/arch/x86/cpu/mcheck/mce_intel.c 
b/xen/arch/x86/cpu/mcheck/mce_intel.c
index 28a605a5cb..301533722d 100644
--- a/xen/arch/x86/cpu/mcheck/mce_intel.c
+++ b/xen/arch/x86/cpu/mcheck/mce_intel.c
@@ -951,7 +951,7 @@ static int cf_check cpu_callback(
 break;
 }
 
-return !rc ? NOTIFY_DONE : notifier_from_errno(rc);
+return notifier_from_errno(rc);
 }
 
 static struct notifier_block cpu_nfb = {
diff --git a/xen/arch/x86/cpu/mwait-idle.c b/xen/arch/x86/cpu/mwait-idle.c
index ffdc6fb2fc..9e981e7e26 100644
--- a/xen/arch/x86/cpu/mwait-idle.c
+++ b/xen/arch/x86/cpu/mwait-idle.c
@@ -1537,7 +1537,7 @@ static int cf_check mwait_idle_cpu_init(
dev = processor_powers[cpu];
if (!rc && cpuidle_current_governor->enable)
rc = cpuidle_current_governor->enable(dev);
-   return !rc ? NOTIFY_DONE : notifier_from_errno(rc);
+   return