staging: mt7621-pci: rename 'PCIE_P2P_MAX' into 'PCIE_P2P_CNT'
authorSergio Paracuellos <sergio.paracuellos@gmail.com>
Mon, 13 Apr 2020 15:50:16 +0000 (17:50 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 16 Apr 2020 10:33:01 +0000 (12:33 +0200)
Definition 'PCIE_P2P_MAX' is '3'. The value here is not a MAXimum.
It is a count or a number. It is how many masks there are.
The masks are numbered 0, 1, 2 so the maximum is 2. Hence rename
variable into 'PCIE_P2P_CNT' which is a more accurate name.

Suggested-by: NeilBrown <neil@brown.name>
Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
Link: https://lore.kernel.org/r/20200413155018.31921-1-sergio.paracuellos@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/mt7621-pci/pci-mt7621.c

index 36207243a71b0485ee44dc6aeb20e773cd96e27a..6a9f4b6cdd9354818cba757c7858f60b07ed43bd 100644 (file)
@@ -55,7 +55,7 @@
 #define RALINK_PCI_IOBASE              0x002C
 
 /* PCICFG virtual bridges */
-#define PCIE_P2P_MAX                   3
+#define PCIE_P2P_CNT                   3
 #define PCIE_P2P_BR_DEVNUM_SHIFT(p)    (16 + (p) * 4)
 #define PCIE_P2P_BR_DEVNUM0_SHIFT      PCIE_P2P_BR_DEVNUM_SHIFT(0)
 #define PCIE_P2P_BR_DEVNUM1_SHIFT      PCIE_P2P_BR_DEVNUM_SHIFT(1)
@@ -138,7 +138,7 @@ struct mt7621_pcie {
        } offset;
        unsigned long io_map_base;
        struct list_head ports;
-       int irq_map[PCIE_P2P_MAX];
+       int irq_map[PCIE_P2P_CNT];
        bool resets_inverted;
 };
 
@@ -607,8 +607,8 @@ static int mt7621_pcie_init_virtual_bridges(struct mt7621_pcie *pcie)
        u32 pcie_link_status = 0;
        u32 n;
        int i = 0;
-       u32 p2p_br_devnum[PCIE_P2P_MAX];
-       int irqs[PCIE_P2P_MAX];
+       u32 p2p_br_devnum[PCIE_P2P_CNT];
+       int irqs[PCIE_P2P_CNT];
        struct mt7621_pcie_port *port;
 
        list_for_each_entry(port, &pcie->ports, list) {
@@ -623,11 +623,11 @@ static int mt7621_pcie_init_virtual_bridges(struct mt7621_pcie *pcie)
                return -1;
 
        n = 0;
-       for (i = 0; i < PCIE_P2P_MAX; i++)
+       for (i = 0; i < PCIE_P2P_CNT; i++)
                if (pcie_link_status & BIT(i))
                        p2p_br_devnum[i] = n++;
 
-       for (i = 0; i < PCIE_P2P_MAX; i++)
+       for (i = 0; i < PCIE_P2P_CNT; i++)
                if ((pcie_link_status & BIT(i)) == 0)
                        p2p_br_devnum[i] = n++;
 
@@ -639,11 +639,11 @@ static int mt7621_pcie_init_virtual_bridges(struct mt7621_pcie *pcie)
 
        /* Assign IRQs */
        n = 0;
-       for (i = 0; i < PCIE_P2P_MAX; i++)
+       for (i = 0; i < PCIE_P2P_CNT; i++)
                if (pcie_link_status & BIT(i))
                        pcie->irq_map[n++] = irqs[i];
 
-       for (i = n; i < PCIE_P2P_MAX; i++)
+       for (i = n; i < PCIE_P2P_CNT; i++)
                pcie->irq_map[i] = -1;
 
        return 0;