Re: [PATCH v2 1/3] PCI: Move declaration of pci_rescan_remove_lock into public pci.h
From: Benjamin Block
Date: Fri Mar 13 2026 - 09:51:15 EST
On Thu, Mar 12, 2026 at 08:41:26PM +0100, Niklas Schnelle wrote:
> On Wed, 2026-03-11 at 14:27 +0100, Benjamin Block wrote:
> > diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
> > index bccc7a4bdd79..e5b12878e972 100644
> > --- a/drivers/pci/probe.c
> > +++ b/drivers/pci/probe.c
> > @@ -3509,6 +3509,7 @@ EXPORT_SYMBOL_GPL(pci_rescan_bus);
> > * routines should always be executed under this mutex.
> > */
> > DEFINE_MUTEX(pci_rescan_remove_lock);
> > +EXPORT_SYMBOL_GPL(pci_rescan_remove_lock);
>
> This has a (rather trivial) merge conflict with Ionut's patch which at
> the same time is a prerequisite for this series. Sadly since that isn't
> in linux-next yet I'm not sure how to best handle this. Maybe it would
> make sense to just include it in this series? @Ionut would that be ok
> for you?
Well, I don't mind either way tbf. I can also resend a new version, once other
other patch gets into next/master. That's shouldn't be an issue.
> > diff --git a/include/linux/pci.h b/include/linux/pci.h
> > index 1c270f1d5123..fd7a962a64ef 100644
> > --- a/include/linux/pci.h
> > +++ b/include/linux/pci.h
> > @@ -39,6 +39,7 @@
> > #include <linux/io.h>
> > #include <linux/resource_ext.h>
> > #include <linux/msi_api.h>
> > +#include <linux/mutex.h>
> > #include <uapi/linux/pci.h>
> >
> > #include <linux/pci_ids.h>
> > @@ -1533,6 +1534,7 @@ void set_pcie_hotplug_bridge(struct pci_dev *pdev);
> >
> > /* Functions for PCI Hotplug drivers to use */
> > unsigned int pci_rescan_bus(struct pci_bus *bus);
> > +extern struct mutex pci_rescan_remove_lock;
> > void pci_lock_rescan_remove(void);
> > void pci_unlock_rescan_remove(void);
> >
>
> I do see Keith's argument that proliferation of the rescan/remove lock
> is to be minimized. That said, since user's of this header can already
> lock/unlock I don't think this patch makes matters worse. In fact we
> want this patch to be able to add better lockdep asserts so it will
> help against misuse.
>
> With that feel free to add:
>
> Reviewed-by: Niklas Schnelle <schnelle@xxxxxxxxxxxxx>
Thanks.
--
Best Regards, Benjamin Block / Linux on IBM Z Kernel Development
IBM Deutschland Research & Development GmbH / https://www.ibm.com/privacy
Vors. Aufs.-R.: Wolfgang Wendt / Geschäftsführung: David Faller
Sitz der Ges.: Ehningen / Registergericht: AmtsG Stuttgart, HRB 243294