[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH v5 03/11] x86/passthrough: Replace pt_irq_create_bind() goto restart with a loop



Change "goto restart" retry in pt_irq_create_bind() into a "for ( ; ;)"
loop with continue/break, so that the following patch extracting the
block into a helper is only a code move without a label crossing a
function boundary. No functional change.

Signed-off-by: Julian Vetter <julian.vetter@xxxxxxxxxx>
---
Changes in v5:
- New patch, split out of v4's "Extract pt_irq_dpci_setup()". It only
  converts the "goto restart" retry into a "for ( ; ; )" loop, so the
  following commit's extraction is only a code move with no label
  crossing a function boundary.
- Use "for ( ; ; )" rather than v4's "do { } while ( true )".

Signed-off-by: Julian Vetter <julian.vetter@xxxxxxxxxx>
---
 xen/drivers/passthrough/x86/hvm.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/xen/drivers/passthrough/x86/hvm.c 
b/xen/drivers/passthrough/x86/hvm.c
index 1d5b1fb0f8..a74521fb57 100644
--- a/xen/drivers/passthrough/x86/hvm.c
+++ b/xen/drivers/passthrough/x86/hvm.c
@@ -228,7 +228,7 @@ int pt_irq_create_bind(
     if ( pirq < 0 || pirq >= d->nr_pirqs )
         return -EINVAL;
 
- restart:
+    for ( ; ; )
     {
         write_lock(&d->event_lock);
 
@@ -276,8 +276,10 @@ int pt_irq_create_bind(
         {
             write_unlock(&d->event_lock);
             cpu_relax();
-            goto restart;
+            continue;
         }
+
+        break;
     }
 
     switch ( pt_irq_bind->irq_type )
-- 
2.53.0



--
Julian Vetter | Vates Hypervisor & Kernel Developer

XCP-ng & Xen Orchestra - Vates solutions

web: https://vates.tech

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.