Message ID | 20201117191954.1322844-8-sean.v.kelley@intel.com |
---|---|
State | New |
Headers | show |
Series | Add RCEC handling to PCI/AER | expand |
Hi, On 11/17/20 11:19 AM, Sean V Kelley wrote: > Instead of calling pci_pcie_type(dev) twice, call it once and save the > result. No functional change intended. Same optimization can be applied to drivers/pci/pcie/portdrv_pci.c and drivers/pci/pcie/aer.c. Can you fix them together ? > > [bhelgaas: split to separate patch] > Link: https://lore.kernel.org/r/20201002184735.1229220-6-seanvk.dev@oregontracks.org > Signed-off-by: Sean V Kelley <sean.v.kelley@intel.com> > Signed-off-by: Bjorn Helgaas <bhelgaas@google.com> > Acked-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> > --- > drivers/pci/pcie/err.c | 5 +++-- > 1 file changed, 3 insertions(+), 2 deletions(-) > > diff --git a/drivers/pci/pcie/err.c b/drivers/pci/pcie/err.c > index 05f61da5ed9d..7a5af873d8bc 100644 > --- a/drivers/pci/pcie/err.c > +++ b/drivers/pci/pcie/err.c > @@ -150,6 +150,7 @@ pci_ers_result_t pcie_do_recovery(struct pci_dev *dev, > pci_channel_state_t state, > pci_ers_result_t (*reset_subordinates)(struct pci_dev *pdev)) > { > + int type = pci_pcie_type(dev); > pci_ers_result_t status = PCI_ERS_RESULT_CAN_RECOVER; > struct pci_bus *bus; > > @@ -157,8 +158,8 @@ pci_ers_result_t pcie_do_recovery(struct pci_dev *dev, > * Error recovery runs on all subordinates of the first downstream port. > * If the downstream port detected the error, it is cleared at the end. > */ > - if (!(pci_pcie_type(dev) == PCI_EXP_TYPE_ROOT_PORT || > - pci_pcie_type(dev) == PCI_EXP_TYPE_DOWNSTREAM)) > + if (!(type == PCI_EXP_TYPE_ROOT_PORT || > + type == PCI_EXP_TYPE_DOWNSTREAM)) > dev = pci_upstream_bridge(dev); > bus = dev->subordinate; > >
Hi Sathya, > On Nov 17, 2020, at 1:58 PM, Kuppuswamy, Sathyanarayanan <sathyanarayanan.kuppuswamy@linux.intel.com> wrote: > > Hi, > > On 11/17/20 11:19 AM, Sean V Kelley wrote: >> Instead of calling pci_pcie_type(dev) twice, call it once and save the >> result. No functional change intended. > > Same optimization can be applied to drivers/pci/pcie/portdrv_pci.c and > drivers/pci/pcie/aer.c. > > Can you fix them together ? Makes sense. I can combine the changes. Thanks, Sean > >> [bhelgaas: split to separate patch] >> Link: https://lore.kernel.org/r/20201002184735.1229220-6-seanvk.dev@oregontracks.org >> Signed-off-by: Sean V Kelley <sean.v.kelley@intel.com> >> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com> >> Acked-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> >> --- >> drivers/pci/pcie/err.c | 5 +++-- >> 1 file changed, 3 insertions(+), 2 deletions(-) >> diff --git a/drivers/pci/pcie/err.c b/drivers/pci/pcie/err.c >> index 05f61da5ed9d..7a5af873d8bc 100644 >> --- a/drivers/pci/pcie/err.c >> +++ b/drivers/pci/pcie/err.c >> @@ -150,6 +150,7 @@ pci_ers_result_t pcie_do_recovery(struct pci_dev *dev, >> pci_channel_state_t state, >> pci_ers_result_t (*reset_subordinates)(struct pci_dev *pdev)) >> { >> + int type = pci_pcie_type(dev); >> pci_ers_result_t status = PCI_ERS_RESULT_CAN_RECOVER; >> struct pci_bus *bus; >> @@ -157,8 +158,8 @@ pci_ers_result_t pcie_do_recovery(struct pci_dev *dev, >> * Error recovery runs on all subordinates of the first downstream port. >> * If the downstream port detected the error, it is cleared at the end. >> */ >> - if (!(pci_pcie_type(dev) == PCI_EXP_TYPE_ROOT_PORT || >> - pci_pcie_type(dev) == PCI_EXP_TYPE_DOWNSTREAM)) >> + if (!(type == PCI_EXP_TYPE_ROOT_PORT || >> + type == PCI_EXP_TYPE_DOWNSTREAM)) >> dev = pci_upstream_bridge(dev); >> bus = dev->subordinate; >> > > -- > Sathyanarayanan Kuppuswamy > Linux Kernel Developer
diff --git a/drivers/pci/pcie/err.c b/drivers/pci/pcie/err.c index 05f61da5ed9d..7a5af873d8bc 100644 --- a/drivers/pci/pcie/err.c +++ b/drivers/pci/pcie/err.c @@ -150,6 +150,7 @@ pci_ers_result_t pcie_do_recovery(struct pci_dev *dev, pci_channel_state_t state, pci_ers_result_t (*reset_subordinates)(struct pci_dev *pdev)) { + int type = pci_pcie_type(dev); pci_ers_result_t status = PCI_ERS_RESULT_CAN_RECOVER; struct pci_bus *bus; @@ -157,8 +158,8 @@ pci_ers_result_t pcie_do_recovery(struct pci_dev *dev, * Error recovery runs on all subordinates of the first downstream port. * If the downstream port detected the error, it is cleared at the end. */ - if (!(pci_pcie_type(dev) == PCI_EXP_TYPE_ROOT_PORT || - pci_pcie_type(dev) == PCI_EXP_TYPE_DOWNSTREAM)) + if (!(type == PCI_EXP_TYPE_ROOT_PORT || + type == PCI_EXP_TYPE_DOWNSTREAM)) dev = pci_upstream_bridge(dev); bus = dev->subordinate;