All of lore.kernel.org
 help / color / mirror / Atom feed
From: Will Deacon <will.deacon@arm.com>
To: linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH 3/7] iommu/arm: replace devm_request_and_ioremap by devm_ioremap_resource
Date: Tue, 20 Aug 2013 11:35:03 +0000	[thread overview]
Message-ID: <20130820113503.GC23007@mudshark.cambridge.arm.com> (raw)
In-Reply-To: <1376911241-27720-4-git-send-email-Julia.Lawall@lip6.fr>

Hi Julia,

On Mon, Aug 19, 2013 at 12:20:37PM +0100, Julia Lawall wrote:
> From: Julia Lawall <Julia.Lawall@lip6.fr>
> 
> Use devm_ioremap_resource instead of devm_request_and_ioremap.
> 
> This was partly done using the semantic patch
> scripts/coccinelle/api/devm_ioremap_resource.cocci
> 
> The error-handling code on the call to platform_get_resource was removed
> manually, and the initialization of smmu->size was manually moved lower, to
> take advantage of the NULL test on res performed by devm_ioremap_resource.
> 
> Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
> 
> ---
>  drivers/iommu/arm-smmu.c |   11 +++--------
>  1 file changed, 3 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/iommu/arm-smmu.c b/drivers/iommu/arm-smmu.c
> index ebd0a4c..dd91465 100644
> --- a/drivers/iommu/arm-smmu.c
> +++ b/drivers/iommu/arm-smmu.c
> @@ -1761,15 +1761,10 @@ static int arm_smmu_device_dt_probe(struct platform_device *pdev)
>  	smmu->dev = dev;
>  
>  	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> -	if (!res) {
> -		dev_err(dev, "missing base address/size\n");
> -		return -ENODEV;
> -	}
> -
> +	smmu->base = devm_ioremap_resource(dev, res);
> +	if (IS_ERR(smmu->base))
> +		return PTR_ERR(smmu->base);
>  	smmu->size = resource_size(res);
> -	smmu->base = devm_request_and_ioremap(dev, res);
> -	if (!smmu->base)
> -		return -EADDRNOTAVAIL;

This does mean we trade arguably more useful error codes for the catch-all
-EINVAL, but the code ends up looking neater so I can be swayed either way.

Is this part of a series you're dealing with, or would you like me to take
this (I already sent my SMMU patches for 3.12)?

Cheers,

Will

WARNING: multiple messages have this Message-ID (diff)
From: will.deacon@arm.com (Will Deacon)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 3/7] iommu/arm: replace devm_request_and_ioremap by devm_ioremap_resource
Date: Tue, 20 Aug 2013 12:35:03 +0100	[thread overview]
Message-ID: <20130820113503.GC23007@mudshark.cambridge.arm.com> (raw)
In-Reply-To: <1376911241-27720-4-git-send-email-Julia.Lawall@lip6.fr>

Hi Julia,

On Mon, Aug 19, 2013 at 12:20:37PM +0100, Julia Lawall wrote:
> From: Julia Lawall <Julia.Lawall@lip6.fr>
> 
> Use devm_ioremap_resource instead of devm_request_and_ioremap.
> 
> This was partly done using the semantic patch
> scripts/coccinelle/api/devm_ioremap_resource.cocci
> 
> The error-handling code on the call to platform_get_resource was removed
> manually, and the initialization of smmu->size was manually moved lower, to
> take advantage of the NULL test on res performed by devm_ioremap_resource.
> 
> Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
> 
> ---
>  drivers/iommu/arm-smmu.c |   11 +++--------
>  1 file changed, 3 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/iommu/arm-smmu.c b/drivers/iommu/arm-smmu.c
> index ebd0a4c..dd91465 100644
> --- a/drivers/iommu/arm-smmu.c
> +++ b/drivers/iommu/arm-smmu.c
> @@ -1761,15 +1761,10 @@ static int arm_smmu_device_dt_probe(struct platform_device *pdev)
>  	smmu->dev = dev;
>  
>  	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> -	if (!res) {
> -		dev_err(dev, "missing base address/size\n");
> -		return -ENODEV;
> -	}
> -
> +	smmu->base = devm_ioremap_resource(dev, res);
> +	if (IS_ERR(smmu->base))
> +		return PTR_ERR(smmu->base);
>  	smmu->size = resource_size(res);
> -	smmu->base = devm_request_and_ioremap(dev, res);
> -	if (!smmu->base)
> -		return -EADDRNOTAVAIL;

This does mean we trade arguably more useful error codes for the catch-all
-EINVAL, but the code ends up looking neater so I can be swayed either way.

Is this part of a series you're dealing with, or would you like me to take
this (I already sent my SMMU patches for 3.12)?

Cheers,

Will

WARNING: multiple messages have this Message-ID (diff)
From: Will Deacon <will.deacon@arm.com>
To: Julia Lawall <Julia.Lawall@lip6.fr>
Cc: "kernel-janitors@vger.kernel.org"
	<kernel-janitors@vger.kernel.org>,
	"linux-arm-kernel@lists.infradead.org" 
	<linux-arm-kernel@lists.infradead.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 3/7] iommu/arm: replace devm_request_and_ioremap by devm_ioremap_resource
Date: Tue, 20 Aug 2013 12:35:03 +0100	[thread overview]
Message-ID: <20130820113503.GC23007@mudshark.cambridge.arm.com> (raw)
In-Reply-To: <1376911241-27720-4-git-send-email-Julia.Lawall@lip6.fr>

Hi Julia,

On Mon, Aug 19, 2013 at 12:20:37PM +0100, Julia Lawall wrote:
> From: Julia Lawall <Julia.Lawall@lip6.fr>
> 
> Use devm_ioremap_resource instead of devm_request_and_ioremap.
> 
> This was partly done using the semantic patch
> scripts/coccinelle/api/devm_ioremap_resource.cocci
> 
> The error-handling code on the call to platform_get_resource was removed
> manually, and the initialization of smmu->size was manually moved lower, to
> take advantage of the NULL test on res performed by devm_ioremap_resource.
> 
> Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
> 
> ---
>  drivers/iommu/arm-smmu.c |   11 +++--------
>  1 file changed, 3 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/iommu/arm-smmu.c b/drivers/iommu/arm-smmu.c
> index ebd0a4c..dd91465 100644
> --- a/drivers/iommu/arm-smmu.c
> +++ b/drivers/iommu/arm-smmu.c
> @@ -1761,15 +1761,10 @@ static int arm_smmu_device_dt_probe(struct platform_device *pdev)
>  	smmu->dev = dev;
>  
>  	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> -	if (!res) {
> -		dev_err(dev, "missing base address/size\n");
> -		return -ENODEV;
> -	}
> -
> +	smmu->base = devm_ioremap_resource(dev, res);
> +	if (IS_ERR(smmu->base))
> +		return PTR_ERR(smmu->base);
>  	smmu->size = resource_size(res);
> -	smmu->base = devm_request_and_ioremap(dev, res);
> -	if (!smmu->base)
> -		return -EADDRNOTAVAIL;

This does mean we trade arguably more useful error codes for the catch-all
-EINVAL, but the code ends up looking neater so I can be swayed either way.

Is this part of a series you're dealing with, or would you like me to take
this (I already sent my SMMU patches for 3.12)?

Cheers,

Will

  reply	other threads:[~2013-08-20 11:35 UTC|newest]

Thread overview: 80+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-19 11:20 [PATCH 0/7] replace devm_request_and_ioremap by devm_ioremap_resource Julia Lawall
2013-08-19 11:20 ` Julia Lawall
2013-08-19 11:20 ` Julia Lawall
2013-08-19 11:20 ` [PATCH 1/7] PCI: tegra: " Julia Lawall
2013-08-19 11:20   ` Julia Lawall
2013-08-19 12:02   ` Thierry Reding
2013-08-19 12:02     ` Thierry Reding
2013-08-19 12:07     ` Julia Lawall
2013-08-19 12:07       ` Julia Lawall
2013-08-19 12:07       ` Julia Lawall
2013-08-19 12:12       ` Thierry Reding
2013-08-19 12:12         ` Thierry Reding
2013-08-19 12:15         ` Julia Lawall
2013-08-19 12:15           ` Julia Lawall
2013-08-19 12:15           ` Julia Lawall
2013-08-19 19:33           ` Thierry Reding
2013-08-19 19:33             ` Thierry Reding
2013-08-19 19:33             ` Thierry Reding
2013-08-19 20:56             ` Stephen Warren
2013-08-19 20:56               ` Stephen Warren
2013-08-19 20:56               ` Stephen Warren
2013-08-20  9:13             ` Julia Lawall
2013-08-20  9:13               ` Julia Lawall
2013-08-20  9:13               ` Julia Lawall
2013-08-20 16:26               ` Bjorn Helgaas
2013-08-20 16:26                 ` Bjorn Helgaas
2013-08-20 16:26                 ` Bjorn Helgaas
2013-08-20 18:53                 ` Stephen Warren
2013-08-20 18:53                   ` Stephen Warren
2013-08-20 19:31                   ` Thierry Reding
2013-08-20 19:31                     ` Thierry Reding
2013-08-20 19:31                     ` Thierry Reding
2013-08-19 20:04     ` Bjorn Helgaas
2013-08-19 20:04       ` Bjorn Helgaas
2013-08-19 20:12       ` Thierry Reding
2013-08-19 20:12         ` Thierry Reding
2013-08-19 20:49         ` Bjorn Helgaas
2013-08-19 20:49           ` Bjorn Helgaas
2013-08-19 20:49           ` Bjorn Helgaas
2013-08-27  8:14           ` Thierry Reding
2013-08-27  8:14             ` Thierry Reding
2013-08-27 16:11             ` Stephen Warren
2013-08-27 16:11               ` Stephen Warren
2013-08-27 16:11               ` Stephen Warren
2013-08-27 18:03               ` Bjorn Helgaas
2013-08-27 18:03                 ` Bjorn Helgaas
2013-08-27 18:03                 ` Bjorn Helgaas
2013-08-28 13:02                 ` Bjorn Helgaas
2013-08-28 13:02                   ` Bjorn Helgaas
2013-08-28 13:27                   ` Thierry Reding
2013-08-28 13:27                     ` Thierry Reding
2013-08-28 13:27                     ` Thierry Reding
2013-08-28 13:31                 ` Thierry Reding
2013-08-28 13:31                   ` Thierry Reding
2013-08-28 13:31                   ` Thierry Reding
2013-08-19 11:20 ` [PATCH 2/7] serial: st-asc: " Julia Lawall
2013-08-19 11:20   ` Julia Lawall
2013-08-19 11:20 ` [PATCH 3/7] iommu/arm: " Julia Lawall
2013-08-19 11:20   ` Julia Lawall
2013-08-19 11:20   ` Julia Lawall
2013-08-20 11:35   ` Will Deacon [this message]
2013-08-20 11:35     ` Will Deacon
2013-08-20 11:35     ` Will Deacon
2013-08-20 11:49     ` Julia Lawall
2013-08-20 11:49       ` Julia Lawall
2013-08-20 11:49       ` Julia Lawall
2013-08-19 11:20 ` [PATCH 4/7] dma: " Julia Lawall
2013-08-19 11:20   ` Julia Lawall
2013-09-02 12:07   ` Vinod Koul
2013-09-02 12:19     ` Vinod Koul
2013-08-19 11:20 ` [PATCH 5/7] bcm63xx_enet: " Julia Lawall
2013-08-19 11:20   ` Julia Lawall
2013-08-21  6:22   ` David Miller
2013-08-21  6:22     ` David Miller
2013-08-19 11:20 ` [PATCH 6/7] video: xilinxfb: " Julia Lawall
2013-08-19 11:20   ` Julia Lawall
2013-08-30  9:42   ` Tomi Valkeinen
2013-08-30  9:42     ` Tomi Valkeinen
2013-08-19 11:20 ` [PATCH 7/7] mmc: mvsdio: " Julia Lawall
2013-08-19 11:20   ` Julia Lawall

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20130820113503.GC23007@mudshark.cambridge.arm.com \
    --to=will.deacon@arm.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.