|
@@ -893,12 +893,20 @@ EXPORT_SYMBOL(pcie_capability_clear_and_set_dword);
|
|
|
|
|
|
int pci_read_config_byte(const struct pci_dev *dev, int where, u8 *val)
|
|
|
{
|
|
|
+ if (pci_dev_is_disconnected(dev)) {
|
|
|
+ *val = ~0;
|
|
|
+ return -ENODEV;
|
|
|
+ }
|
|
|
return pci_bus_read_config_byte(dev->bus, dev->devfn, where, val);
|
|
|
}
|
|
|
EXPORT_SYMBOL(pci_read_config_byte);
|
|
|
|
|
|
int pci_read_config_word(const struct pci_dev *dev, int where, u16 *val)
|
|
|
{
|
|
|
+ if (pci_dev_is_disconnected(dev)) {
|
|
|
+ *val = ~0;
|
|
|
+ return -ENODEV;
|
|
|
+ }
|
|
|
return pci_bus_read_config_word(dev->bus, dev->devfn, where, val);
|
|
|
}
|
|
|
EXPORT_SYMBOL(pci_read_config_word);
|
|
@@ -906,18 +914,26 @@ EXPORT_SYMBOL(pci_read_config_word);
|
|
|
int pci_read_config_dword(const struct pci_dev *dev, int where,
|
|
|
u32 *val)
|
|
|
{
|
|
|
+ if (pci_dev_is_disconnected(dev)) {
|
|
|
+ *val = ~0;
|
|
|
+ return -ENODEV;
|
|
|
+ }
|
|
|
return pci_bus_read_config_dword(dev->bus, dev->devfn, where, val);
|
|
|
}
|
|
|
EXPORT_SYMBOL(pci_read_config_dword);
|
|
|
|
|
|
int pci_write_config_byte(const struct pci_dev *dev, int where, u8 val)
|
|
|
{
|
|
|
+ if (pci_dev_is_disconnected(dev))
|
|
|
+ return -ENODEV;
|
|
|
return pci_bus_write_config_byte(dev->bus, dev->devfn, where, val);
|
|
|
}
|
|
|
EXPORT_SYMBOL(pci_write_config_byte);
|
|
|
|
|
|
int pci_write_config_word(const struct pci_dev *dev, int where, u16 val)
|
|
|
{
|
|
|
+ if (pci_dev_is_disconnected(dev))
|
|
|
+ return -ENODEV;
|
|
|
return pci_bus_write_config_word(dev->bus, dev->devfn, where, val);
|
|
|
}
|
|
|
EXPORT_SYMBOL(pci_write_config_word);
|
|
@@ -925,6 +941,8 @@ EXPORT_SYMBOL(pci_write_config_word);
|
|
|
int pci_write_config_dword(const struct pci_dev *dev, int where,
|
|
|
u32 val)
|
|
|
{
|
|
|
+ if (pci_dev_is_disconnected(dev))
|
|
|
+ return -ENODEV;
|
|
|
return pci_bus_write_config_dword(dev->bus, dev->devfn, where, val);
|
|
|
}
|
|
|
EXPORT_SYMBOL(pci_write_config_dword);
|