Message ID | 20200609153950.8346-9-refactormyself@gmail.com (mailing list archive) |
---|---|
State | Superseded, archived |
Headers | show |
Series | PCI: Align return value of pcie capability accessors with other accessors | expand |
On Tue, Jun 09, 2020 at 05:39:50PM +0200, refactormyself@gmail.com wrote: > From: Bolarinwa Olayemi Saheed <refactormyself@gmail.com> > > The pcie capability accessors can return 0, -EINVAL, or any PCIBIOS_ error > code. PCIBIOS_ error codes have positive values. The pci accessor on the > other hand can only return 0 or any PCIBIOS_ error code.This inconsistency > among these accessor makes it harder for callers to check for errors. s/pcie/PCIe/ (also below) s/pci/PCI/ s/code.This/code. This/ > Return PCIBIOS_BAD_REGISTER_NUMBER instead of -EINVAL in all pcie > capability accessors. > > Signed-off-by: Bolarinwa Olayemi Saheed <refactormyself@gmail.com> > Suggested-by: Bjorn Helgaas <bjorn@helgaas.com> > --- > drivers/pci/access.c | 8 ++++---- > 1 file changed, 4 insertions(+), 4 deletions(-) > > diff --git a/drivers/pci/access.c b/drivers/pci/access.c > index 79c4a2ef269a..cbb3804903a0 100644 > --- a/drivers/pci/access.c > +++ b/drivers/pci/access.c > @@ -409,7 +409,7 @@ int pcie_capability_read_word(struct pci_dev *dev, int pos, u16 *val) > > *val = 0; > if (pos & 1) > - return -EINVAL; > + return PCIBIOS_BAD_REGISTER_NUMBER; > > if (pcie_capability_reg_implemented(dev, pos)) { > ret = pci_read_config_word(dev, pci_pcie_cap(dev) + pos, val); > @@ -444,7 +444,7 @@ int pcie_capability_read_dword(struct pci_dev *dev, int pos, u32 *val) > > *val = 0; > if (pos & 3) > - return -EINVAL; > + return PCIBIOS_BAD_REGISTER_NUMBER; > > if (pcie_capability_reg_implemented(dev, pos)) { > ret = pci_read_config_dword(dev, pci_pcie_cap(dev) + pos, val); > @@ -469,7 +469,7 @@ EXPORT_SYMBOL(pcie_capability_read_dword); > int pcie_capability_write_word(struct pci_dev *dev, int pos, u16 val) > { > if (pos & 1) > - return -EINVAL; > + return PCIBIOS_BAD_REGISTER_NUMBER; > > if (!pcie_capability_reg_implemented(dev, pos)) > return 0; > @@ -481,7 +481,7 @@ EXPORT_SYMBOL(pcie_capability_write_word); > int pcie_capability_write_dword(struct pci_dev *dev, int pos, u32 val) > { > if (pos & 3) > - return -EINVAL; > + return PCIBIOS_BAD_REGISTER_NUMBER; > > if (!pcie_capability_reg_implemented(dev, pos)) > return 0; > -- > 2.18.2 >
diff --git a/drivers/pci/access.c b/drivers/pci/access.c index 79c4a2ef269a..cbb3804903a0 100644 --- a/drivers/pci/access.c +++ b/drivers/pci/access.c @@ -409,7 +409,7 @@ int pcie_capability_read_word(struct pci_dev *dev, int pos, u16 *val) *val = 0; if (pos & 1) - return -EINVAL; + return PCIBIOS_BAD_REGISTER_NUMBER; if (pcie_capability_reg_implemented(dev, pos)) { ret = pci_read_config_word(dev, pci_pcie_cap(dev) + pos, val); @@ -444,7 +444,7 @@ int pcie_capability_read_dword(struct pci_dev *dev, int pos, u32 *val) *val = 0; if (pos & 3) - return -EINVAL; + return PCIBIOS_BAD_REGISTER_NUMBER; if (pcie_capability_reg_implemented(dev, pos)) { ret = pci_read_config_dword(dev, pci_pcie_cap(dev) + pos, val); @@ -469,7 +469,7 @@ EXPORT_SYMBOL(pcie_capability_read_dword); int pcie_capability_write_word(struct pci_dev *dev, int pos, u16 val) { if (pos & 1) - return -EINVAL; + return PCIBIOS_BAD_REGISTER_NUMBER; if (!pcie_capability_reg_implemented(dev, pos)) return 0; @@ -481,7 +481,7 @@ EXPORT_SYMBOL(pcie_capability_write_word); int pcie_capability_write_dword(struct pci_dev *dev, int pos, u32 val) { if (pos & 3) - return -EINVAL; + return PCIBIOS_BAD_REGISTER_NUMBER; if (!pcie_capability_reg_implemented(dev, pos)) return 0;