}
 EXPORT_SYMBOL_GPL(pci_bus_max_busnr);
 
+/**
+ * pci_status_get_and_clear_errors - return and clear error bits in PCI_STATUS
+ * @pdev: the PCI device
+ *
+ * Returns error bits set in PCI_STATUS and clears them.
+ */
+int pci_status_get_and_clear_errors(struct pci_dev *pdev)
+{
+       u16 status;
+       int ret;
+
+       ret = pci_read_config_word(pdev, PCI_STATUS, &status);
+       if (ret != PCIBIOS_SUCCESSFUL)
+               return -EIO;
+
+       status &= PCI_STATUS_ERROR_BITS;
+       if (status)
+               pci_write_config_word(pdev, PCI_STATUS, status);
+
+       return status;
+}
+EXPORT_SYMBOL_GPL(pci_status_get_and_clear_errors);
+
 #ifdef CONFIG_HAS_IOMEM
 void __iomem *pci_ioremap_bar(struct pci_dev *pdev, int bar)
 {
 
 bool pci_device_is_present(struct pci_dev *pdev);
 void pci_ignore_hotplug(struct pci_dev *dev);
 struct pci_dev *pci_real_dma_dev(struct pci_dev *dev);
+int pci_status_get_and_clear_errors(struct pci_dev *pdev);
 
 int __printf(6, 7) pci_request_irq(struct pci_dev *dev, unsigned int nr,
                irq_handler_t handler, irq_handler_t thread_fn, void *dev_id,