Skip to content

Commit 2b4f4cb

Browse files
fredlawlmartinkpetersen
authored andcommitted
scsi: esas2r: Prefer pcie_capability_read_word()
Commit 8c0d3a0 ("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>
1 parent 3e76ca9 commit 2b4f4cb

2 files changed

Lines changed: 9 additions & 18 deletions

File tree

‎drivers/scsi/esas2r/esas2r_init.c‎

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -762,14 +762,10 @@ u32 esas2r_get_uncached_size(struct esas2r_adapter *a)
762762

763763
static void esas2r_init_pci_cfg_space(struct esas2r_adapter *a)
764764
{
765-
int pcie_cap_reg;
766-
767-
pcie_cap_reg = pci_find_capability(a->pcid, PCI_CAP_ID_EXP);
768-
if (pcie_cap_reg) {
765+
if (pci_is_pcie(a->pcid)) {
769766
u16 devcontrol;
770767

771-
pci_read_config_word(a->pcid, pcie_cap_reg + PCI_EXP_DEVCTL,
772-
&devcontrol);
768+
pcie_capability_read_word(a->pcid, PCI_EXP_DEVCTL, &devcontrol);
773769

774770
if ((devcontrol & PCI_EXP_DEVCTL_READRQ) >
775771
PCI_EXP_DEVCTL_READRQ_512B) {
@@ -778,9 +774,8 @@ static void esas2r_init_pci_cfg_space(struct esas2r_adapter *a)
778774

779775
devcontrol &= ~PCI_EXP_DEVCTL_READRQ;
780776
devcontrol |= PCI_EXP_DEVCTL_READRQ_512B;
781-
pci_write_config_word(a->pcid,
782-
pcie_cap_reg + PCI_EXP_DEVCTL,
783-
devcontrol);
777+
pcie_capability_write_word(a->pcid, PCI_EXP_DEVCTL,
778+
devcontrol);
784779
}
785780
}
786781
}

‎drivers/scsi/esas2r/esas2r_ioctl.c‎

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -757,7 +757,6 @@ static int hba_ioctl_callback(struct esas2r_adapter *a,
757757

758758
struct atto_hba_get_adapter_info *gai =
759759
&hi->data.get_adap_info;
760-
int pcie_cap_reg;
761760

762761
if (hi->flags & HBAF_TUNNEL) {
763762
hi->status = ATTO_STS_UNSUPPORTED;
@@ -784,17 +783,14 @@ static int hba_ioctl_callback(struct esas2r_adapter *a,
784783
gai->pci.dev_num = PCI_SLOT(a->pcid->devfn);
785784
gai->pci.func_num = PCI_FUNC(a->pcid->devfn);
786785

787-
pcie_cap_reg = pci_find_capability(a->pcid, PCI_CAP_ID_EXP);
788-
if (pcie_cap_reg) {
786+
if (pci_is_pcie(a->pcid)) {
789787
u16 stat;
790788
u32 caps;
791789

792-
pci_read_config_word(a->pcid,
793-
pcie_cap_reg + PCI_EXP_LNKSTA,
794-
&stat);
795-
pci_read_config_dword(a->pcid,
796-
pcie_cap_reg + PCI_EXP_LNKCAP,
797-
&caps);
790+
pcie_capability_read_word(a->pcid, PCI_EXP_LNKSTA,
791+
&stat);
792+
pcie_capability_read_dword(a->pcid, PCI_EXP_LNKCAP,
793+
&caps);
798794

799795
gai->pci.link_speed_curr =
800796
(u8)(stat & PCI_EXP_LNKSTA_CLS);

0 commit comments

Comments
 (0)