[PATCH v2] misc: cb710: Replace deprecated PCI functions

Madhur Kumar posted 1 patch 2 months ago
drivers/misc/cb710/core.c | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
[PATCH v2] misc: cb710: Replace deprecated PCI functions
Posted by Madhur Kumar 2 months ago
pcim_iomap_table() and pcim_iomap_regions() have been deprecated.
Replace them with pcim_iomap_region().

Signed-off-by: Madhur Kumar <madhurkumar004@gmail.com>
---
v2: fix checkpatch warning for missing space after 'if' in core.c

 drivers/misc/cb710/core.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/drivers/misc/cb710/core.c b/drivers/misc/cb710/core.c
index 55b7ee0e8f93..a1e6ba62c298 100644
--- a/drivers/misc/cb710/core.c
+++ b/drivers/misc/cb710/core.c
@@ -223,13 +223,11 @@ static int cb710_probe(struct pci_dev *pdev,
 	if (err)
 		return err;
 
-	err = pcim_iomap_regions(pdev, 0x0001, KBUILD_MODNAME);
-	if (err)
-		return err;
-
 	spin_lock_init(&chip->irq_lock);
 	chip->pdev = pdev;
-	chip->iobase = pcim_iomap_table(pdev)[0];
+	chip->iobase = pcim_iomap_region(pdev, 0, KBUILD_MODNAME);
+	if (!chip->iobase)
+		return -ENOMEM;
 
 	pci_set_drvdata(pdev, chip);
 
-- 
2.51.0
Re: [PATCH v2] misc: cb710: Replace deprecated PCI functions
Posted by Philipp Stanner 1 month ago
On Mon, 2025-10-13 at 18:58 +0530, Madhur Kumar wrote:
> pcim_iomap_table() and pcim_iomap_regions() have been deprecated.
> Replace them with pcim_iomap_region().
> 
> Signed-off-by: Madhur Kumar <madhurkumar004@gmail.com>
> ---
> v2: fix checkpatch warning for missing space after 'if' in core.c
> 
>  drivers/misc/cb710/core.c | 8 +++-----
>  1 file changed, 3 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/misc/cb710/core.c b/drivers/misc/cb710/core.c
> index 55b7ee0e8f93..a1e6ba62c298 100644
> --- a/drivers/misc/cb710/core.c
> +++ b/drivers/misc/cb710/core.c
> @@ -223,13 +223,11 @@ static int cb710_probe(struct pci_dev *pdev,
>  	if (err)
>  		return err;
>  
> -	err = pcim_iomap_regions(pdev, 0x0001, KBUILD_MODNAME);
> -	if (err)
> -		return err;
> -
>  	spin_lock_init(&chip->irq_lock);
>  	chip->pdev = pdev;
> -	chip->iobase = pcim_iomap_table(pdev)[0];
> +	chip->iobase = pcim_iomap_region(pdev, 0, KBUILD_MODNAME);
> +	if (!chip->iobase)

Nope, this is wrong. pcim_iomap_region() returns an ERR_PTR on error,
not NULL. You need to check it with IS_ERR or similar.

Sry, late to the party, but just saw this. It was applied already, so
someone should send a fix. I could, but maybe Madhur can do it faster
since he's got the branch etc already.

Thx,
P.

> +		return -ENOMEM;
>  
>  	pci_set_drvdata(pdev, chip);
>  
Re: [PATCH v2] misc: cb710: Replace deprecated PCI functions
Posted by Madhur Kumar 1 month ago
On Tue, 11 Nov 2025 16:21:30 +0100, Philipp Stanner wrote:
>Nope, this is wrong. pcim_iomap_region() returns an ERR_PTR on error,
>not NULL. You need to check it with IS_ERR or similar.

>Sry, late to the party, but just saw this. It was applied already, so
>someone should send a fix. I could, but maybe Madhur can do it faster
>since he's got the branch etc already.

Thank you for pointing it out but the issue if already been fixed by 
Dan Carpenter 
https://lore.kernel.org/all/aQITFDPyuzjNN4GN@stanley.mountain/

--
Madhur Kumar