diff options
author | Alex Williamson <alex.williamson@redhat.com> | 2012-06-11 01:27:33 -0400 |
---|---|---|
committer | Bjorn Helgaas <bhelgaas@google.com> | 2012-06-12 11:21:42 -0400 |
commit | a6961651408afa9387d6df43c4a1dc4fd35dcb1b (patch) | |
tree | 3ee93b9316123567ebfc65804cb8cc1be95be1e2 /include/linux/pci.h | |
parent | c63587d7f5b9db84e71daf5962dc0394eb657da2 (diff) |
PCI: create common pcibios_err_to_errno
For returning errors out to non-PCI code. Re-name xen's version.
Acked-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Diffstat (limited to 'include/linux/pci.h')
-rw-r--r-- | include/linux/pci.h | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/include/linux/pci.h b/include/linux/pci.h index 9d04599c6bd9..a691f62bcf89 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h | |||
@@ -474,6 +474,32 @@ static inline bool pci_dev_msi_enabled(struct pci_dev *pci_dev) { return false; | |||
474 | #define PCIBIOS_SET_FAILED 0x88 | 474 | #define PCIBIOS_SET_FAILED 0x88 |
475 | #define PCIBIOS_BUFFER_TOO_SMALL 0x89 | 475 | #define PCIBIOS_BUFFER_TOO_SMALL 0x89 |
476 | 476 | ||
477 | /* | ||
478 | * Translate above to generic errno for passing back through non-pci. | ||
479 | */ | ||
480 | static inline int pcibios_err_to_errno(int err) | ||
481 | { | ||
482 | if (err <= PCIBIOS_SUCCESSFUL) | ||
483 | return err; /* Assume already errno */ | ||
484 | |||
485 | switch (err) { | ||
486 | case PCIBIOS_FUNC_NOT_SUPPORTED: | ||
487 | return -ENOENT; | ||
488 | case PCIBIOS_BAD_VENDOR_ID: | ||
489 | return -EINVAL; | ||
490 | case PCIBIOS_DEVICE_NOT_FOUND: | ||
491 | return -ENODEV; | ||
492 | case PCIBIOS_BAD_REGISTER_NUMBER: | ||
493 | return -EFAULT; | ||
494 | case PCIBIOS_SET_FAILED: | ||
495 | return -EIO; | ||
496 | case PCIBIOS_BUFFER_TOO_SMALL: | ||
497 | return -ENOSPC; | ||
498 | } | ||
499 | |||
500 | return -ENOTTY; | ||
501 | } | ||
502 | |||
477 | /* Low-level architecture-dependent routines */ | 503 | /* Low-level architecture-dependent routines */ |
478 | 504 | ||
479 | struct pci_ops { | 505 | struct pci_ops { |