linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Xiongfeng Wang <wangxiongfeng2@huawei.com>
To: <alyssa@rosenzweig.io>, <maz@kernel.org>, <lpieralisi@kernel.org>,
	<kw@linux.com>, <robh@kernel.org>, <bhelgaas@google.com>,
	<mahesh@linux.ibm.com>, <oohall@gmail.com>
Cc: <lukas@wunner.de>, <linux-pci@vger.kernel.org>,
	<yangyingliang@huawei.com>, <wangxiongfeng2@huawei.com>
Subject: [PATCH 2/3] PCI/AER: Use pci_dev_id() to simplify the code
Date: Mon, 7 Aug 2023 21:48:57 +0800	[thread overview]
Message-ID: <20230807134858.116051-3-wangxiongfeng2@huawei.com> (raw)
In-Reply-To: <20230807134858.116051-1-wangxiongfeng2@huawei.com>

PCI core API pci_dev_id() can be used to get the BDF number for a pci
device. We don't need to compose it mannually. Use pci_dev_id() to
simplify the code a little bit.

Signed-off-by: Xiongfeng Wang <wangxiongfeng2@huawei.com>
---
 drivers/pci/pcie/aer.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/pci/pcie/aer.c b/drivers/pci/pcie/aer.c
index f6c24ded134c..2bc03937452b 100644
--- a/drivers/pci/pcie/aer.c
+++ b/drivers/pci/pcie/aer.c
@@ -712,7 +712,7 @@ static void __aer_print_error(struct pci_dev *dev,
 void aer_print_error(struct pci_dev *dev, struct aer_err_info *info)
 {
 	int layer, agent;
-	int id = ((dev->bus->number << 8) | dev->devfn);
+	int id = pci_dev_id(dev);
 	const char *level;
 
 	if (!info->status) {
@@ -847,7 +847,7 @@ static bool is_error_source(struct pci_dev *dev, struct aer_err_info *e_info)
 	if ((PCI_BUS_NUM(e_info->id) != 0) &&
 	    !(dev->bus->bus_flags & PCI_BUS_FLAGS_NO_AERSID)) {
 		/* Device ID match? */
-		if (e_info->id == ((dev->bus->number << 8) | dev->devfn))
+		if (e_info->id == pci_dev_id(dev))
 			return true;
 
 		/* Continue id comparing if there is no multiple error */
-- 
2.20.1


  parent reply	other threads:[~2023-08-07 13:37 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-07 13:48 [PATCH 0/3] PCI: Use pci_dev_id() to simplify the code Xiongfeng Wang
2023-08-07 13:48 ` [PATCH 1/3] PCI: apple: use " Xiongfeng Wang
2023-08-07 13:48 ` Xiongfeng Wang [this message]
2023-08-07 13:48 ` [PATCH 3/3] PCI/IOV: Use " Xiongfeng Wang
2023-08-07 21:16 ` [PATCH 0/3] PCI: " Bjorn Helgaas
2023-08-08  1:12   ` Xiongfeng Wang

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=20230807134858.116051-3-wangxiongfeng2@huawei.com \
    --to=wangxiongfeng2@huawei.com \
    --cc=alyssa@rosenzweig.io \
    --cc=bhelgaas@google.com \
    --cc=kw@linux.com \
    --cc=linux-pci@vger.kernel.org \
    --cc=lpieralisi@kernel.org \
    --cc=lukas@wunner.de \
    --cc=mahesh@linux.ibm.com \
    --cc=maz@kernel.org \
    --cc=oohall@gmail.com \
    --cc=robh@kernel.org \
    --cc=yangyingliang@huawei.com \
    /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).