summaryrefslogtreecommitdiff
path: root/drivers/scsi/esas2r
diff options
context:
space:
mode:
authorFrederick Lawler <fred@fredlawl.com>2019-07-17 21:07:44 -0500
committerMartin K. Petersen <martin.petersen@oracle.com>2019-08-12 22:04:06 -0400
commit2b4f4cb93ae32f40dc232f8699b125541f494b3d (patch)
tree3b3bb8612b54efc28832d26eab721509e1b77260 /drivers/scsi/esas2r
parent3e76ca9561ce6bd245793edebd36e718bff89d3e (diff)
scsi: esas2r: Prefer pcie_capability_read_word()
Commit 8c0d3a02c130 ("PCI: Add accessors for PCI Express Capability") added accessors for the PCI Express Capability so that drivers didn't need to be aware of differences between v1 and v2 of the PCI Express Capability. Replace pci_read_config_word() and pci_write_config_word() calls with pcie_capability_read_word() and pcie_capability_write_word(). Signed-off-by: Frederick Lawler <fred@fredlawl.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Diffstat (limited to 'drivers/scsi/esas2r')
-rw-r--r--drivers/scsi/esas2r/esas2r_init.c13
-rw-r--r--drivers/scsi/esas2r/esas2r_ioctl.c14
2 files changed, 9 insertions, 18 deletions
diff --git a/drivers/scsi/esas2r/esas2r_init.c b/drivers/scsi/esas2r/esas2r_init.c
index 950cd92df2ff..eb7d139ffc00 100644
--- a/drivers/scsi/esas2r/esas2r_init.c
+++ b/drivers/scsi/esas2r/esas2r_init.c
@@ -762,14 +762,10 @@ u32 esas2r_get_uncached_size(struct esas2r_adapter *a)
static void esas2r_init_pci_cfg_space(struct esas2r_adapter *a)
{
- int pcie_cap_reg;
-
- pcie_cap_reg = pci_find_capability(a->pcid, PCI_CAP_ID_EXP);
- if (pcie_cap_reg) {
+ if (pci_is_pcie(a->pcid)) {
u16 devcontrol;
- pci_read_config_word(a->pcid, pcie_cap_reg + PCI_EXP_DEVCTL,
- &devcontrol);
+ pcie_capability_read_word(a->pcid, PCI_EXP_DEVCTL, &devcontrol);
if ((devcontrol & PCI_EXP_DEVCTL_READRQ) >
PCI_EXP_DEVCTL_READRQ_512B) {
@@ -778,9 +774,8 @@ static void esas2r_init_pci_cfg_space(struct esas2r_adapter *a)
devcontrol &= ~PCI_EXP_DEVCTL_READRQ;
devcontrol |= PCI_EXP_DEVCTL_READRQ_512B;
- pci_write_config_word(a->pcid,
- pcie_cap_reg + PCI_EXP_DEVCTL,
- devcontrol);
+ pcie_capability_write_word(a->pcid, PCI_EXP_DEVCTL,
+ devcontrol);
}
}
}
diff --git a/drivers/scsi/esas2r/esas2r_ioctl.c b/drivers/scsi/esas2r/esas2r_ioctl.c
index 3d130523c288..442c5e70a7b4 100644
--- a/drivers/scsi/esas2r/esas2r_ioctl.c
+++ b/drivers/scsi/esas2r/esas2r_ioctl.c
@@ -757,7 +757,6 @@ static int hba_ioctl_callback(struct esas2r_adapter *a,
struct atto_hba_get_adapter_info *gai =
&hi->data.get_adap_info;
- int pcie_cap_reg;
if (hi->flags & HBAF_TUNNEL) {
hi->status = ATTO_STS_UNSUPPORTED;
@@ -784,17 +783,14 @@ static int hba_ioctl_callback(struct esas2r_adapter *a,
gai->pci.dev_num = PCI_SLOT(a->pcid->devfn);
gai->pci.func_num = PCI_FUNC(a->pcid->devfn);
- pcie_cap_reg = pci_find_capability(a->pcid, PCI_CAP_ID_EXP);
- if (pcie_cap_reg) {
+ if (pci_is_pcie(a->pcid)) {
u16 stat;
u32 caps;
- pci_read_config_word(a->pcid,
- pcie_cap_reg + PCI_EXP_LNKSTA,
- &stat);
- pci_read_config_dword(a->pcid,
- pcie_cap_reg + PCI_EXP_LNKCAP,
- &caps);
+ pcie_capability_read_word(a->pcid, PCI_EXP_LNKSTA,
+ &stat);
+ pcie_capability_read_dword(a->pcid, PCI_EXP_LNKCAP,
+ &caps);
gai->pci.link_speed_curr =
(u8)(stat & PCI_EXP_LNKSTA_CLS);