diff options
author | Alexander Gordeev <agordeev@redhat.com> | 2014-09-23 14:45:58 -0400 |
---|---|---|
committer | Bjorn Helgaas <bhelgaas@google.com> | 2014-10-01 14:21:14 -0400 |
commit | a06cd74cefe754341f747ddc4cf7b0058fa9bff8 (patch) | |
tree | ccac2544277779a5515d93a81350b97164a8cba4 /drivers/pci/msi.c | |
parent | 27e20603c54ba633ed259284d006275f13c9f95b (diff) |
PCI/MSI: Rename pci_msi_check_device() to pci_msi_supported()
Rename pci_msi_check_device() to pci_msi_supported() for clarity. Note
that pci_msi_supported() returns true if MSI/MSI-X is supported, so code
like:
if (pci_msi_supported(...))
reads naturally.
[bhelgaas: changelog, split to separate patch, reverse sense]
Signed-off-by: Alexander Gordeev <agordeev@redhat.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Diffstat (limited to 'drivers/pci/msi.c')
-rw-r--r-- | drivers/pci/msi.c | 27 |
1 files changed, 12 insertions, 15 deletions
diff --git a/drivers/pci/msi.c b/drivers/pci/msi.c index 338b027ea65f..5f1e5dc994cf 100644 --- a/drivers/pci/msi.c +++ b/drivers/pci/msi.c | |||
@@ -796,25 +796,24 @@ out_free: | |||
796 | } | 796 | } |
797 | 797 | ||
798 | /** | 798 | /** |
799 | * pci_msi_check_device - check whether MSI may be enabled on a device | 799 | * pci_msi_supported - check whether MSI may be enabled on a device |
800 | * @dev: pointer to the pci_dev data structure of MSI device function | 800 | * @dev: pointer to the pci_dev data structure of MSI device function |
801 | * @nvec: how many MSIs have been requested ? | 801 | * @nvec: how many MSIs have been requested ? |
802 | * @type: are we checking for MSI or MSI-X ? | ||
803 | * | 802 | * |
804 | * Look at global flags, the device itself, and its parent buses | 803 | * Look at global flags, the device itself, and its parent buses |
805 | * to determine if MSI/-X are supported for the device. If MSI/-X is | 804 | * to determine if MSI/-X are supported for the device. If MSI/-X is |
806 | * supported return 0, else return an error code. | 805 | * supported return 1, else return 0. |
807 | **/ | 806 | **/ |
808 | static int pci_msi_check_device(struct pci_dev *dev, int nvec) | 807 | static int pci_msi_supported(struct pci_dev *dev, int nvec) |
809 | { | 808 | { |
810 | struct pci_bus *bus; | 809 | struct pci_bus *bus; |
811 | 810 | ||
812 | /* MSI must be globally enabled and supported by the device */ | 811 | /* MSI must be globally enabled and supported by the device */ |
813 | if (!pci_msi_enable) | 812 | if (!pci_msi_enable) |
814 | return -EINVAL; | 813 | return 0; |
815 | 814 | ||
816 | if (!dev || dev->no_msi || dev->current_state != PCI_D0) | 815 | if (!dev || dev->no_msi || dev->current_state != PCI_D0) |
817 | return -EINVAL; | 816 | return 0; |
818 | 817 | ||
819 | /* | 818 | /* |
820 | * You can't ask to have 0 or less MSIs configured. | 819 | * You can't ask to have 0 or less MSIs configured. |
@@ -822,7 +821,7 @@ static int pci_msi_check_device(struct pci_dev *dev, int nvec) | |||
822 | * b) the list manipulation code assumes nvec >= 1. | 821 | * b) the list manipulation code assumes nvec >= 1. |
823 | */ | 822 | */ |
824 | if (nvec < 1) | 823 | if (nvec < 1) |
825 | return -ERANGE; | 824 | return 0; |
826 | 825 | ||
827 | /* | 826 | /* |
828 | * Any bridge which does NOT route MSI transactions from its | 827 | * Any bridge which does NOT route MSI transactions from its |
@@ -833,9 +832,9 @@ static int pci_msi_check_device(struct pci_dev *dev, int nvec) | |||
833 | */ | 832 | */ |
834 | for (bus = dev->bus; bus; bus = bus->parent) | 833 | for (bus = dev->bus; bus; bus = bus->parent) |
835 | if (bus->bus_flags & PCI_BUS_FLAGS_NO_MSI) | 834 | if (bus->bus_flags & PCI_BUS_FLAGS_NO_MSI) |
836 | return -EINVAL; | 835 | return 0; |
837 | 836 | ||
838 | return 0; | 837 | return 1; |
839 | } | 838 | } |
840 | 839 | ||
841 | /** | 840 | /** |
@@ -937,9 +936,8 @@ int pci_enable_msix(struct pci_dev *dev, struct msix_entry *entries, int nvec) | |||
937 | int status, nr_entries; | 936 | int status, nr_entries; |
938 | int i, j; | 937 | int i, j; |
939 | 938 | ||
940 | status = pci_msi_check_device(dev, nvec); | 939 | if (!pci_msi_supported(dev, nvec)) |
941 | if (status) | 940 | return -EINVAL; |
942 | return status; | ||
943 | 941 | ||
944 | if (!entries) | 942 | if (!entries) |
945 | return -EINVAL; | 943 | return -EINVAL; |
@@ -1050,9 +1048,8 @@ int pci_enable_msi_range(struct pci_dev *dev, int minvec, int maxvec) | |||
1050 | int nvec; | 1048 | int nvec; |
1051 | int rc; | 1049 | int rc; |
1052 | 1050 | ||
1053 | rc = pci_msi_check_device(dev, minvec); | 1051 | if (!pci_msi_supported(dev, minvec)) |
1054 | if (rc) | 1052 | return -EINVAL; |
1055 | return rc; | ||
1056 | 1053 | ||
1057 | WARN_ON(!!dev->msi_enabled); | 1054 | WARN_ON(!!dev->msi_enabled); |
1058 | 1055 | ||