linux-block.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Frederick Lawler <fred@fredlawl.com>
To: axboe@kernel.dk
Cc: Frederick Lawler <fred@fredlawl.com>,
	bvanassche@acm.org, linux-block@vger.kernel.org,
	linux-kernel@vger.kernel.org, bhelgaas@google.com
Subject: [PATCH] skd: Prefer pcie_capability_read_word()
Date: Wed, 17 Jul 2019 21:07:45 -0500	[thread overview]
Message-ID: <20190718020745.8867-10-fred@fredlawl.com> (raw)
In-Reply-To: <20190718020745.8867-1-fred@fredlawl.com>

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>
---
 drivers/block/skd_main.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/block/skd_main.c b/drivers/block/skd_main.c
index 7d3ad6c22ee5..996c38d03fc4 100644
--- a/drivers/block/skd_main.c
+++ b/drivers/block/skd_main.c
@@ -3137,18 +3137,14 @@ MODULE_DEVICE_TABLE(pci, skd_pci_tbl);
 
 static char *skd_pci_info(struct skd_device *skdev, char *str)
 {
-	int pcie_reg;
-
 	strcpy(str, "PCIe (");
-	pcie_reg = pci_find_capability(skdev->pdev, PCI_CAP_ID_EXP);
 
-	if (pcie_reg) {
+	if (pci_is_pcie(skdev->pdev)) {
 
 		char lwstr[6];
 		uint16_t pcie_lstat, lspeed, lwidth;
 
-		pcie_reg += 0x12;
-		pci_read_config_word(skdev->pdev, pcie_reg, &pcie_lstat);
+		pcie_capability_read_word(skdev->pdev, 0x12, &pcie_lstat);
 		lspeed = pcie_lstat & (0xF);
 		lwidth = (pcie_lstat & 0x3F0) >> 4;
 
-- 
2.17.1


  parent reply	other threads:[~2019-07-18  2:09 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20190718020745.8867-1-fred@fredlawl.com>
2019-07-18  2:07 ` [PATCH] mtip32xx: Prefer pcie_capability_read_word() Frederick Lawler
2019-07-18 12:48   ` Bjorn Helgaas
2019-07-18  2:07 ` Frederick Lawler [this message]
2019-07-18 12:43   ` [PATCH] skd: " Bjorn Helgaas

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190718020745.8867-10-fred@fredlawl.com \
    --to=fred@fredlawl.com \
    --cc=axboe@kernel.dk \
    --cc=bhelgaas@google.com \
    --cc=bvanassche@acm.org \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).