From: Keith Busch <kbusch@meta.com>
To: <linux-pci@vger.kernel.org>, <bhelgaas@google.com>
Cc: Keith Busch <kbusch@kernel.org>,
Jonathan Cameron <Jonathan.Cameron@huawei.com>
Subject: [PATCHv2 3/5] pci: move the walk bus lock to where its needed
Date: Tue, 27 Aug 2024 12:28:24 -0700 [thread overview]
Message-ID: <20240827192826.710031-4-kbusch@meta.com> (raw)
In-Reply-To: <20240827192826.710031-1-kbusch@meta.com>
From: Keith Busch <kbusch@kernel.org>
Simplify the common function by removing an unnecessary parameter that
can be more easily handled in the only caller that wants it.
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Keith Busch <kbusch@kernel.org>
---
drivers/pci/bus.c | 12 +++++-------
1 file changed, 5 insertions(+), 7 deletions(-)
diff --git a/drivers/pci/bus.c b/drivers/pci/bus.c
index e41dfece0d969..7c07a141e8772 100644
--- a/drivers/pci/bus.c
+++ b/drivers/pci/bus.c
@@ -390,7 +390,7 @@ void pci_bus_add_devices(const struct pci_bus *bus)
EXPORT_SYMBOL(pci_bus_add_devices);
static void __pci_walk_bus(struct pci_bus *top, int (*cb)(struct pci_dev *, void *),
- void *userdata, bool locked)
+ void *userdata)
{
struct pci_dev *dev;
struct pci_bus *bus;
@@ -398,8 +398,6 @@ static void __pci_walk_bus(struct pci_bus *top, int (*cb)(struct pci_dev *, void
int retval;
bus = top;
- if (!locked)
- down_read(&pci_bus_sem);
next = top->devices.next;
for (;;) {
if (next == &bus->devices) {
@@ -422,8 +420,6 @@ static void __pci_walk_bus(struct pci_bus *top, int (*cb)(struct pci_dev *, void
if (retval)
break;
}
- if (!locked)
- up_read(&pci_bus_sem);
}
/**
@@ -441,7 +437,9 @@ static void __pci_walk_bus(struct pci_bus *top, int (*cb)(struct pci_dev *, void
*/
void pci_walk_bus(struct pci_bus *top, int (*cb)(struct pci_dev *, void *), void *userdata)
{
- __pci_walk_bus(top, cb, userdata, false);
+ down_read(&pci_bus_sem);
+ __pci_walk_bus(top, cb, userdata);
+ up_read(&pci_bus_sem);
}
EXPORT_SYMBOL_GPL(pci_walk_bus);
@@ -449,7 +447,7 @@ void pci_walk_bus_locked(struct pci_bus *top, int (*cb)(struct pci_dev *, void *
{
lockdep_assert_held(&pci_bus_sem);
- __pci_walk_bus(top, cb, userdata, true);
+ __pci_walk_bus(top, cb, userdata);
}
EXPORT_SYMBOL_GPL(pci_walk_bus_locked);
--
2.43.5
next prev parent reply other threads:[~2024-08-27 19:28 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-27 19:28 [PATCHv2 0/5] pci cleanup/prep patches Keith Busch
2024-08-27 19:28 ` [PATCHv2 1/5] pci: make pci_stop_dev concurrent safe Keith Busch
2024-10-02 23:39 ` Davidlohr Bueso
2024-10-03 0:04 ` Keith Busch
2024-08-27 19:28 ` [PATCHv2 2/5] pci: make pci_destroy_dev " Keith Busch
2024-10-03 2:34 ` Davidlohr Bueso
2024-10-03 14:54 ` Keith Busch
2024-10-03 17:04 ` Davidlohr Bueso
2024-10-03 17:59 ` Keith Busch
2024-10-08 2:15 ` Davidlohr Bueso
2024-10-22 20:29 ` Keith Busch
2024-08-27 19:28 ` Keith Busch [this message]
2024-10-03 0:32 ` [PATCHv2 3/5] pci: move the walk bus lock to where its needed Davidlohr Bueso
2024-10-09 11:09 ` Ilpo Järvinen
2024-08-27 19:28 ` [PATCHv2 4/5] pci: walk bus recursively Keith Busch
2024-10-09 12:08 ` Ilpo Järvinen
2024-08-27 19:28 ` [PATCHv2 5/5] pci: unexport pci_walk_bus_locked Keith Busch
2024-10-03 0:35 ` Davidlohr Bueso
2024-10-09 12:20 ` Ilpo Järvinen
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=20240827192826.710031-4-kbusch@meta.com \
--to=kbusch@meta.com \
--cc=Jonathan.Cameron@huawei.com \
--cc=bhelgaas@google.com \
--cc=kbusch@kernel.org \
--cc=linux-pci@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