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 1/3] PCI: apple: use pci_dev_id() to simplify the code
Date: Mon, 7 Aug 2023 21:48:56 +0800 [thread overview]
Message-ID: <20230807134858.116051-2-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 using PCI_DEVID(). Use
pci_dev_id() to simplify the code a little bit.
Signed-off-by: Xiongfeng Wang <wangxiongfeng2@huawei.com>
---
drivers/pci/controller/pcie-apple.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/pci/controller/pcie-apple.c b/drivers/pci/controller/pcie-apple.c
index 66f37e403a09..2abca318e22a 100644
--- a/drivers/pci/controller/pcie-apple.c
+++ b/drivers/pci/controller/pcie-apple.c
@@ -670,7 +670,7 @@ static struct apple_pcie_port *apple_pcie_get_port(struct pci_dev *pdev)
static int apple_pcie_add_device(struct apple_pcie_port *port,
struct pci_dev *pdev)
{
- u32 sid, rid = PCI_DEVID(pdev->bus->number, pdev->devfn);
+ u32 sid, rid = pci_dev_id(pdev);
int idx, err;
dev_dbg(&pdev->dev, "added to bus %s, index %d\n",
@@ -701,7 +701,7 @@ static int apple_pcie_add_device(struct apple_pcie_port *port,
static void apple_pcie_release_device(struct apple_pcie_port *port,
struct pci_dev *pdev)
{
- u32 rid = PCI_DEVID(pdev->bus->number, pdev->devfn);
+ u32 rid = pci_dev_id(pdev);
int idx;
mutex_lock(&port->pcie->lock);
--
2.20.1
next prev 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 ` Xiongfeng Wang [this message]
2023-08-07 13:48 ` [PATCH 2/3] PCI/AER: " Xiongfeng Wang
2023-08-07 13:48 ` [PATCH 3/3] PCI/IOV: " 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-2-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).