[HVM] Remove a duplicated range checking in vioapic_set_irq.
authorkfraser@localhost.localdomain <kfraser@localhost.localdomain>
Fri, 10 Nov 2006 10:31:29 +0000 (10:31 +0000)
committerkfraser@localhost.localdomain <kfraser@localhost.localdomain>
Fri, 10 Nov 2006 10:31:29 +0000 (10:31 +0000)
Since irq range checking has already been done at the
beginning of this function.

Signed-off-by: Xin Li <xin.b.li@intel.com>
xen/arch/x86/hvm/vioapic.c

index 9eae82f40aa722586b26ae0e2888d8936be86d97..dc7f29d820869b1506cd5d0c7ecbe3f429cf711f 100644 (file)
@@ -504,6 +504,7 @@ void vioapic_set_xen_irq(struct domain *d, int irq, int level)
 void vioapic_set_irq(struct domain *d, int irq, int level)
 {
     struct vioapic *vioapic = domain_vioapic(d);
+    uint32_t bit;
 
     HVM_DBG_LOG(DBG_LEVEL_IOAPIC, "ioapic_set_irq "
                 "irq %x level %x\n", irq, level);
@@ -528,22 +529,19 @@ void vioapic_set_irq(struct domain *d, int irq, int level)
                 vioapic->redirtbl[irq].fields.mask,
                 vioapic->redirtbl[irq].fields.dest_id);
 
-    if ( (irq >= 0) && (irq < VIOAPIC_NUM_PINS) )
+    bit = 1 << irq;
+    if ( vioapic->redirtbl[irq].fields.trig_mode == VIOAPIC_LEVEL_TRIG )
     {
-        uint32_t bit = 1 << irq;
-        if ( vioapic->redirtbl[irq].fields.trig_mode == VIOAPIC_LEVEL_TRIG )
-        {
-            if ( level )
-                vioapic->irr |= bit;
-            else
-                vioapic->irr &= ~bit;
-        }
+        if ( level )
+            vioapic->irr |= bit;
         else
-        {
-            if ( level )
-                /* XXX No irr clear for edge interrupt */
-                vioapic->irr |= bit;
-        }
+            vioapic->irr &= ~bit;
+    }
+    else
+    {
+        if ( level )
+            /* XXX No irr clear for edge interrupt */
+            vioapic->irr |= bit;
     }
 
     service_ioapic(vioapic);