diff mbox series

[2/2] r8169: use new function pcim_iomap_region()

Message ID e1016eec-c059-47e5-8e01-539b1b48012a@gmail.com (mailing list archive)
State Changes Requested
Delegated to: Netdev Maintainers
Headers show
Series PCI: Add and use pcim_iomap_region() | expand

Checks

Context Check Description
netdev/series_format success Posting correctly formatted
netdev/tree_selection success Guessed tree name to be net-next
netdev/ynl success Generated files up to date; no warnings/errors; no diff in generated;
netdev/fixes_present success Fixes tag not required for -next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit fail Errors and warnings before: 944 this patch: 946
netdev/build_tools success No tools touched, skip
netdev/cc_maintainers success CCed 6 of 6 maintainers
netdev/build_clang success Errors and warnings before: 955 this patch: 955
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn fail Errors and warnings before: 955 this patch: 957
netdev/checkpatch warning WARNING: line length of 91 exceeds 80 columns
netdev/build_clang_rust success No Rust files in patch. Skipping build
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Heiner Kallweit March 27, 2024, 11:54 a.m. UTC
Use new function pcim_iomap_region() to simplify the code.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
---
 drivers/net/ethernet/realtek/r8169_main.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

Comments

Philipp Stanner March 27, 2024, 1:35 p.m. UTC | #1
On Wed, 2024-03-27 at 12:54 +0100, Heiner Kallweit wrote:
> Use new function pcim_iomap_region() to simplify the code.
> 
> Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
> ---
>  drivers/net/ethernet/realtek/r8169_main.c | 8 +++-----
>  1 file changed, 3 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/net/ethernet/realtek/r8169_main.c
> b/drivers/net/ethernet/realtek/r8169_main.c
> index 5c879a5c8..7411cf1a1 100644
> --- a/drivers/net/ethernet/realtek/r8169_main.c
> +++ b/drivers/net/ethernet/realtek/r8169_main.c
> @@ -5333,11 +5333,9 @@ static int rtl_init_one(struct pci_dev *pdev,
> const struct pci_device_id *ent)
>         if (region < 0)
>                 return dev_err_probe(&pdev->dev, -ENODEV, "no MMIO
> resource found\n");
>  
> -       rc = pcim_iomap_regions(pdev, BIT(region), KBUILD_MODNAME);
> -       if (rc < 0)
> -               return dev_err_probe(&pdev->dev, rc, "cannot remap
> MMIO, aborting\n");
> -
> -       tp->mmio_addr = pcim_iomap_table(pdev)[region];
> +       tp->mmio_addr = pcim_iomap_region(pdev, region,
> KBUILD_MODNAME);
> +       if (!tp->mmio_addr)
> +               return dev_err_probe(&pdev->dev, -ENOMEM, "cannot
> remap MMIO, aborting\n");
>  
>         txconfig = RTL_R32(tp, TxConfig);
>         if (txconfig == ~0U)

You could use this patch then on top of my series; the only little
change necessary would be that you have to check for an ERR_PTR:

if (IS_ERR(tp->mmio_addr))
   ...


Looks very good otherwise.

P.
diff mbox series

Patch

diff --git a/drivers/net/ethernet/realtek/r8169_main.c b/drivers/net/ethernet/realtek/r8169_main.c
index 5c879a5c8..7411cf1a1 100644
--- a/drivers/net/ethernet/realtek/r8169_main.c
+++ b/drivers/net/ethernet/realtek/r8169_main.c
@@ -5333,11 +5333,9 @@  static int rtl_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
 	if (region < 0)
 		return dev_err_probe(&pdev->dev, -ENODEV, "no MMIO resource found\n");
 
-	rc = pcim_iomap_regions(pdev, BIT(region), KBUILD_MODNAME);
-	if (rc < 0)
-		return dev_err_probe(&pdev->dev, rc, "cannot remap MMIO, aborting\n");
-
-	tp->mmio_addr = pcim_iomap_table(pdev)[region];
+	tp->mmio_addr = pcim_iomap_region(pdev, region, KBUILD_MODNAME);
+	if (!tp->mmio_addr)
+		return dev_err_probe(&pdev->dev, -ENOMEM, "cannot remap MMIO, aborting\n");
 
 	txconfig = RTL_R32(tp, TxConfig);
 	if (txconfig == ~0U)