Skip to content

Commit 45b7616

Browse files
Philipp Stannerkuba-moo
authored andcommitted
stmmac: Replace deprecated PCI functions
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. Reviewed-by: Andrew Lunn <[email protected]> Reviewed-by: Huacai Chen <[email protected]> Tested-by: Henry Chen <[email protected]> Signed-off-by: Philipp Stanner <[email protected]> Reviewed-by: Jacob Keller <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent d327a12 commit 45b7616

File tree

2 files changed

+8
-12
lines changed

2 files changed

+8
-12
lines changed

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

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -533,8 +533,8 @@ static int loongson_dwmac_fix_reset(void *priv, void __iomem *ioaddr)
533533
static int loongson_dwmac_probe(struct pci_dev *pdev, const struct pci_device_id *id)
534534
{
535535
struct plat_stmmacenet_data *plat;
536+
struct stmmac_resources res = {};
536537
struct stmmac_pci_info *info;
537-
struct stmmac_resources res;
538538
struct loongson_data *ld;
539539
int ret;
540540

@@ -566,13 +566,11 @@ static int loongson_dwmac_probe(struct pci_dev *pdev, const struct pci_device_id
566566
pci_set_master(pdev);
567567

568568
/* Get the base address of device */
569-
ret = pcim_iomap_regions(pdev, BIT(0), DRIVER_NAME);
569+
res.addr = pcim_iomap_region(pdev, 0, DRIVER_NAME);
570+
ret = PTR_ERR_OR_ZERO(res.addr);
570571
if (ret)
571572
goto err_disable_device;
572573

573-
memset(&res, 0, sizeof(res));
574-
res.addr = pcim_iomap_table(pdev)[0];
575-
576574
plat->bsp_priv = ld;
577575
plat->setup = loongson_dwmac_setup;
578576
plat->fix_soc_reset = loongson_dwmac_fix_reset;

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

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -155,9 +155,9 @@ static int stmmac_pci_probe(struct pci_dev *pdev,
155155
{
156156
struct stmmac_pci_info *info = (struct stmmac_pci_info *)id->driver_data;
157157
struct plat_stmmacenet_data *plat;
158-
struct stmmac_resources res;
159-
int i;
158+
struct stmmac_resources res = {};
160159
int ret;
160+
int i;
161161

162162
plat = devm_kzalloc(&pdev->dev, sizeof(*plat), GFP_KERNEL);
163163
if (!plat)
@@ -192,9 +192,9 @@ static int stmmac_pci_probe(struct pci_dev *pdev,
192192
for (i = 0; i < PCI_STD_NUM_BARS; i++) {
193193
if (pci_resource_len(pdev, i) == 0)
194194
continue;
195-
ret = pcim_iomap_regions(pdev, BIT(i), pci_name(pdev));
196-
if (ret)
197-
return ret;
195+
res.addr = pcim_iomap_region(pdev, i, STMMAC_RESOURCE_NAME);
196+
if (IS_ERR(res.addr))
197+
return PTR_ERR(res.addr);
198198
break;
199199
}
200200

@@ -204,8 +204,6 @@ static int stmmac_pci_probe(struct pci_dev *pdev,
204204
if (ret)
205205
return ret;
206206

207-
memset(&res, 0, sizeof(res));
208-
res.addr = pcim_iomap_table(pdev)[i];
209207
res.wol_irq = pdev->irq;
210208
res.irq = pdev->irq;
211209

0 commit comments

Comments
 (0)