* [PATCH 1/2] hwrng: atmel - Use devm_ioremap_resource()
@ 2014-02-12 5:17 Jingoo Han
2014-02-12 5:19 ` [PATCH 2/2] hwrng: pixocell " Jingoo Han
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: Jingoo Han @ 2014-02-12 5:17 UTC (permalink / raw)
To: 'Herbert Xu'
Cc: linux-kernel, 'Nicolas Ferre', 'Peter Korsgaard',
'Jingoo Han'
Use devm_ioremap_resource() in order to make the code simpler,
and remove redundant return value check of platform_get_resource()
because the value is checked by devm_ioremap_resource().
Signed-off-by: Jingoo Han <jg1.han@samsung.com>
---
drivers/char/hw_random/atmel-rng.c | 15 ++++-----------
1 file changed, 4 insertions(+), 11 deletions(-)
diff --git a/drivers/char/hw_random/atmel-rng.c b/drivers/char/hw_random/atmel-rng.c
index bf9fc6b..dfeddf2 100644
--- a/drivers/char/hw_random/atmel-rng.c
+++ b/drivers/char/hw_random/atmel-rng.c
@@ -54,21 +54,14 @@ static int atmel_trng_probe(struct platform_device *pdev)
struct resource *res;
int ret;
- res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
- if (!res)
- return -EINVAL;
-
trng = devm_kzalloc(&pdev->dev, sizeof(*trng), GFP_KERNEL);
if (!trng)
return -ENOMEM;
- if (!devm_request_mem_region(&pdev->dev, res->start,
- resource_size(res), pdev->name))
- return -EBUSY;
-
- trng->base = devm_ioremap(&pdev->dev, res->start, resource_size(res));
- if (!trng->base)
- return -EBUSY;
+ res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+ trng->base = devm_ioremap_resource(&pdev->dev, res);
+ if (IS_ERR(trng->base))
+ return PTR_ERR(trng->base);
trng->clk = clk_get(&pdev->dev, NULL);
if (IS_ERR(trng->clk))
--
1.7.10.4
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 2/2] hwrng: pixocell - Use devm_ioremap_resource()
2014-02-12 5:17 [PATCH 1/2] hwrng: atmel - Use devm_ioremap_resource() Jingoo Han
@ 2014-02-12 5:19 ` Jingoo Han
2014-02-12 7:46 ` [PATCH 1/2] hwrng: atmel " Peter Korsgaard
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Jingoo Han @ 2014-02-12 5:19 UTC (permalink / raw)
To: 'Herbert Xu'
Cc: linux-kernel, 'Jamie Iles', 'Jingoo Han'
Use devm_ioremap_resource() in order to make the code simpler,
and remove redundant return value check of platform_get_resource()
because the value is checked by devm_ioremap_resource().
Signed-off-by: Jingoo Han <jg1.han@samsung.com>
---
drivers/char/hw_random/picoxcell-rng.c | 19 +++----------------
1 file changed, 3 insertions(+), 16 deletions(-)
diff --git a/drivers/char/hw_random/picoxcell-rng.c b/drivers/char/hw_random/picoxcell-rng.c
index 3d4c229..c03beee 100644
--- a/drivers/char/hw_random/picoxcell-rng.c
+++ b/drivers/char/hw_random/picoxcell-rng.c
@@ -104,22 +104,9 @@ static int picoxcell_trng_probe(struct platform_device *pdev)
int ret;
struct resource *mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
- if (!mem) {
- dev_warn(&pdev->dev, "no memory resource\n");
- return -ENOMEM;
- }
-
- if (!devm_request_mem_region(&pdev->dev, mem->start, resource_size(mem),
- "picoxcell_trng")) {
- dev_warn(&pdev->dev, "unable to request io mem\n");
- return -EBUSY;
- }
-
- rng_base = devm_ioremap(&pdev->dev, mem->start, resource_size(mem));
- if (!rng_base) {
- dev_warn(&pdev->dev, "unable to remap io mem\n");
- return -ENOMEM;
- }
+ rng_base = devm_ioremap_resource(&pdev->dev, mem);
+ if (IS_ERR(rng_base))
+ return PTR_ERR(rng_base);
rng_clk = clk_get(&pdev->dev, NULL);
if (IS_ERR(rng_clk)) {
--
1.7.10.4
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH 1/2] hwrng: atmel - Use devm_ioremap_resource()
2014-02-12 5:17 [PATCH 1/2] hwrng: atmel - Use devm_ioremap_resource() Jingoo Han
2014-02-12 5:19 ` [PATCH 2/2] hwrng: pixocell " Jingoo Han
@ 2014-02-12 7:46 ` Peter Korsgaard
2014-02-12 8:12 ` Nicolas Ferre
2014-02-25 12:17 ` Herbert Xu
3 siblings, 0 replies; 5+ messages in thread
From: Peter Korsgaard @ 2014-02-12 7:46 UTC (permalink / raw)
To: Jingoo Han
Cc: 'Herbert Xu', linux-kernel, 'Nicolas Ferre',
'Peter Korsgaard'
>>>>> "Jingoo" == Jingoo Han <jg1.han@samsung.com> writes:
> Use devm_ioremap_resource() in order to make the code simpler,
> and remove redundant return value check of platform_get_resource()
> because the value is checked by devm_ioremap_resource().
> Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Acked-by: Peter Korsgaard <jacmet@sunsite.dk>
> ---
> drivers/char/hw_random/atmel-rng.c | 15 ++++-----------
> 1 file changed, 4 insertions(+), 11 deletions(-)
> diff --git a/drivers/char/hw_random/atmel-rng.c b/drivers/char/hw_random/atmel-rng.c
> index bf9fc6b..dfeddf2 100644
> --- a/drivers/char/hw_random/atmel-rng.c
> +++ b/drivers/char/hw_random/atmel-rng.c
> @@ -54,21 +54,14 @@ static int atmel_trng_probe(struct platform_device *pdev)
> struct resource *res;
> int ret;
> - res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> - if (!res)
> - return -EINVAL;
> -
> trng = devm_kzalloc(&pdev->dev, sizeof(*trng), GFP_KERNEL);
> if (!trng)
> return -ENOMEM;
> - if (!devm_request_mem_region(&pdev->dev, res->start,
> - resource_size(res), pdev->name))
> - return -EBUSY;
> -
> - trng->base = devm_ioremap(&pdev->dev, res->start, resource_size(res));
> - if (!trng->base)
> - return -EBUSY;
> + res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> + trng->base = devm_ioremap_resource(&pdev->dev, res);
> + if (IS_ERR(trng->base))
> + return PTR_ERR(trng->base);
trng-> clk = clk_get(&pdev->dev, NULL);
> if (IS_ERR(trng->clk))
> --
> 1.7.10.4
--
Bye, Peter Korsgaard
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 1/2] hwrng: atmel - Use devm_ioremap_resource()
2014-02-12 5:17 [PATCH 1/2] hwrng: atmel - Use devm_ioremap_resource() Jingoo Han
2014-02-12 5:19 ` [PATCH 2/2] hwrng: pixocell " Jingoo Han
2014-02-12 7:46 ` [PATCH 1/2] hwrng: atmel " Peter Korsgaard
@ 2014-02-12 8:12 ` Nicolas Ferre
2014-02-25 12:17 ` Herbert Xu
3 siblings, 0 replies; 5+ messages in thread
From: Nicolas Ferre @ 2014-02-12 8:12 UTC (permalink / raw)
To: Jingoo Han, 'Herbert Xu'; +Cc: linux-kernel, 'Peter Korsgaard'
On 12/02/2014 06:17, Jingoo Han :
> Use devm_ioremap_resource() in order to make the code simpler,
> and remove redundant return value check of platform_get_resource()
> because the value is checked by devm_ioremap_resource().
>
> Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com>
Thanks! Bye,
> ---
> drivers/char/hw_random/atmel-rng.c | 15 ++++-----------
> 1 file changed, 4 insertions(+), 11 deletions(-)
>
> diff --git a/drivers/char/hw_random/atmel-rng.c b/drivers/char/hw_random/atmel-rng.c
> index bf9fc6b..dfeddf2 100644
> --- a/drivers/char/hw_random/atmel-rng.c
> +++ b/drivers/char/hw_random/atmel-rng.c
> @@ -54,21 +54,14 @@ static int atmel_trng_probe(struct platform_device *pdev)
> struct resource *res;
> int ret;
>
> - res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> - if (!res)
> - return -EINVAL;
> -
> trng = devm_kzalloc(&pdev->dev, sizeof(*trng), GFP_KERNEL);
> if (!trng)
> return -ENOMEM;
>
> - if (!devm_request_mem_region(&pdev->dev, res->start,
> - resource_size(res), pdev->name))
> - return -EBUSY;
> -
> - trng->base = devm_ioremap(&pdev->dev, res->start, resource_size(res));
> - if (!trng->base)
> - return -EBUSY;
> + res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> + trng->base = devm_ioremap_resource(&pdev->dev, res);
> + if (IS_ERR(trng->base))
> + return PTR_ERR(trng->base);
>
> trng->clk = clk_get(&pdev->dev, NULL);
> if (IS_ERR(trng->clk))
>
--
Nicolas Ferre
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 1/2] hwrng: atmel - Use devm_ioremap_resource()
2014-02-12 5:17 [PATCH 1/2] hwrng: atmel - Use devm_ioremap_resource() Jingoo Han
` (2 preceding siblings ...)
2014-02-12 8:12 ` Nicolas Ferre
@ 2014-02-25 12:17 ` Herbert Xu
3 siblings, 0 replies; 5+ messages in thread
From: Herbert Xu @ 2014-02-25 12:17 UTC (permalink / raw)
To: Jingoo Han
Cc: linux-kernel, 'Nicolas Ferre', 'Peter Korsgaard'
On Wed, Feb 12, 2014 at 02:17:08PM +0900, Jingoo Han wrote:
> Use devm_ioremap_resource() in order to make the code simpler,
> and remove redundant return value check of platform_get_resource()
> because the value is checked by devm_ioremap_resource().
>
> Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Both patches applied.
--
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2014-02-25 12:17 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-02-12 5:17 [PATCH 1/2] hwrng: atmel - Use devm_ioremap_resource() Jingoo Han
2014-02-12 5:19 ` [PATCH 2/2] hwrng: pixocell " Jingoo Han
2014-02-12 7:46 ` [PATCH 1/2] hwrng: atmel " Peter Korsgaard
2014-02-12 8:12 ` Nicolas Ferre
2014-02-25 12:17 ` Herbert Xu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox