pci: convert to devm_ioremap_resource()
PATCH v2 1/1 pci: convert to devm_ioremap_resource()
Convert all uses of devm_request_and_ioremap() to the newly introduced devm_ioremap_resource() which provides more consistent error handling.
devm_ioremap_resource() provides its own error messages so all explicit error messages can be removed from the failure code paths.
--- arch/mips/pci/pci-ar71xx.c | 6 +++--- arch/mips/pci/pci-ar724x.c | 18 +++++++++--------- 2 files changed, 12 insertions(+), 12 deletions(-)
arch/mips/pci/pci-ar71xx.c +3 -3
@@ -366,9 +366,9 @@ static int ar71xx_pci_probe(struct platform_device *pdev)if (!res)return -EINVAL ; - apc->cfg_base =devm_request_and_ioremap (&pdev->dev, res); -if (!apc->cfg_base) -return -ENOMEM ; + apc->cfg_base =devm_ioremap_resource (&pdev->dev, res); +if (IS_ERR (apc->cfg_base)) +return PTR_ERR (apc->cfg_base); apc->irq =platform_get_irq (pdev,0 );if (apc->irq <0 )
arch/mips/pci/pci-ar724x.c +9 -9
@@ -365,25 +365,25 @@ static int ar724x_pci_probe(struct platform_device *pdev)if (!res)return -EINVAL ; - apc->ctrl_base =devm_request_and_ioremap (&pdev->dev, res); -if (apc->ctrl_base ==NULL ) -return -EBUSY ; + apc->ctrl_base =devm_ioremap_resource (&pdev->dev, res); +if (IS_ERR (apc->ctrl_base)) +return PTR_ERR (apc->ctrl_base); res =platform_get_resource_byname (pdev,IORESOURCE_MEM ,"cfg_base" );if (!res)return -EINVAL ; - apc->devcfg_base =devm_request_and_ioremap (&pdev->dev, res); -if (!apc->devcfg_base) -return -EBUSY ; + apc->devcfg_base =devm_ioremap_resource (&pdev->dev, res); +if (IS_ERR (apc->devcfg_base)) +return PTR_ERR (apc->devcfg_base); res =platform_get_resource_byname (pdev,IORESOURCE_MEM ,"crp_base" );if (!res)return -EINVAL ; - apc->crp_base =devm_request_and_ioremap (&pdev->dev, res); -if (apc->crp_base ==NULL ) -return -EBUSY ; + apc->crp_base =devm_ioremap_resource (&pdev->dev, res); +if (IS_ERR (apc->crp_base)) +return PTR_ERR (apc->crp_base); apc->irq =platform_get_irq (pdev,0 );if (apc->irq <0 )
Signature · 1 line
1.7.9.5
Hello.
Quoted 5 lines · Silviu-Mihai Popescu
Convert all uses of
devm_request_and_ioremap()to the newly introduceddevm_ioremap_resource()which provides more consistent error handling.
devm_ioremap_resource()provides its own error messages so all explicit error messages can be removed from the failure code paths.
There were no error messages as far as I could see, so this passage seems
superfluous...
Quoted 52 lines
Signed-off-by Silviu-Mihai Popescu <[email protected]>--- arch/mips/pci/pci-ar71xx.c | 6 +++--- arch/mips/pci/pci-ar724x.c | 18 +++++++++--------- 2 files changed, 12 insertions(+), 12 deletions(-)arch/mips/pci/pci-ar71xx.c +3
-3@@ -366,9 +366,9 @@ static int ar71xx_pci_probe(struct platform_device *pdev)if (!res)return -EINVAL ; - apc->cfg_base =devm_request_and_ioremap (&pdev->dev, res); -if (!apc->cfg_base) -return -ENOMEM ; + apc->cfg_base =devm_ioremap_resource (&pdev->dev, res); +if (IS_ERR (apc->cfg_base)) +return PTR_ERR (apc->cfg_base); apc->irq =platform_get_irq (pdev,0 );if (apc->irq <0 )arch/mips/pci/pci-ar724x.c +6
-6@@ -365,25 +365,25 @@ static int ar724x_pci_probe(struct platform_device *pdev)if (!res)return -EINVAL ; - apc->ctrl_base =devm_request_and_ioremap (&pdev->dev, res); -if (apc->ctrl_base ==NULL ) -return -EBUSY ; + apc->ctrl_base =devm_ioremap_resource (&pdev->dev, res); +if (IS_ERR (apc->ctrl_base)) +return PTR_ERR (apc->ctrl_base); res =platform_get_resource_byname (pdev,IORESOURCE_MEM ,"cfg_base" );if (!res)return -EINVAL ; - apc->devcfg_base =devm_request_and_ioremap (&pdev->dev, res); -if (!apc->devcfg_base) -return -EBUSY ; + apc->devcfg_base =devm_ioremap_resource (&pdev->dev, res); +if (IS_ERR (apc->devcfg_base)) +return PTR_ERR (apc->devcfg_base); res =platform_get_resource_byname (pdev,IORESOURCE_MEM ,"crp_base" );if (!res)return -EINVAL ;
arch/mips/pci/pci-ar724x.c static int ar724x_pci_probe(struct platform_device *pdev) · line 389
Quoted 10 lines
arch/mips/pci/pci-ar724x.c +3
-3- apc->crp_base =devm_request_and_ioremap (&pdev->dev, res); -if (apc->crp_base ==NULL ) -return -EBUSY ; + apc->crp_base =devm_ioremap_resource (&pdev->dev, res); +if (IS_ERR (apc->crp_base)) +return PTR_ERR (apc->crp_base); apc->irq =platform_get_irq (pdev,0 );if (apc->irq <0 )
WBR, Sergei
Quoted 9 lines · Sergei Shtylyov
Hello.
Quoted 2 lines · Silviu-Mihai Popescu
Convert all uses of
devm_request_and_ioremap()to the newly introduceddevm_ioremap_resource()which provides more consistent error handling.
Quoted 6 lines
Quoted 2 lines
devm_ioremap_resource()provides its own error messages so all explicit error messages can be removed from the failure code paths.There were no error messages as far as I could see, so this passage seems
superfluous...
Sorry for that, I sent a refreshed version of the patch.
Thanks,
Silviu