arm/irq: Reorder check in route_irq_to_guest() to avoid 4 layers of "if"
PATCH 1/1 arm/irq: Reorder check in route_irq_to_guest() to avoid 4 layers of "if"
From: Oleksandr Tyshchenko <[email protected]>
Remove one layer of "if" by reordering the check in route_irq_to_guest() to make code more clearer.
--- xen/arch/arm/irq.c | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-)
xen/arch/arm/irq.c +7 -11
@@ -481,21 +481,17 @@ int route_irq_to_guest(struct domain *d, unsigned int virq, {struct domain *ad =irq_get_domain (desc); -if ( d == ad ) - { -if (irq_get_guest_info (desc)->virq != virq ) - { -printk (XENLOG_G_ERR -"d%u: IRQ %u is already assigned to vIRQ %u\n" , - d->domain_id, irq,irq_get_guest_info (desc)->virq); - retval = -EBUSY ; - } - } -else +if ( d != ad ) {printk (XENLOG_G_ERR "IRQ %u is already used by domain %u\n" , irq, ad->domain_id); retval = -EBUSY ; + }else if (irq_get_guest_info (desc)->virq != virq ) + { +printk (XENLOG_G_ERR +"d%u: IRQ %u is already assigned to vIRQ %u\n" , + d->domain_id, irq,irq_get_guest_info (desc)->virq); + retval = -EBUSY ; } } else
Signature · 7 lines
2.7.4 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
Hi Oleksandr,
Thank you for the patch.
Quoted 26 lines · Oleksandr Tyshchenko
From: Oleksandr Tyshchenko <[email protected]>
Remove one layer of "if" by reordering the check in
route_irq_to_guest()to make code more clearer.Signed-off-by Oleksandr Tyshchenko <[email protected]>CC Julien Grall <[email protected]>--- xen/arch/arm/irq.c | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-)xen/arch/arm/irq.c +0
-7@@ -481,21 +481,17 @@ int route_irq_to_guest(struct domain *d, unsigned int virq, {struct domain *ad =irq_get_domain (desc); -if ( d == ad ) - { -if (irq_get_guest_info (desc)->virq != virq ) - { -printk (XENLOG_G_ERR -"d%u: IRQ %u is already assigned to vIRQ %u\n" , - d->domain_id, irq,irq_get_guest_info (desc)->virq);
xen/arch/arm/irq.c int route_irq_to_guest(struct domain *d, unsigned int virq, · line 489
Quoted 10 lines
xen/arch/arm/irq.c +2
-4- retval = -EBUSY ; - } - } -else +if ( d != ad ) {printk (XENLOG_G_ERR "IRQ %u is already used by domain %u\n" , irq, ad->domain_id); retval = -EBUSY ; + }else if (irq_get_guest_info (desc)->virq != virq )
In Xen coding style the } and else if should be in separate line. E.g
}
else if ( ... )
With that fixed:
Stefano, would you be happy to fix this minor coding style issue while committing?
Cheers,
Signature · 6 lines
Julien Grall _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
Quoted 50 lines · Julien Grall
Hi Oleksandr,
Thank you for the patch.
Quoted 29 lines · Oleksandr Tyshchenko
From: Oleksandr Tyshchenko <[email protected]>
Remove one layer of "if" by reordering the check in
route_irq_to_guest()to make code more clearer.Signed-off-by Oleksandr Tyshchenko <[email protected]>CC Julien Grall <[email protected]>--- xen/arch/arm/irq.c | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-)xen/arch/arm/irq.c +0
-8@@ -481,21 +481,17 @@ int route_irq_to_guest(struct domain *d, unsigned int virq, {struct domain *ad =irq_get_domain (desc); -if ( d == ad ) - { -if (irq_get_guest_info (desc)->virq != virq ) - { -printk (XENLOG_G_ERR -"d%u: IRQ %u is already assigned to vIRQ %u\n" , - d->domain_id, irq, irq_get_guest_info(desc)->virq); - retval = -EBUSY ;xen/arch/arm/irq.c int route_irq_to_guest(struct domain *d, unsigned int · line 492
Quoted 10 lines
xen/arch/arm/irq.c +2
-3- } - } -else +if ( d != ad ) { printk(XENLOG_G_ERR "IRQ %u is already used by domain %u\n", irq, ad->domain_id); retval = -EBUSY ; + }else if (irq_get_guest_info (desc)->virq != virq )In Xen coding style the } and else if should be in separate line. E.g
}
else if ( ... )
Quoted 6 lines
With that fixed:
Reviewed-by Julien Grall <[email protected]>Stefano, would you be happy to fix this minor coding style issue while committing?
done
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel