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

[PATCH xenbus 10/11] Replace if-else-if sequence in SyncWorker() with switch



From: Paul Durrant <pdurrant@xxxxxxxxxx>

Now that the set of requests and other re-factoring is complete, tidy up the
code in SyncWorker().

Signed-off-by: Paul Durrant <pdurrant@xxxxxxxxxx>
---
 src/xenbus/sync.c | 31 ++++++++++++++++++++++---------
 1 file changed, 22 insertions(+), 9 deletions(-)

diff --git a/src/xenbus/sync.c b/src/xenbus/sync.c
index b6665708a58e..5b2b76a47f58 100644
--- a/src/xenbus/sync.c
+++ b/src/xenbus/sync.c
@@ -267,6 +267,8 @@ SyncWorker(
 
     Request = SYNC_REQUEST_NONE;
     for (;;) {
+        NTSTATUS status;
+
         KeMemoryBarrier();
 
         if (Context->Request == SYNC_REQUEST_EXIT)
@@ -277,20 +279,31 @@ SyncWorker(
             continue;
         }
 
-        if (Context->Request == SYNC_REQUEST_DISABLE_INTERRUPTS) {
-            NTSTATUS    status = __SyncProcessorDisableInterrupts();
-                    
-            if (!NT_SUCCESS(status))
-                continue;
-        } else if (Context->Request == SYNC_REQUEST_RUN_EARLY) {
+        status = STATUS_SUCCESS;
+
+        switch (Context->Request) {
+        case SYNC_REQUEST_DISABLE_INTERRUPTS:
+            status = __SyncProcessorDisableInterrupts();
+            break;
+
+        case SYNC_REQUEST_RUN_EARLY:
             __SyncProcessorRunEarly(Index);
-        } else if (Context->Request == SYNC_REQUEST_ENABLE_INTERRUPTS) {
+            break;
+
+        case SYNC_REQUEST_ENABLE_INTERRUPTS:
             __SyncProcessorEnableInterrupts();
-        } else if (Context->Request == SYNC_REQUEST_RUN_LATE) {
+            break;
+
+        case SYNC_REQUEST_RUN_LATE:
             __SyncProcessorRunLate(Index);
+            break;
+
+        default:
+            break;
         }
 
-        Request = Context->Request;
+        if (NT_SUCCESS(status))
+            Request = Context->Request;
     }
 
     Trace("<==== (%u:%u)\n", ProcNumber.Group, ProcNumber.Number);
-- 
2.17.1




 


Rackspace

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