Re: [PATCH v2 1/2] PCI: Export pci_parent_bus_reset() for drivers to use
From: Leon Romanovsky
Date: Tue May 12 2026 - 05:19:42 EST
On Tue, May 05, 2026 at 01:03:39AM +0100, Maciej W. Rozycki wrote:
> Export pci_parent_bus_reset() so that drivers do not duplicate it.
> Document the interface.
>
> Signed-off-by: Maciej W. Rozycki <macro@xxxxxxxxxxx>
> ---
> Changes from v1,
> <https://lore.kernel.org/r/alpine.DEB.2.21.2306200231020.14084@xxxxxxxxxxxxxxxxx/>:
>
> - Reword function description so as to list the return values separately.
> ---
> drivers/pci/pci.c | 17 ++++++++++++++++-
> include/linux/pci.h | 1 +
> 2 files changed, 17 insertions(+), 1 deletion(-)
>
> linux-pci-parent-bus-reset-export.diff
> Index: linux-macro/drivers/pci/pci.c
> ===================================================================
> --- linux-macro.orig/drivers/pci/pci.c
> +++ linux-macro/drivers/pci/pci.c
> @@ -4833,7 +4833,21 @@ int pci_bridge_secondary_bus_reset(struc
> }
> EXPORT_SYMBOL_GPL(pci_bridge_secondary_bus_reset);
>
> -static int pci_parent_bus_reset(struct pci_dev *dev, bool probe)
> +/**
> + * pci_parent_bus_reset - Reset a device via its upstream PCI bridge
> + * @dev: Device to reset.
> + * @probe: Only check if reset is possible if TRUE, actually reset if FALSE.
> + *
> + * Perform a device reset by requesting a secondary bus reset via the
> + * device's immediate upstream PCI bridge. Return failure if the reset
> + * failed or it could not have been issued in the first place because
> + * the device is not on a secondary bus of any PCI bridge or it wouldn't
> + * be the only device reset. If probing, then only verify whether it
> + * would be possible to issue a reset.
> + *
> + * Returns: 0 if successful or -ENOTTY otherwise.
> + */
> +int pci_parent_bus_reset(struct pci_dev *dev, bool probe)
> {
> struct pci_dev *pdev;
>
> @@ -4850,6 +4864,7 @@ static int pci_parent_bus_reset(struct p
>
> return pci_bridge_secondary_bus_reset(dev->bus->self);
> }
> +EXPORT_SYMBOL_GPL(pci_parent_bus_reset);
I wouldn't recommend doing this solely for hfi1. The driver is likely to be
removed or significantly changed soon.
https://lore.kernel.org/linux-rdma/177516078937.637585.1447184858924347033.stgit@xxxxxxxxxxxxxxxxxxxxxxxxxxxxx/
Thanks