public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Frederick Lawler <fred@fredlawl.com>
To: axboe@kernel.dk
Cc: Frederick Lawler <fred@fredlawl.com>,
	linux-block@vger.kernel.org, linux-kernel@vger.kernel.org,
	bhelgaas@google.com, bvanassche@acm.org
Subject: [PATCH v2 2/4] skd: Replace magic numbers with PCI constants
Date: Sun, 17 Nov 2019 18:20:55 -0600	[thread overview]
Message-ID: <20191118002057.9596-3-fred@fredlawl.com> (raw)
In-Reply-To: <20191118002057.9596-1-fred@fredlawl.com>

Readability was improved by replacing pci_read_config_word() with
pcie_capability_read_word(). Take that a step further by replacing magic
numbers with PCI reg constants.

No functional change intended.

Signed-off-by: Frederick Lawler <fred@fredlawl.com>
---
v2
- Added this patch
---
 drivers/block/skd_main.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/block/skd_main.c b/drivers/block/skd_main.c
index f25f6ef6b4c7..7f8243573ad9 100644
--- a/drivers/block/skd_main.c
+++ b/drivers/block/skd_main.c
@@ -3141,9 +3141,11 @@ static char *skd_pci_info(struct skd_device *skdev, char *str)
 		char lwstr[6];
 		uint16_t pcie_lstat, lspeed, lwidth;
 
-		pcie_capability_read_word(skdev->pdev, 0x12, &pcie_lstat);
-		lspeed = pcie_lstat & (0xF);
-		lwidth = (pcie_lstat & 0x3F0) >> 4;
+		pcie_capability_read_word(skdev->pdev, PCI_EXP_LNKSTA,
+					  &pcie_lstat);
+		lspeed = pcie_lstat & PCI_EXP_LNKSTA_CLS;
+		lwidth = (pcie_lstat & PCI_EXP_LNKSTA_NLW) >>
+			 PCI_EXP_LNKSTA_NLW_SHIFT;
 
 		if (lspeed == 1)
 			strcat(str, "2.5GT/s ");
-- 
2.20.1


  parent reply	other threads:[~2019-11-18  0:21 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-18  0:20 [PATCH v2 0/4] skd/mtip32xx: Prefer pcie_capability_read_word() Frederick Lawler
2019-11-18  0:20 ` [PATCH v2 1/4] skd: " Frederick Lawler
2019-11-18  1:45   ` Damien Le Moal
2019-11-19  1:20     ` Frederick Lawler
2019-11-19  2:41       ` Damien Le Moal
2019-11-18  0:20 ` Frederick Lawler [this message]
2019-11-18  1:45   ` [PATCH v2 2/4] skd: Replace magic numbers with PCI constants Damien Le Moal
2019-11-19  1:21     ` Frederick Lawler
2019-11-18  0:20 ` [PATCH v2 3/4] mtip32xx: Prefer pcie_capability_read_word() Frederick Lawler
2019-11-18  0:20 ` [PATCH v2 4/4] mtip32xx: Replace magic numbers with PCI constants Frederick Lawler

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=20191118002057.9596-3-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