mirror of
https://github.com/torvalds/linux.git
synced 2026-09-24 06:24:02 +02:00
RDMA/hfi1: Pass PCI device to hfi1_pcie_init()
hfi1_pcie_init() only needs hfi1_devdata to reach the PCI device. This unnecessary dependency prevents common PCI setup from running before hfi1_devdata is allocated. Pass pci_dev directly and report failures with dev_err(), preserving the device BDF needed to identify the failing adapter on multi-device systems. Use %pe while changing the messages so errno values are decoded. Link: https://patch.msgid.link/20260708-clean-init-one-hfi1-v1-4-b9e9641268a5@nvidia.com Reviewed-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com> Signed-off-by: Leon Romanovsky <leonro@nvidia.com>
This commit is contained in:
parent
af9117d02f
commit
b9cb5e81f7
|
|
@ -2132,7 +2132,7 @@ void hfi1_verbs_unregister_sysfs(struct hfi1_devdata *dd);
|
|||
/* Hook for sysfs read of QSFP */
|
||||
int qsfp_dump(struct hfi1_pportdata *ppd, char *buf, int len);
|
||||
|
||||
int hfi1_pcie_init(struct hfi1_devdata *dd);
|
||||
int hfi1_pcie_init(struct pci_dev *pdev);
|
||||
void hfi1_pcie_cleanup(struct pci_dev *pdev);
|
||||
int hfi1_pcie_ddinit(struct hfi1_devdata *dd, struct pci_dev *pdev);
|
||||
void hfi1_pcie_ddcleanup(struct hfi1_devdata *);
|
||||
|
|
|
|||
|
|
@ -1620,7 +1620,7 @@ static int init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
|
|||
/* restrict value of hfi1_rcvarr_split */
|
||||
hfi1_rcvarr_split = clamp_val(hfi1_rcvarr_split, 0, 100);
|
||||
|
||||
ret = hfi1_pcie_init(dd);
|
||||
ret = hfi1_pcie_init(pdev);
|
||||
if (ret)
|
||||
goto bail;
|
||||
|
||||
|
|
|
|||
|
|
@ -21,10 +21,9 @@
|
|||
/*
|
||||
* Do all the common PCIe setup and initialization.
|
||||
*/
|
||||
int hfi1_pcie_init(struct hfi1_devdata *dd)
|
||||
int hfi1_pcie_init(struct pci_dev *pdev)
|
||||
{
|
||||
int ret;
|
||||
struct pci_dev *pdev = dd->pcidev;
|
||||
|
||||
ret = pci_enable_device(pdev);
|
||||
if (ret) {
|
||||
|
|
@ -40,13 +39,15 @@ int hfi1_pcie_init(struct hfi1_devdata *dd)
|
|||
* about that, it appears. If the original BAR was retained
|
||||
* in the kernel data structures, this may be OK.
|
||||
*/
|
||||
dd_dev_err(dd, "pci enable failed: error %d\n", -ret);
|
||||
dev_err(&pdev->dev, "pci enable failed: error %pe\n",
|
||||
ERR_PTR(ret));
|
||||
return ret;
|
||||
}
|
||||
|
||||
ret = pci_request_regions(pdev, DRIVER_NAME);
|
||||
if (ret) {
|
||||
dd_dev_err(dd, "pci_request_regions fails: err %d\n", -ret);
|
||||
dev_err(&pdev->dev, "pci_request_regions fails: err %pe\n",
|
||||
ERR_PTR(ret));
|
||||
goto bail;
|
||||
}
|
||||
|
||||
|
|
@ -59,7 +60,8 @@ int hfi1_pcie_init(struct hfi1_devdata *dd)
|
|||
*/
|
||||
ret = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32));
|
||||
if (ret) {
|
||||
dd_dev_err(dd, "Unable to set DMA mask: %d\n", ret);
|
||||
dev_err(&pdev->dev, "Unable to set DMA mask: %pe\n",
|
||||
ERR_PTR(ret));
|
||||
goto bail;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user