Re: [PATCH 2/2] IB/hfi1: Remove pci_parent_bus_reset() duplication

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, 20 Jun 2023, Maciej W. Rozycki wrote:

> Call pci_parent_bus_reset() rather than duplicating it in trigger_sbr().
> There are extra preparatory checks made by the former function, but they 
> are supposed to be neutral to the HFI1 device.
> 
> Signed-off-by: Maciej W. Rozycki <macro@xxxxxxxxxxx>
> ---
>  drivers/infiniband/hw/hfi1/pcie.c |   30 ++++--------------------------
>  1 file changed, 4 insertions(+), 26 deletions(-)
> 
> linux-ib-hfi1-pcie-sbr-parent-bus-reset.diff
> Index: linux-macro/drivers/infiniband/hw/hfi1/pcie.c
> ===================================================================
> --- linux-macro.orig/drivers/infiniband/hw/hfi1/pcie.c
> +++ linux-macro/drivers/infiniband/hw/hfi1/pcie.c
> @@ -796,35 +796,13 @@ static void pcie_post_steps(struct hfi1_
>  /*
>   * Trigger a secondary bus reset (SBR) on ourselves using our parent.
>   *
> - * Based on pci_parent_bus_reset() which is not exported by the
> - * kernel core.
> + * This is an end around to do an SBR during probe time.  A new API
> + * needs to be implemented to have cleaner interface but this fixes
> + * the current brokenness.
>   */
>  static int trigger_sbr(struct hfi1_devdata *dd)
>  {
> -	struct pci_dev *dev = dd->pcidev;
> -	struct pci_dev *pdev;
> -
> -	/* need a parent */
> -	if (!dev->bus->self) {
> -		dd_dev_err(dd, "%s: no parent device\n", __func__);
> -		return -ENOTTY;
> -	}
> -
> -	/* should not be anyone else on the bus */
> -	list_for_each_entry(pdev, &dev->bus->devices, bus_list)
> -		if (pdev != dev) {
> -			dd_dev_err(dd,
> -				   "%s: another device is on the same bus\n",
> -				   __func__);
> -			return -ENOTTY;
> -		}
> -
> -	/*
> -	 * This is an end around to do an SBR during probe time. A new API needs
> -	 * to be implemented to have cleaner interface but this fixes the
> -	 * current brokenness
> -	 */
> -	return pci_bridge_secondary_bus_reset(dev->bus->self);
> +	return pci_parent_bus_reset(dd->pcidev, PCI_RESET_DO_RESET);
>  }

Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@xxxxxxxxxxxxxxx>

-- 
 i.

[Index of Archives]     [DMA Engine]     [Linux Coverity]     [Linux USB]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Greybus]

  Powered by Linux