/* Xive state for each CPU */
 static DEFINE_PER_CPU(struct xive_cpu *, xive_cpu);
 
-/*
- * A "disabled" interrupt should never fire, to catch problems
- * we set its logical number to this
- */
-#define XIVE_BAD_IRQ           0x7fffffff
-#define XIVE_MAX_IRQ           (XIVE_BAD_IRQ - 1)
-
 /* An invalid CPU target */
 #define XIVE_INVALID_TARGET    (-1)
 
        xc = per_cpu(xive_cpu, cpu);
 
        /* Check if we are already setup */
-       if (xc->hw_ipi != 0)
+       if (xc->hw_ipi != XIVE_BAD_IRQ)
                return 0;
 
        /* Grab an IPI from the backend, this will populate xc->hw_ipi */
        /* Disable the IPI and free the IRQ data */
 
        /* Already cleaned up ? */
-       if (xc->hw_ipi == 0)
+       if (xc->hw_ipi == XIVE_BAD_IRQ)
                return;
 
        /* Mask the IPI */
                if (np)
                        xc->chip_id = of_get_ibm_chip_id(np);
                of_node_put(np);
+               xc->hw_ipi = XIVE_BAD_IRQ;
 
                per_cpu(xive_cpu, cpu) = xc;
        }
 
        s64 rc;
 
        /* Free the IPI */
-       if (!xc->hw_ipi)
+       if (xc->hw_ipi == XIVE_BAD_IRQ)
                return;
        for (;;) {
                rc = opal_xive_free_irq(xc->hw_ipi);
                        msleep(OPAL_BUSY_DELAY_MS);
                        continue;
                }
-               xc->hw_ipi = 0;
+               xc->hw_ipi = XIVE_BAD_IRQ;
                break;
        }
 }
 
 
 static void xive_spapr_put_ipi(unsigned int cpu, struct xive_cpu *xc)
 {
-       if (!xc->hw_ipi)
+       if (xc->hw_ipi == XIVE_BAD_IRQ)
                return;
 
        xive_irq_bitmap_free(xc->hw_ipi);
-       xc->hw_ipi = 0;
+       xc->hw_ipi = XIVE_BAD_IRQ;
 }
 #endif /* CONFIG_SMP */
 
 
 #ifndef __XIVE_INTERNAL_H
 #define __XIVE_INTERNAL_H
 
+/*
+ * A "disabled" interrupt should never fire, to catch problems
+ * we set its logical number to this
+ */
+#define XIVE_BAD_IRQ           0x7fffffff
+#define XIVE_MAX_IRQ           (XIVE_BAD_IRQ - 1)
+
 /* Each CPU carry one of these with various per-CPU state */
 struct xive_cpu {
 #ifdef CONFIG_SMP