mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-05-10 05:39:42 -04:00
net: octeontx2: Use pure PCI devres API
The currently used function pci_request_regions() is one of the problematic "hybrid devres" PCI functions, which are sometimes managed through devres, and sometimes not (depending on whether pci_enable_device() or pcim_enable_device() has been called before). The PCI subsystem wants to remove this behavior and, therefore, needs to port all users to functions that don't have this problem. Furthermore, the PCI function being managed implies that it's not necessary to call pci_release_regions() manually. Remove the calls to pci_release_regions(). Replace pci_request_regions() with pcim_request_all_regions(). Signed-off-by: Philipp Stanner <phasta@kernel.org> Link: https://patch.msgid.link/20250425085740.65304-4-phasta@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
committed by
Jakub Kicinski
parent
66ada74711
commit
48217b8345
@@ -3048,7 +3048,7 @@ static int otx2_probe(struct pci_dev *pdev, const struct pci_device_id *id)
|
||||
return err;
|
||||
}
|
||||
|
||||
err = pci_request_regions(pdev, DRV_NAME);
|
||||
err = pcim_request_all_regions(pdev, DRV_NAME);
|
||||
if (err) {
|
||||
dev_err(dev, "PCI request regions failed 0x%x\n", err);
|
||||
return err;
|
||||
@@ -3057,7 +3057,7 @@ static int otx2_probe(struct pci_dev *pdev, const struct pci_device_id *id)
|
||||
err = dma_set_mask_and_coherent(dev, DMA_BIT_MASK(48));
|
||||
if (err) {
|
||||
dev_err(dev, "DMA mask config failed, abort\n");
|
||||
goto err_release_regions;
|
||||
return err;
|
||||
}
|
||||
|
||||
pci_set_master(pdev);
|
||||
@@ -3067,10 +3067,8 @@ static int otx2_probe(struct pci_dev *pdev, const struct pci_device_id *id)
|
||||
qos_txqs = min_t(int, qcount, OTX2_QOS_MAX_LEAF_NODES);
|
||||
|
||||
netdev = alloc_etherdev_mqs(sizeof(*pf), qcount + qos_txqs, qcount);
|
||||
if (!netdev) {
|
||||
err = -ENOMEM;
|
||||
goto err_release_regions;
|
||||
}
|
||||
if (!netdev)
|
||||
return -ENOMEM;
|
||||
|
||||
pci_set_drvdata(pdev, netdev);
|
||||
SET_NETDEV_DEV(netdev, &pdev->dev);
|
||||
@@ -3246,8 +3244,6 @@ static int otx2_probe(struct pci_dev *pdev, const struct pci_device_id *id)
|
||||
err_free_netdev:
|
||||
pci_set_drvdata(pdev, NULL);
|
||||
free_netdev(netdev);
|
||||
err_release_regions:
|
||||
pci_release_regions(pdev);
|
||||
return err;
|
||||
}
|
||||
|
||||
@@ -3447,8 +3443,6 @@ static void otx2_remove(struct pci_dev *pdev)
|
||||
pci_free_irq_vectors(pf->pdev);
|
||||
pci_set_drvdata(pdev, NULL);
|
||||
free_netdev(netdev);
|
||||
|
||||
pci_release_regions(pdev);
|
||||
}
|
||||
|
||||
static struct pci_driver otx2_pf_driver = {
|
||||
|
||||
@@ -548,7 +548,7 @@ static int otx2vf_probe(struct pci_dev *pdev, const struct pci_device_id *id)
|
||||
return err;
|
||||
}
|
||||
|
||||
err = pci_request_regions(pdev, DRV_NAME);
|
||||
err = pcim_request_all_regions(pdev, DRV_NAME);
|
||||
if (err) {
|
||||
dev_err(dev, "PCI request regions failed 0x%x\n", err);
|
||||
return err;
|
||||
@@ -557,7 +557,7 @@ static int otx2vf_probe(struct pci_dev *pdev, const struct pci_device_id *id)
|
||||
err = dma_set_mask_and_coherent(dev, DMA_BIT_MASK(48));
|
||||
if (err) {
|
||||
dev_err(dev, "DMA mask config failed, abort\n");
|
||||
goto err_release_regions;
|
||||
return err;
|
||||
}
|
||||
|
||||
pci_set_master(pdev);
|
||||
@@ -565,10 +565,8 @@ static int otx2vf_probe(struct pci_dev *pdev, const struct pci_device_id *id)
|
||||
qcount = num_online_cpus();
|
||||
qos_txqs = min_t(int, qcount, OTX2_QOS_MAX_LEAF_NODES);
|
||||
netdev = alloc_etherdev_mqs(sizeof(*vf), qcount + qos_txqs, qcount);
|
||||
if (!netdev) {
|
||||
err = -ENOMEM;
|
||||
goto err_release_regions;
|
||||
}
|
||||
if (!netdev)
|
||||
return -ENOMEM;
|
||||
|
||||
pci_set_drvdata(pdev, netdev);
|
||||
SET_NETDEV_DEV(netdev, &pdev->dev);
|
||||
@@ -765,8 +763,6 @@ static int otx2vf_probe(struct pci_dev *pdev, const struct pci_device_id *id)
|
||||
err_free_netdev:
|
||||
pci_set_drvdata(pdev, NULL);
|
||||
free_netdev(netdev);
|
||||
err_release_regions:
|
||||
pci_release_regions(pdev);
|
||||
return err;
|
||||
}
|
||||
|
||||
@@ -815,8 +811,6 @@ static void otx2vf_remove(struct pci_dev *pdev)
|
||||
pci_free_irq_vectors(vf->pdev);
|
||||
pci_set_drvdata(pdev, NULL);
|
||||
free_netdev(netdev);
|
||||
|
||||
pci_release_regions(pdev);
|
||||
}
|
||||
|
||||
static struct pci_driver otx2vf_driver = {
|
||||
|
||||
@@ -765,7 +765,7 @@ static int rvu_rep_probe(struct pci_dev *pdev, const struct pci_device_id *id)
|
||||
return err;
|
||||
}
|
||||
|
||||
err = pci_request_regions(pdev, DRV_NAME);
|
||||
err = pcim_request_all_regions(pdev, DRV_NAME);
|
||||
if (err) {
|
||||
dev_err(dev, "PCI request regions failed 0x%x\n", err);
|
||||
return err;
|
||||
@@ -774,7 +774,7 @@ static int rvu_rep_probe(struct pci_dev *pdev, const struct pci_device_id *id)
|
||||
err = dma_set_mask_and_coherent(dev, DMA_BIT_MASK(48));
|
||||
if (err) {
|
||||
dev_err(dev, "DMA mask config failed, abort\n");
|
||||
goto err_release_regions;
|
||||
goto err_set_drv_data;
|
||||
}
|
||||
|
||||
pci_set_master(pdev);
|
||||
@@ -782,7 +782,7 @@ static int rvu_rep_probe(struct pci_dev *pdev, const struct pci_device_id *id)
|
||||
priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
|
||||
if (!priv) {
|
||||
err = -ENOMEM;
|
||||
goto err_release_regions;
|
||||
goto err_set_drv_data;
|
||||
}
|
||||
|
||||
pci_set_drvdata(pdev, priv);
|
||||
@@ -799,7 +799,7 @@ static int rvu_rep_probe(struct pci_dev *pdev, const struct pci_device_id *id)
|
||||
|
||||
err = otx2_init_rsrc(pdev, priv);
|
||||
if (err)
|
||||
goto err_release_regions;
|
||||
goto err_set_drv_data;
|
||||
|
||||
priv->iommu_domain = iommu_get_domain_for_dev(dev);
|
||||
|
||||
@@ -822,9 +822,8 @@ static int rvu_rep_probe(struct pci_dev *pdev, const struct pci_device_id *id)
|
||||
otx2_disable_mbox_intr(priv);
|
||||
otx2_pfaf_mbox_destroy(priv);
|
||||
pci_free_irq_vectors(pdev);
|
||||
err_release_regions:
|
||||
err_set_drv_data:
|
||||
pci_set_drvdata(pdev, NULL);
|
||||
pci_release_regions(pdev);
|
||||
return err;
|
||||
}
|
||||
|
||||
@@ -844,7 +843,6 @@ static void rvu_rep_remove(struct pci_dev *pdev)
|
||||
otx2_pfaf_mbox_destroy(priv);
|
||||
pci_free_irq_vectors(priv->pdev);
|
||||
pci_set_drvdata(pdev, NULL);
|
||||
pci_release_regions(pdev);
|
||||
}
|
||||
|
||||
static struct pci_driver rvu_rep_driver = {
|
||||
|
||||
Reference in New Issue
Block a user