Skip to content

Commit d327a12

Browse files
Philipp Stannerkuba-moo
authored andcommitted
stmmac: Remove pcim_* functions for driver detach
Functions prefixed with "pcim_" are managed devres functions which perform automatic cleanup once the driver unloads. It is, thus, not necessary to call any cleanup functions in remove() callbacks. Remove the pcim_ cleanup function calls in the remove() callbacks. Signed-off-by: Philipp Stanner <phasta@kernel.org> Reviewed-by: Andrew Lunn <andrew@lunn.ch> Reviewed-by: Yanteng Si <si.yanteng@linux.dev> Tested-by: Henry Chen <chenx97@aosc.io> Reviewed-by: Jacob Keller <jacob.e.keller@intel.com> Link: https://patch.msgid.link/20250324092928.9482-5-phasta@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
1 parent 9db2426 commit d327a12

2 files changed

Lines changed: 1 addition & 19 deletions

File tree

drivers/net/ethernet/stmicro/stmmac/dwmac-loongson.c

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -619,7 +619,6 @@ static void loongson_dwmac_remove(struct pci_dev *pdev)
619619
struct net_device *ndev = dev_get_drvdata(&pdev->dev);
620620
struct stmmac_priv *priv = netdev_priv(ndev);
621621
struct loongson_data *ld;
622-
int i;
623622

624623
ld = priv->plat->bsp_priv;
625624
stmmac_dvr_remove(&pdev->dev);
@@ -630,13 +629,6 @@ static void loongson_dwmac_remove(struct pci_dev *pdev)
630629
if (ld->loongson_id == DWMAC_CORE_LS_MULTICHAN)
631630
loongson_dwmac_msi_clear(pdev);
632631

633-
for (i = 0; i < PCI_STD_NUM_BARS; i++) {
634-
if (pci_resource_len(pdev, i) == 0)
635-
continue;
636-
pcim_iounmap_regions(pdev, BIT(i));
637-
break;
638-
}
639-
640632
pci_disable_device(pdev);
641633
}
642634

drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -226,21 +226,11 @@ static int stmmac_pci_probe(struct pci_dev *pdev,
226226
* stmmac_pci_remove
227227
*
228228
* @pdev: platform device pointer
229-
* Description: this function calls the main to free the net resources
230-
* and releases the PCI resources.
229+
* Description: this function calls the main to free the net resources.
231230
*/
232231
static void stmmac_pci_remove(struct pci_dev *pdev)
233232
{
234-
int i;
235-
236233
stmmac_dvr_remove(&pdev->dev);
237-
238-
for (i = 0; i < PCI_STD_NUM_BARS; i++) {
239-
if (pci_resource_len(pdev, i) == 0)
240-
continue;
241-
pcim_iounmap_regions(pdev, BIT(i));
242-
break;
243-
}
244234
}
245235

246236
static int __maybe_unused stmmac_pci_suspend(struct device *dev)

0 commit comments

Comments
 (0)