Thread (20 messages) 20 messages, 6 authors, 2025-02-26

Re: [PATCH net-next v3 4/4] stmmac: Replace deprecated PCI functions

From: Yanteng Si <si.yanteng@linux.dev>
Date: 2025-02-25 09:15:05
Also in: lkml, netdev

在 2/25/25 3:16 PM, Philipp Stanner 写道:
On Mon, 2025-02-24 at 14:53 +0100, Philipp Stanner wrote:
quoted
From: Philipp Stanner <redacted>

The PCI functions
   - pcim_iomap_regions() and
   - pcim_iomap_table()
have been deprecated.

Replace them with their successor function, pcim_iomap_region().

Make variable declaration order at closeby places comply with reverse
christmas tree order.

Signed-off-by: Philipp Stanner <redacted>
---
  .../net/ethernet/stmicro/stmmac/dwmac-loongson.c   | 11 ++++-------
  drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c   | 14 ++++++------
--
  2 files changed, 10 insertions(+), 15 deletions(-)
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-loongson.c
b/drivers/net/ethernet/stmicro/stmmac/dwmac-loongson.c
index f3ea6016be68..25ef7b9c5dce 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-loongson.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-loongson.c
@@ -521,10 +521,10 @@ static int loongson_dwmac_acpi_config(struct
pci_dev *pdev,
  static int loongson_dwmac_probe(struct pci_dev *pdev, const struct
pci_device_id *id)
  {
  	struct plat_stmmacenet_data *plat;
+	struct stmmac_resources res = {};
  	struct stmmac_pci_info *info;
-	struct stmmac_resources res;
  	struct loongson_data *ld;
-	int ret, i;
+	int ret;
  
  	plat = devm_kzalloc(&pdev->dev, sizeof(*plat), GFP_KERNEL);
  	if (!plat)
@@ -554,13 +554,11 @@ static int loongson_dwmac_probe(struct pci_dev
*pdev, const struct pci_device_id
  	pci_set_master(pdev);
  
  	/* Get the base address of device */
-	ret = pcim_iomap_regions(pdev, BIT(0), DRIVER_NAME);
+	res.addr = pcim_iomap_region(pdev, 0, DRIVER_NAME);
+	ret = PTR_ERR_OR_ZERO(res.addr);
  	if (ret)
  		goto err_disable_device;
  
-	memset(&res, 0, sizeof(res));
-	res.addr = pcim_iomap_table(pdev)[0];
-
  	plat->bsp_priv = ld;
  	plat->setup = loongson_dwmac_setup;
  	ld->dev = &pdev->dev;
@@ -603,7 +601,6 @@ static void loongson_dwmac_remove(struct pci_dev
*pdev)
  	struct net_device *ndev = dev_get_drvdata(&pdev->dev);
  	struct stmmac_priv *priv = netdev_priv(ndev);
  	struct loongson_data *ld;
-	int i;
Just saw that this is a left-over that actually should be in patch 3.
Will fix.
Yeah, with this


Reviewed-by: Yanteng Si <si.yanteng@linux.dev>

Thanks,
Yanteng

Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help