Commit 2b4f4cb9 authored by Frederick Lawler's avatar Frederick Lawler Committed by Martin K. Petersen

scsi: esas2r: Prefer pcie_capability_read_word()

Commit 8c0d3a02 ("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: default avatarFrederick Lawler <fred@fredlawl.com>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent 3e76ca95
...@@ -762,14 +762,10 @@ u32 esas2r_get_uncached_size(struct esas2r_adapter *a) ...@@ -762,14 +762,10 @@ u32 esas2r_get_uncached_size(struct esas2r_adapter *a)
static void esas2r_init_pci_cfg_space(struct esas2r_adapter *a) static void esas2r_init_pci_cfg_space(struct esas2r_adapter *a)
{ {
int pcie_cap_reg; if (pci_is_pcie(a->pcid)) {
pcie_cap_reg = pci_find_capability(a->pcid, PCI_CAP_ID_EXP);
if (pcie_cap_reg) {
u16 devcontrol; u16 devcontrol;
pci_read_config_word(a->pcid, pcie_cap_reg + PCI_EXP_DEVCTL, pcie_capability_read_word(a->pcid, PCI_EXP_DEVCTL, &devcontrol);
&devcontrol);
if ((devcontrol & PCI_EXP_DEVCTL_READRQ) > if ((devcontrol & PCI_EXP_DEVCTL_READRQ) >
PCI_EXP_DEVCTL_READRQ_512B) { PCI_EXP_DEVCTL_READRQ_512B) {
...@@ -778,9 +774,8 @@ static void esas2r_init_pci_cfg_space(struct esas2r_adapter *a) ...@@ -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;
devcontrol |= PCI_EXP_DEVCTL_READRQ_512B; devcontrol |= PCI_EXP_DEVCTL_READRQ_512B;
pci_write_config_word(a->pcid, pcie_capability_write_word(a->pcid, PCI_EXP_DEVCTL,
pcie_cap_reg + PCI_EXP_DEVCTL, devcontrol);
devcontrol);
} }
} }
} }
......
...@@ -757,7 +757,6 @@ static int hba_ioctl_callback(struct esas2r_adapter *a, ...@@ -757,7 +757,6 @@ static int hba_ioctl_callback(struct esas2r_adapter *a,
struct atto_hba_get_adapter_info *gai = struct atto_hba_get_adapter_info *gai =
&hi->data.get_adap_info; &hi->data.get_adap_info;
int pcie_cap_reg;
if (hi->flags & HBAF_TUNNEL) { if (hi->flags & HBAF_TUNNEL) {
hi->status = ATTO_STS_UNSUPPORTED; hi->status = ATTO_STS_UNSUPPORTED;
...@@ -784,17 +783,14 @@ static int hba_ioctl_callback(struct esas2r_adapter *a, ...@@ -784,17 +783,14 @@ static int hba_ioctl_callback(struct esas2r_adapter *a,
gai->pci.dev_num = PCI_SLOT(a->pcid->devfn); gai->pci.dev_num = PCI_SLOT(a->pcid->devfn);
gai->pci.func_num = PCI_FUNC(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 (pci_is_pcie(a->pcid)) {
if (pcie_cap_reg) {
u16 stat; u16 stat;
u32 caps; u32 caps;
pci_read_config_word(a->pcid, pcie_capability_read_word(a->pcid, PCI_EXP_LNKSTA,
pcie_cap_reg + PCI_EXP_LNKSTA, &stat);
&stat); pcie_capability_read_dword(a->pcid, PCI_EXP_LNKCAP,
pci_read_config_dword(a->pcid, &caps);
pcie_cap_reg + PCI_EXP_LNKCAP,
&caps);
gai->pci.link_speed_curr = gai->pci.link_speed_curr =
(u8)(stat & PCI_EXP_LNKSTA_CLS); (u8)(stat & PCI_EXP_LNKSTA_CLS);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment