And similarly to gicv2_handle_irq_target(), rename "i" to "n" to avoid
suggesting that "i" is an integer. For gic-v2, fix it consistently also
in gicv2_read_lr() and gicv2_write_lr().

Signed-off-by: Andrea Bastoni <[email protected]>
---
 hypervisor/arch/arm-common/gic-v2.c | 18 +++++++++---------
 hypervisor/arch/arm-common/gic-v3.c | 10 +++++-----
 2 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/hypervisor/arch/arm-common/gic-v2.c 
b/hypervisor/arch/arm-common/gic-v2.c
index c5ad0607..4b69f74b 100644
--- a/hypervisor/arch/arm-common/gic-v2.c
+++ b/hypervisor/arch/arm-common/gic-v2.c
@@ -23,14 +23,14 @@ static unsigned int gic_num_lr;
 static void *gicc_base;
 static void *gich_base;
 
-static u32 gicv2_read_lr(unsigned int i)
+static u32 gicv2_read_lr(unsigned int n)
 {
-       return mmio_read32(gich_base + GICH_LR_BASE + i * 4);
+       return mmio_read32(gich_base + GICH_LR_BASE + n * 4);
 }
 
-static void gicv2_write_lr(unsigned int i, u32 value)
+static void gicv2_write_lr(unsigned int n, u32 value)
 {
-       mmio_write32(gich_base + GICH_LR_BASE + i * 4, value);
+       mmio_write32(gich_base + GICH_LR_BASE + n * 4, value);
 }
 
 /* Check that the targeted interface belongs to the cell */
@@ -277,23 +277,23 @@ static void gicv2_send_sgi(struct sgi *sgi)
 
 static int gicv2_inject_irq(u16 irq_id, u16 sender)
 {
-       int i;
+       unsigned int n;
        int first_free = -1;
        u32 lr;
        unsigned long elsr[2];
 
        elsr[0] = mmio_read32(gich_base + GICH_ELSR0);
        elsr[1] = mmio_read32(gich_base + GICH_ELSR1);
-       for (i = 0; i < gic_num_lr; i++) {
-               if (test_bit(i, elsr)) {
+       for (n = 0; n < gic_num_lr; n++) {
+               if (test_bit(n, elsr)) {
                        /* Entry is available */
                        if (first_free == -1)
-                               first_free = i;
+                               first_free = n;
                        continue;
                }
 
                /* Check that there is no overlapping */
-               lr = gicv2_read_lr(i);
+               lr = gicv2_read_lr(n);
                if ((lr & GICH_LR_VIRT_ID_MASK) == irq_id)
                        return -EEXIST;
        }
diff --git a/hypervisor/arch/arm-common/gic-v3.c 
b/hypervisor/arch/arm-common/gic-v3.c
index 949c4598..126f4524 100644
--- a/hypervisor/arch/arm-common/gic-v3.c
+++ b/hypervisor/arch/arm-common/gic-v3.c
@@ -529,17 +529,17 @@ static void gicv3_eoi_irq(u32 irq_id, bool deactivate)
 
 static int gicv3_inject_irq(u16 irq_id, u16 sender)
 {
-       int i;
+       unsigned int n;
        int free_lr = -1;
        u32 elsr;
        u64 lr;
 
        arm_read_sysreg(ICH_ELSR_EL2, elsr);
-       for (i = 0; i < gic_num_lr; i++) {
-               if ((elsr >> i) & 1) {
+       for (n = 0; n < gic_num_lr; n++) {
+               if ((elsr >> n) & 1) {
                        /* Entry is invalid, candidate for injection */
                        if (free_lr == -1)
-                               free_lr = i;
+                               free_lr = n;
                        continue;
                }
 
@@ -547,7 +547,7 @@ static int gicv3_inject_irq(u16 irq_id, u16 sender)
                 * Entry is in use, check that it doesn't match the one we want
                 * to inject.
                 */
-               lr = gicv3_read_lr(i);
+               lr = gicv3_read_lr(n);
 
                /*
                 * A strict phys->virt id mapping is used for SPIs, so this test
-- 
2.28.0

-- 
You received this message because you are subscribed to the Google Groups 
"Jailhouse" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jailhouse-dev/20201028210933.138379-11-andrea.bastoni%40tum.de.

Reply via email to