]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commitdiff
PCI/switchtec: Remove redundant valid PFF number count
authorWesley Sheng <wesley.sheng@microchip.com>
Mon, 6 Jan 2020 19:03:29 +0000 (12:03 -0700)
committerBjorn Helgaas <bhelgaas@google.com>
Wed, 15 Jan 2020 17:00:36 +0000 (11:00 -0600)
Remove the redundant valid PFF number count from ioctl_event_summary(),
since init_pff() has already counted the valid PFFs.

Link: https://lore.kernel.org/r/20200106190337.2428-5-logang@deltatee.com
Signed-off-by: Wesley Sheng <wesley.sheng@microchip.com>
Signed-off-by: Logan Gunthorpe <logang@deltatee.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
drivers/pci/switch/switchtec.c

index 218e67428cf9f7962235d34a752d9318f8d1190c..231499da2899601acc96530d31b79b08afbc24c5 100644 (file)
@@ -683,11 +683,7 @@ static int ioctl_event_summary(struct switchtec_dev *stdev,
                s->part[i] = reg;
        }
 
-       for (i = 0; i < SWITCHTEC_MAX_PFF_CSR; i++) {
-               reg = ioread16(&stdev->mmio_pff_csr[i].vendor_id);
-               if (reg != PCI_VENDOR_ID_MICROSEMI)
-                       break;
-
+       for (i = 0; i < stdev->pff_csr_count; i++) {
                reg = ioread32(&stdev->mmio_pff_csr[i].pff_event_summary);
                s->pff[i] = reg;
        }
@@ -1327,16 +1323,16 @@ static void init_pff(struct switchtec_dev *stdev)
        stdev->pff_csr_count = i;
 
        reg = ioread32(&pcfg->usp_pff_inst_id);
-       if (reg < SWITCHTEC_MAX_PFF_CSR)
+       if (reg < stdev->pff_csr_count)
                stdev->pff_local[reg] = 1;
 
        reg = ioread32(&pcfg->vep_pff_inst_id);
-       if (reg < SWITCHTEC_MAX_PFF_CSR)
+       if (reg < stdev->pff_csr_count)
                stdev->pff_local[reg] = 1;
 
        for (i = 0; i < ARRAY_SIZE(pcfg->dsp_pff_inst_id); i++) {
                reg = ioread32(&pcfg->dsp_pff_inst_id[i]);
-               if (reg < SWITCHTEC_MAX_PFF_CSR)
+               if (reg < stdev->pff_csr_count)
                        stdev->pff_local[reg] = 1;
        }
 }