Few drivers have own definitions for this constant, so move it to the
PCI core. In addition there are several places where the following
code sequence is used:
1. Read PCI_STATUS
2. Mask out non-error bits
3. Action based on set error bits
4. Write back set error bits to clear them
As this is a repeated pattern, add a helper to the PCI core.
Most affected drivers are network drivers. But as it's about core
PCI functionality, I suppose the series should go through the PCI
tree.
Heiner Kallweit (8):
PCI: add constant PCI_STATUS_ERROR_BITS
PCI: add pci_status_get_and_clear_errors
r8169: use pci_status_get_and_clear_errors
net: cassini: use pci_status_get_and_clear_errors
net: sungem: use pci_status_get_and_clear_errors
net: skfp: use PCI_STATUS_ERROR_BITS
PCI: pci-bridge-emul: use PCI_STATUS_ERROR_BITS
sound: bt87x: use pci_status_get_and_clear_errors
drivers/net/ethernet/marvell/skge.h | 6 -----
drivers/net/ethernet/marvell/sky2.h | 6 -----
drivers/net/ethernet/realtek/r8169_main.c | 15 +++++-------
drivers/net/ethernet/sun/cassini.c | 28 ++++++++-------------
drivers/net/ethernet/sun/sungem.c | 30 +++++++----------------
drivers/net/fddi/skfp/drvfbi.c | 2 +-
drivers/net/fddi/skfp/h/skfbi.h | 5 ----
drivers/pci/pci-bridge-emul.c | 14 ++---------
drivers/pci/pci.c | 23 +++++++++++++++++
include/linux/pci.h | 1 +
include/uapi/linux/pci_regs.h | 7 ++++++
sound/pci/bt87x.c | 7 +-----
12 files changed, 60 insertions(+), 84 deletions(-)
--
2.25.1
This constant is used (with different names) in more than one driver,
so move it to the PCI core.
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
---
drivers/net/ethernet/marvell/skge.h | 6 ------
drivers/net/ethernet/marvell/sky2.h | 6 ------
include/uapi/linux/pci_regs.h | 7 +++++++
3 files changed, 7 insertions(+), 12 deletions(-)
@@ -545,37 +545,25 @@ static int gem_pci_interrupt(struct net_device *dev, struct gem *gp, u32 gem_sta}if(pci_estat&GREG_PCIESTAT_OTHER){-u16pci_cfg_stat;+intpci_errs;/* Interrogate PCI config space for the*truecause.*/-pci_read_config_word(gp->pdev,PCI_STATUS,-&pci_cfg_stat);-netdev_err(dev,"Read PCI cfg space status [%04x]\n",-pci_cfg_stat);-if(pci_cfg_stat&PCI_STATUS_PARITY)+pci_errs=pci_status_get_and_clear_errors(gp->pdev);+netdev_err(dev,"PCI status errors[%04x]\n",pci_errs);+if(pci_errs&PCI_STATUS_PARITY)netdev_err(dev,"PCI parity error detected\n");-if(pci_cfg_stat&PCI_STATUS_SIG_TARGET_ABORT)+if(pci_errs&PCI_STATUS_SIG_TARGET_ABORT)netdev_err(dev,"PCI target abort\n");-if(pci_cfg_stat&PCI_STATUS_REC_TARGET_ABORT)+if(pci_errs&PCI_STATUS_REC_TARGET_ABORT)netdev_err(dev,"PCI master acks target abort\n");-if(pci_cfg_stat&PCI_STATUS_REC_MASTER_ABORT)+if(pci_errs&PCI_STATUS_REC_MASTER_ABORT)netdev_err(dev,"PCI master abort\n");-if(pci_cfg_stat&PCI_STATUS_SIG_SYSTEM_ERROR)+if(pci_errs&PCI_STATUS_SIG_SYSTEM_ERROR)netdev_err(dev,"PCI system error SERR#\n");-if(pci_cfg_stat&PCI_STATUS_DETECTED_PARITY)+if(pci_errs&PCI_STATUS_DETECTED_PARITY)netdev_err(dev,"PCI parity error\n");--/* Write the error bits back to clear them. */-pci_cfg_stat&=(PCI_STATUS_PARITY|-PCI_STATUS_SIG_TARGET_ABORT|-PCI_STATUS_REC_TARGET_ABORT|-PCI_STATUS_REC_MASTER_ABORT|-PCI_STATUS_SIG_SYSTEM_ERROR|-PCI_STATUS_DETECTED_PARITY);-pci_write_config_word(gp->pdev,-PCI_STATUS,pci_cfg_stat);}/* For all PCI errors, we should reset the chip. */
Few drivers use the following code sequence:
1. Read PCI_STATUS
2. Mask out non-error bits
3. Action based on error bits set
4. Write back set error bits to clear them
As this is a repeated pattern, add a helper to the PCI core.
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
---
drivers/pci/pci.c | 23 +++++++++++++++++++++++
include/linux/pci.h | 1 +
2 files changed, 24 insertions(+)
@@ -1716,34 +1716,26 @@ static int cas_pci_interrupt(struct net_device *dev, struct cas *cp,pr_cont("\n");if(stat&PCI_ERR_OTHER){-u16cfg;+intpci_errs;/* Interrogate PCI config space for the*truecause.*/-pci_read_config_word(cp->pdev,PCI_STATUS,&cfg);-netdev_err(dev,"Read PCI cfg space status [%04x]\n",cfg);-if(cfg&PCI_STATUS_PARITY)+pci_errs=pci_status_get_and_clear_errors(cp->pdev);++netdev_err(dev,"PCI status errors[%04x]\n",pci_errs);+if(pci_errs&PCI_STATUS_PARITY)netdev_err(dev,"PCI parity error detected\n");-if(cfg&PCI_STATUS_SIG_TARGET_ABORT)+if(pci_errs&PCI_STATUS_SIG_TARGET_ABORT)netdev_err(dev,"PCI target abort\n");-if(cfg&PCI_STATUS_REC_TARGET_ABORT)+if(pci_errs&PCI_STATUS_REC_TARGET_ABORT)netdev_err(dev,"PCI master acks target abort\n");-if(cfg&PCI_STATUS_REC_MASTER_ABORT)+if(pci_errs&PCI_STATUS_REC_MASTER_ABORT)netdev_err(dev,"PCI master abort\n");-if(cfg&PCI_STATUS_SIG_SYSTEM_ERROR)+if(pci_errs&PCI_STATUS_SIG_SYSTEM_ERROR)netdev_err(dev,"PCI system error SERR#\n");-if(cfg&PCI_STATUS_DETECTED_PARITY)+if(pci_errs&PCI_STATUS_DETECTED_PARITY)netdev_err(dev,"PCI parity error\n");--/* Write the error bits back to clear them. */-cfg&=(PCI_STATUS_PARITY|-PCI_STATUS_SIG_TARGET_ABORT|-PCI_STATUS_REC_TARGET_ABORT|-PCI_STATUS_REC_MASTER_ABORT|-PCI_STATUS_SIG_SYSTEM_ERROR|-PCI_STATUS_DETECTED_PARITY);-pci_write_config_word(cp->pdev,PCI_STATUS,cfg);}/* For all PCI errors, we should reset the chip. */
Few drivers have own definitions for this constant, so move it to the
PCI core. In addition there are several places where the following
code sequence is used:
1. Read PCI_STATUS
2. Mask out non-error bits
3. Action based on set error bits
4. Write back set error bits to clear them
As this is a repeated pattern, add a helper to the PCI core.
Most affected drivers are network drivers. But as it's about core
PCI functionality, I suppose the series should go through the PCI
tree.
Heiner, something is up with this submission.
The subject line here says 0/9, but the patches say N/8 and patch #8 never
showed up on the list.
Sort out what this should be and resubmit, thank you.
Few drivers have own definitions for this constant, so move it to the
PCI core. In addition there are several places where the following
code sequence is used:
1. Read PCI_STATUS
2. Mask out non-error bits
3. Action based on set error bits
4. Write back set error bits to clear them
As this is a repeated pattern, add a helper to the PCI core.
Most affected drivers are network drivers. But as it's about core
PCI functionality, I suppose the series should go through the PCI
tree.
Heiner, something is up with this submission.
The subject line here says 0/9, but the patches say N/8 and patch #8 never
showed up on the list.
Sort out what this should be and resubmit, thank you.