Commit 449e2f9e authored by Brian Norris's avatar Brian Norris Committed by Bjorn Helgaas

PCI: Make error code types consistent in pci_{read,write}_config_*

Callers normally treat the config space accessors as returning PCBIOS_*
error codes, not Linux error codes (or they don't look at them at all).  We
have pcibios_err_to_errno() in case the error code needs to be translated.

Fixes: 4b103883 ("PCI: Don't attempt config access to disconnected devices")
Signed-off-by: default avatarBrian Norris <briannorris@chromium.org>
Signed-off-by: default avatarBjorn Helgaas <bhelgaas@google.com>
Reviewed-by: default avatarKeith Busch <keith.busch@intel.com>
parent 4d071c32
...@@ -896,7 +896,7 @@ int pci_read_config_byte(const struct pci_dev *dev, int where, u8 *val) ...@@ -896,7 +896,7 @@ int pci_read_config_byte(const struct pci_dev *dev, int where, u8 *val)
{ {
if (pci_dev_is_disconnected(dev)) { if (pci_dev_is_disconnected(dev)) {
*val = ~0; *val = ~0;
return -ENODEV; return PCIBIOS_DEVICE_NOT_FOUND;
} }
return pci_bus_read_config_byte(dev->bus, dev->devfn, where, val); return pci_bus_read_config_byte(dev->bus, dev->devfn, where, val);
} }
...@@ -906,7 +906,7 @@ int pci_read_config_word(const struct pci_dev *dev, int where, u16 *val) ...@@ -906,7 +906,7 @@ int pci_read_config_word(const struct pci_dev *dev, int where, u16 *val)
{ {
if (pci_dev_is_disconnected(dev)) { if (pci_dev_is_disconnected(dev)) {
*val = ~0; *val = ~0;
return -ENODEV; return PCIBIOS_DEVICE_NOT_FOUND;
} }
return pci_bus_read_config_word(dev->bus, dev->devfn, where, val); return pci_bus_read_config_word(dev->bus, dev->devfn, where, val);
} }
...@@ -917,7 +917,7 @@ int pci_read_config_dword(const struct pci_dev *dev, int where, ...@@ -917,7 +917,7 @@ int pci_read_config_dword(const struct pci_dev *dev, int where,
{ {
if (pci_dev_is_disconnected(dev)) { if (pci_dev_is_disconnected(dev)) {
*val = ~0; *val = ~0;
return -ENODEV; return PCIBIOS_DEVICE_NOT_FOUND;
} }
return pci_bus_read_config_dword(dev->bus, dev->devfn, where, val); return pci_bus_read_config_dword(dev->bus, dev->devfn, where, val);
} }
...@@ -926,7 +926,7 @@ EXPORT_SYMBOL(pci_read_config_dword); ...@@ -926,7 +926,7 @@ EXPORT_SYMBOL(pci_read_config_dword);
int pci_write_config_byte(const struct pci_dev *dev, int where, u8 val) int pci_write_config_byte(const struct pci_dev *dev, int where, u8 val)
{ {
if (pci_dev_is_disconnected(dev)) if (pci_dev_is_disconnected(dev))
return -ENODEV; return PCIBIOS_DEVICE_NOT_FOUND;
return pci_bus_write_config_byte(dev->bus, dev->devfn, where, val); return pci_bus_write_config_byte(dev->bus, dev->devfn, where, val);
} }
EXPORT_SYMBOL(pci_write_config_byte); EXPORT_SYMBOL(pci_write_config_byte);
...@@ -934,7 +934,7 @@ EXPORT_SYMBOL(pci_write_config_byte); ...@@ -934,7 +934,7 @@ EXPORT_SYMBOL(pci_write_config_byte);
int pci_write_config_word(const struct pci_dev *dev, int where, u16 val) int pci_write_config_word(const struct pci_dev *dev, int where, u16 val)
{ {
if (pci_dev_is_disconnected(dev)) if (pci_dev_is_disconnected(dev))
return -ENODEV; return PCIBIOS_DEVICE_NOT_FOUND;
return pci_bus_write_config_word(dev->bus, dev->devfn, where, val); return pci_bus_write_config_word(dev->bus, dev->devfn, where, val);
} }
EXPORT_SYMBOL(pci_write_config_word); EXPORT_SYMBOL(pci_write_config_word);
...@@ -943,7 +943,7 @@ int pci_write_config_dword(const struct pci_dev *dev, int where, ...@@ -943,7 +943,7 @@ int pci_write_config_dword(const struct pci_dev *dev, int where,
u32 val) u32 val)
{ {
if (pci_dev_is_disconnected(dev)) if (pci_dev_is_disconnected(dev))
return -ENODEV; return PCIBIOS_DEVICE_NOT_FOUND;
return pci_bus_write_config_dword(dev->bus, dev->devfn, where, val); return pci_bus_write_config_dword(dev->bus, dev->devfn, where, val);
} }
EXPORT_SYMBOL(pci_write_config_dword); EXPORT_SYMBOL(pci_write_config_dword);
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment