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

[Xen-changelog] Fix remove_pin_at_irq(), introduced with changeset



# HG changeset patch
# User kaf24@xxxxxxxxxxxxxxxxxxxx
# Node ID 70837ac15cadf83e1fda27ae8468317afeb88ab0
# Parent  12621916d8202c552ebf61127ef404354ed8ad0a
Fix remove_pin_at_irq(), introduced with changeset
9586:f84a333d8aa6e1a25e2b73b07610e95007267f6a.

Signed-off-by: Keir Fraser <keir@xxxxxxxxxxxxx>

diff -r 12621916d820 -r 70837ac15cad xen/arch/x86/io_apic.c
--- a/xen/arch/x86/io_apic.c    Sat Apr  8 08:05:53 2006
+++ b/xen/arch/x86/io_apic.c    Sat Apr  8 10:01:17 2006
@@ -110,7 +110,6 @@
 static void remove_pin_at_irq(unsigned int irq, int apic, int pin)
 {
     struct irq_pin_list *entry, *prev;
-    int idx;
 
     for (entry = &irq_2_pin[irq]; ; entry = &irq_2_pin[entry->next]) {
         if ((entry->apic == apic) && (entry->pin == pin))
@@ -119,18 +118,24 @@
             BUG();
     }
 
-    entry->pin  = -1;
-    entry->apic = -1;
+    entry->pin = entry->apic = -1;
     
-    idx = entry - irq_2_pin;
-    if (idx >= NR_IRQS) {
-        while (prev->next != idx)
+    if (entry != &irq_2_pin[irq]) {
+        /* Removed entry is not at head of list. */
+        prev = &irq_2_pin[irq];
+        while (&irq_2_pin[prev->next] != entry)
             prev = &irq_2_pin[prev->next];
         prev->next = entry->next;
         entry->next = irq_2_pin_free_entry;
-        irq_2_pin_free_entry = idx;
-    } else {
-        entry->next = 0;
+        irq_2_pin_free_entry = entry - irq_2_pin;
+    } else if (entry->next != 0) {
+        /* Removed entry is at head of multi-item list. */
+        prev  = entry;
+        entry = &irq_2_pin[entry->next];
+        *prev = *entry;
+        entry->pin = entry->apic = -1;
+        entry->next = irq_2_pin_free_entry;
+        irq_2_pin_free_entry = entry - irq_2_pin;
     }
 }
 

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

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