aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/vfio
diff options
context:
space:
mode:
authorYijing Wang <wangyijing@huawei.com>2013-04-15 10:45:10 -0400
committerAlex Williamson <alex.williamson@redhat.com>2013-04-15 10:45:10 -0400
commitaa2cba51a0a85dfbd5be58239e59bc5e8b5fb7cf (patch)
tree78d34a8efe088c0cbec88c152f1f47c61e247247 /drivers/vfio
parenta7d1ea1c11b33bda2691f3294b4d735ed635535a (diff)
PCI/VFIO: use pcie_flags_reg instead of access PCI-E Capabilities Register
Currently, we use pcie_flags_reg to cache PCI-E Capabilities Register, because PCI-E Capabilities Register bits are almost read-only. This patch use pcie_caps_reg() instead of another access PCI-E Capabilities Register. Signed-off-by: Yijing Wang <wangyijing@huawei.com> Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Diffstat (limited to 'drivers/vfio')
-rw-r--r--drivers/vfio/pci/vfio_pci_config.c6
1 files changed, 1 insertions, 5 deletions
diff --git a/drivers/vfio/pci/vfio_pci_config.c b/drivers/vfio/pci/vfio_pci_config.c
index 072fdacb6f96..0e83e8ead142 100644
--- a/drivers/vfio/pci/vfio_pci_config.c
+++ b/drivers/vfio/pci/vfio_pci_config.c
@@ -1037,13 +1037,9 @@ static int vfio_cap_len(struct vfio_pci_device *vdev, u8 cap, u8 pos)
1037 return byte; 1037 return byte;
1038 case PCI_CAP_ID_EXP: 1038 case PCI_CAP_ID_EXP:
1039 /* length based on version */ 1039 /* length based on version */
1040 ret = pci_read_config_word(pdev, pos + PCI_EXP_FLAGS, &word);
1041 if (ret)
1042 return pcibios_err_to_errno(ret);
1043
1044 vdev->extended_caps = true; 1040 vdev->extended_caps = true;
1045 1041
1046 if ((word & PCI_EXP_FLAGS_VERS) == 1) 1042 if ((pcie_caps_reg(pdev) & PCI_EXP_FLAGS_VERS) == 1)
1047 return PCI_CAP_EXP_ENDPOINT_SIZEOF_V1; 1043 return PCI_CAP_EXP_ENDPOINT_SIZEOF_V1;
1048 else 1044 else
1049 return PCI_CAP_EXP_ENDPOINT_SIZEOF_V2; 1045 return PCI_CAP_EXP_ENDPOINT_SIZEOF_V2;