Patchwork drivers: net: ethernet: broadcom: bcm63xx: use devm_ioremap_resource()

login
register
mail settings
Submitter Laurent Navet
Date May 12, 2013, 3:56 p.m.
Message ID <1368374165-3228-1-git-send-email-laurent.navet@gmail.com>
Download mbox | patch
Permalink /patch/243189/
State Changes Requested
Delegated to: David Miller
Headers show

Comments

Laurent Navet - May 12, 2013, 3:53 p.m.
Please, don't take this one

I'll send a more complete one later,
Sorry,

2013/5/12, Laurent Navet <laurent.navet@gmail.com>:
> Replace a call to deprecated devm_request_and_ioremap by
> devm_ioremap_resource.
>
> Found with coccicheck and this semantic patch:
>  scripts/coccinelle/api/devm_ioremap_resource.cocci
>
> Signed-off-by: Laurent Navet <laurent.navet@gmail.com>
> ---
>  drivers/net/ethernet/broadcom/bcm63xx_enet.c |    6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/net/ethernet/broadcom/bcm63xx_enet.c
> b/drivers/net/ethernet/broadcom/bcm63xx_enet.c
> index 0b3e23e..9de4217 100644
> --- a/drivers/net/ethernet/broadcom/bcm63xx_enet.c
> +++ b/drivers/net/ethernet/broadcom/bcm63xx_enet.c
> @@ -1641,9 +1641,9 @@ static int bcm_enet_probe(struct platform_device
> *pdev)
>  	if (ret)
>  		goto out;
>
> -	priv->base = devm_request_and_ioremap(&pdev->dev, res_mem);
> -	if (priv->base == NULL) {
> -		ret = -ENOMEM;
> +	priv->base = devm_ioremap_resource(&pdev->dev, res_mem);
> +	if (IS_ERR(priv->base)) {
> +		ret = PTR_ERR(priv->base);
>  		goto out;
>  	}
>
> --
> 1.7.10.4
>
>
Laurent Navet - May 12, 2013, 3:56 p.m.
Replace a call to deprecated devm_request_and_ioremap by devm_ioremap_resource.

Found with coccicheck and this semantic patch:
 scripts/coccinelle/api/devm_ioremap_resource.cocci

Signed-off-by: Laurent Navet <laurent.navet@gmail.com>
---
 drivers/net/ethernet/broadcom/bcm63xx_enet.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
Sergei Shtylyov - May 12, 2013, 6:38 p.m.
Hello.

On 05/12/2013 07:56 PM, Laurent Navet wrote:

> Replace a call to deprecated devm_request_and_ioremap by devm_ioremap_resource.
>
> Found with coccicheck and this semantic patch:
>   scripts/coccinelle/api/devm_ioremap_resource.cocci
>
> Signed-off-by: Laurent Navet <laurent.navet@gmail.com>
> ---
>   drivers/net/ethernet/broadcom/bcm63xx_enet.c |    6 +++---
>   1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/net/ethernet/broadcom/bcm63xx_enet.c b/drivers/net/ethernet/broadcom/bcm63xx_enet.c
> index 0b3e23e..9de4217 100644
> --- a/drivers/net/ethernet/broadcom/bcm63xx_enet.c
> +++ b/drivers/net/ethernet/broadcom/bcm63xx_enet.c
> @@ -1641,9 +1641,9 @@ static int bcm_enet_probe(struct platform_device *pdev)
>   	if (ret)
>   		goto out;
>   
> -	priv->base = devm_request_and_ioremap(&pdev->dev, res_mem);
> -	if (priv->base == NULL) {
> -		ret = -ENOMEM;
> +	priv->base = devm_ioremap_resource(&pdev->dev, res_mem);
> +	if (IS_ERR(priv->base)) {
> +		ret = PTR_ERR(priv->base);
>   		goto out;
>   	}
>

    You may as well delete a check for 'res_mem' being NULL above 
alloc_etherdev()
call since devm_ioremap_resource() checks for that too.

WBR, Sergei

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch

diff --git a/drivers/net/ethernet/broadcom/bcm63xx_enet.c b/drivers/net/ethernet/broadcom/bcm63xx_enet.c
index 0b3e23e..9de4217 100644
--- a/drivers/net/ethernet/broadcom/bcm63xx_enet.c
+++ b/drivers/net/ethernet/broadcom/bcm63xx_enet.c
@@ -1641,9 +1641,9 @@  static int bcm_enet_probe(struct platform_device *pdev)
 	if (ret)
 		goto out;
 
-	priv->base = devm_request_and_ioremap(&pdev->dev, res_mem);
-	if (priv->base == NULL) {
-		ret = -ENOMEM;
+	priv->base = devm_ioremap_resource(&pdev->dev, res_mem);
+	if (IS_ERR(priv->base)) {
+		ret = PTR_ERR(priv->base);
 		goto out;
 	}