Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Frederick Lawler and committed by
Martin K. Petersen
2b4f4cb9 3e76ca95

+9 -18
+4 -9
drivers/scsi/esas2r/esas2r_init.c
··· 762 762 763 763 static void esas2r_init_pci_cfg_space(struct esas2r_adapter *a) 764 764 { 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)) { 769 766 u16 devcontrol; 770 767 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); 773 769 774 770 if ((devcontrol & PCI_EXP_DEVCTL_READRQ) > 775 771 PCI_EXP_DEVCTL_READRQ_512B) { ··· 774 778 775 779 devcontrol &= ~PCI_EXP_DEVCTL_READRQ; 776 780 devcontrol |= PCI_EXP_DEVCTL_READRQ_512B; 777 - pci_write_config_word(a->pcid, 778 - pcie_cap_reg + PCI_EXP_DEVCTL, 779 - devcontrol); 781 + pcie_capability_write_word(a->pcid, PCI_EXP_DEVCTL, 782 + devcontrol); 780 783 } 781 784 } 782 785 }
+5 -9
drivers/scsi/esas2r/esas2r_ioctl.c
··· 757 757 758 758 struct atto_hba_get_adapter_info *gai = 759 759 &hi->data.get_adap_info; 760 - int pcie_cap_reg; 761 760 762 761 if (hi->flags & HBAF_TUNNEL) { 763 762 hi->status = ATTO_STS_UNSUPPORTED; ··· 783 784 gai->pci.dev_num = PCI_SLOT(a->pcid->devfn); 784 785 gai->pci.func_num = PCI_FUNC(a->pcid->devfn); 785 786 786 - pcie_cap_reg = pci_find_capability(a->pcid, PCI_CAP_ID_EXP); 787 - if (pcie_cap_reg) { 787 + if (pci_is_pcie(a->pcid)) { 788 788 u16 stat; 789 789 u32 caps; 790 790 791 - pci_read_config_word(a->pcid, 792 - pcie_cap_reg + PCI_EXP_LNKSTA, 793 - &stat); 794 - pci_read_config_dword(a->pcid, 795 - pcie_cap_reg + PCI_EXP_LNKCAP, 796 - &caps); 791 + pcie_capability_read_word(a->pcid, PCI_EXP_LNKSTA, 792 + &stat); 793 + pcie_capability_read_dword(a->pcid, PCI_EXP_LNKCAP, 794 + &caps); 797 795 798 796 gai->pci.link_speed_curr = 799 797 (u8)(stat & PCI_EXP_LNKSTA_CLS);