diff mbox series

[for-2.12,v2,08/12] spapr: remove the use of ics_valid_irq()

Message ID 20171109101439.390-9-clg@kaod.org
State New
Headers show
Series spapr: introduce an IRQ allocator at the machine level | expand

Commit Message

Cédric Le Goater Nov. 9, 2017, 10:14 a.m. UTC
ics_valid_irq() can be replaced by a simple check on the 'srcno'
number. It also removes a dependency on the ICSState object of the
sPAPR machine.

Signed-off-by: Cédric Le Goater <clg@kaod.org>
---
 hw/ppc/spapr.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
index 6c3fc12ed8e1..0c6a4c8bffc0 100644
--- a/hw/ppc/spapr.c
+++ b/hw/ppc/spapr.c
@@ -3619,11 +3619,10 @@  static int spapr_irq_alloc_block(XICSFabric *xi, int count, int align)
 static void spapr_irq_free_block(XICSFabric *xi, int irq, int num)
 {
     sPAPRMachineState *spapr = SPAPR_MACHINE(xi);
-    ICSState *ics = spapr->ics;
     int srcno = irq - spapr->irq_base;
     int i;
 
-    if (ics_valid_irq(ics, irq)) {
+    if (srcno >= 0 && srcno < spapr->nr_irqs) {
         trace_spapr_irq_free(0, irq, num);
         for (i = srcno; i < srcno + num; ++i) {
             if (!test_bit(i, spapr->irq_map)) {