PCI/ERR: Rename pci_aer_clear_device_status() to pcie_clear_device_status()
Subsystems (2)
PATCH 1/1 PCI/ERR: Rename pci_aer_clear_device_status() to pcie_clear_device_status()
From: Bjorn Helgaas <[email protected]>
pci_aer_clear_device_status() clears the error bits in the PCIe Device Status Register (PCI_EXP_DEVSTA). Every PCIe device has this register, regardless of whether it supports AER.
Rename pci_aer_clear_device_status() to pcie_clear_device_status() to make clear that it is PCIe-specific but not AER-specific. No functional change intended.
--- drivers/pci/pci.h | 4 ++-- drivers/pci/pcie/aer.c | 4 ++-- drivers/pci/pcie/err.c | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-)
drivers/pci/pci.h +2 -2
@@ -657,16 +657,16 @@ void pci_no_aer(void);void pci_aer_init (struct pci_dev *dev);void pci_aer_exit (struct pci_dev *dev);extern const struct attribute_group aer_stats_attr_group; +void pcie_clear_device_status (struct pci_dev *dev);void pci_aer_clear_fatal_status (struct pci_dev *dev); -void pci_aer_clear_device_status (struct pci_dev *dev);int pci_aer_clear_status (struct pci_dev *dev);int pci_aer_raw_clear_status (struct pci_dev *dev);#else static inline void pci_no_aer (void ) { }static inline void pci_aer_init (struct pci_dev *d) { }static inline void pci_aer_exit (struct pci_dev *d) { } +static inline void pcie_clear_device_status (struct pci_dev *dev) { }static inline void pci_aer_clear_fatal_status (struct pci_dev *dev) { } -static inline void pci_aer_clear_device_status (struct pci_dev *dev) { }static inline int pci_aer_clear_status (struct pci_dev *dev) {return -EINVAL ; }static inline int pci_aer_raw_clear_status (struct pci_dev *dev) {return -EINVAL ; }#endif
drivers/pci/pcie/aer.c +2 -2
@@ -241,7 +241,7 @@ int pci_disable_pcie_error_reporting(struct pci_dev *dev) }EXPORT_SYMBOL_GPL (pci_disable_pcie_error_reporting); -void pci_aer_clear_device_status (struct pci_dev *dev) +void pcie_clear_device_status (struct pci_dev *dev) {u16 sta;
@@ -947,7 +947,7 @@ static void handle_error_source(struct pci_dev *dev, struct aer_err_info *info)if (aer)pci_write_config_dword (dev, aer +PCI_ERR_COR_STATUS , info->status); -pci_aer_clear_device_status (dev); +pcie_clear_device_status (dev); }else if (info->severity ==AER_NONFATAL )pcie_do_recovery (dev, pci_channel_io_normal, aer_root_reset);else if (info->severity ==AER_FATAL )
drivers/pci/pcie/err.c +1 -1
@@ -197,7 +197,7 @@ pci_ers_result_t pcie_do_recovery(struct pci_dev *dev,pci_dbg (dev,"broadcast resume message\n" );pci_walk_bus (bus, report_resume, &status); -pci_aer_clear_device_status (dev); +pcie_clear_device_status (dev);pci_aer_clear_nonfatal_status (dev);pci_info (dev,"device recovery successful\n" );return status;
Signature · 1 line
2.25.1
Hi Bjorn,
Quoted 5 lines · Bjorn Helgaas
From: Bjorn Helgaas <[email protected]>
pci_aer_clear_device_status()clears the error bits in the PCIe Device Status Register (PCI_EXP_DEVSTA). Every PCIe device has this register, regardless of whether it supports AER.
Since its not related to AER, can we move it out of AER driver ? May be to pci.c ?
Quoted 71 lines
Rename
pci_aer_clear_device_status()topcie_clear_device_status()to make clear that it is PCIe-specific but not AER-specific. No functional change intended.Signed-off-by Bjorn Helgaas <[email protected]>--- drivers/pci/pci.h | 4 ++-- drivers/pci/pcie/aer.c | 4 ++-- drivers/pci/pcie/err.c | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-)drivers/pci/pci.h +2
-2@@ -657,16 +657,16 @@ void pci_no_aer(void);void pci_aer_init (struct pci_dev *dev);void pci_aer_exit (struct pci_dev *dev);extern const struct attribute_group aer_stats_attr_group; +void pcie_clear_device_status (struct pci_dev *dev);void pci_aer_clear_fatal_status (struct pci_dev *dev); -void pci_aer_clear_device_status (struct pci_dev *dev);int pci_aer_clear_status (struct pci_dev *dev);int pci_aer_raw_clear_status (struct pci_dev *dev);#else static inline void pci_no_aer (void ) { }static inline void pci_aer_init (struct pci_dev *d) { }static inline void pci_aer_exit (struct pci_dev *d) { } +static inline void pcie_clear_device_status (struct pci_dev *dev) { }static inline void pci_aer_clear_fatal_status (struct pci_dev *dev) { } -static inline void pci_aer_clear_device_status (struct pci_dev *dev) { }static inline int pci_aer_clear_status (struct pci_dev *dev) {return -EINVAL ; }static inline int pci_aer_raw_clear_status (struct pci_dev *dev) {return -EINVAL ; }#endif drivers/pci/pcie/aer.c +2
-2@@ -241,7 +241,7 @@ int pci_disable_pcie_error_reporting(struct pci_dev *dev) }EXPORT_SYMBOL_GPL (pci_disable_pcie_error_reporting); -void pci_aer_clear_device_status (struct pci_dev *dev) +void pcie_clear_device_status (struct pci_dev *dev) {u16 sta;@@ -947,7 +947,7 @@ static void handle_error_source(struct pci_dev *dev, struct aer_err_info *info)if (aer)pci_write_config_dword (dev, aer +PCI_ERR_COR_STATUS , info->status); -pci_aer_clear_device_status (dev); +pcie_clear_device_status (dev); }else if (info->severity ==AER_NONFATAL )pcie_do_recovery (dev, pci_channel_io_normal, aer_root_reset);else if (info->severity ==AER_FATAL )drivers/pci/pcie/err.c +1
-1@@ -197,7 +197,7 @@ pci_ers_result_t pcie_do_recovery(struct pci_dev *dev,pci_dbg (dev,"broadcast resume message\n" );pci_walk_bus (bus, report_resume, &status); -pci_aer_clear_device_status (dev); +pcie_clear_device_status (dev);pci_aer_clear_nonfatal_status (dev);pci_info (dev,"device recovery successful\n" );return status;
Signature · 2 lines
Sathyanarayanan Kuppuswamy Linux Kernel Developer
Quoted 11 lines · Sathyanarayanan
Hi Bjorn,
Quoted 5 lines · Bjorn Helgaas
From: Bjorn Helgaas <[email protected]>
pci_aer_clear_device_status()clears the error bits in the PCIe Device Status Register (PCI_EXP_DEVSTA). Every PCIe device has this register, regardless of whether it supports AER.Since its not related to AER, can we move it out of AER driver ? May be to
pci.c?
OK. pci.c is really a grab bag of random stuff, but it *is* true that this doesn't really seem to belong in aer.c.
So I don't mind moving it to pci.c (does just before pcie_clear_root_pme_status() seem like a reasonable spot?)
But looking at this again makes me wonder whether putting the pcie_aer_is_native() test inside pcie_clear_device_status() is the right thing. It seems like that test fits better with the AER code, i.e., in the *callers* of pcie_clear_device_status().
It would mean repeating the test, since we call it twice, but it seems like it might match up with the spec better. And I have a slight aversion to functions that can silently return without doing what it looks like they're supposed to do.
I can fix this all up if that seems right. Or let me know if you have alternate ideas.
Bjorn
Quoted 16 lines · Bjorn Helgaas
Quoted 11 lines · Sathyanarayanan
Hi Bjorn,
Quoted 5 lines · Bjorn Helgaas
From: Bjorn Helgaas <[email protected]>
pci_aer_clear_device_status()clears the error bits in the PCIe Device Status Register (PCI_EXP_DEVSTA). Every PCIe device has this register, regardless of whether it supports AER.Since its not related to AER, can we move it out of AER driver ? May be to
pci.c?OK.
pci.cis really a grab bag of random stuff, but it *is* true that this doesn't really seem to belong inaer.c.
Quoted 7 lines
So I don't mind moving it to
pci.c(does just beforepcie_clear_root_pme_status()seem like a reasonable spot?)But looking at this again makes me wonder whether putting the
pcie_aer_is_native()test insidepcie_clear_device_status()is the right thing. It seems like that test fits better with the AER code, i.e., in the *callers* ofpcie_clear_device_status().
Yes. pcie_aer_is_native() should be left in AER driver.
Quoted 8 lines
It would mean repeating the test, since we call it twice, but it seems like it might match up with the spec better. And I have a slight aversion to functions that can silently return without doing what it looks like they're supposed to do.
I can fix this all up if that seems right. Or let me know if you have alternate ideas.
Agree with your approach. Its ok to add separate check for pcie_aer_is_native().
Quoted 3 lines
Bjorn
Signature · 2 lines
Sathyanarayanan Kuppuswamy Linux Kernel Developer