* [PATCH v2] crypto: talitos - Use devm_platform_ioremap_resource()
@ 2019-06-06 17:28 Fabio Estevam
2019-06-06 17:45 ` Christophe Leroy
0 siblings, 1 reply; 3+ messages in thread
From: Fabio Estevam @ 2019-06-06 17:28 UTC (permalink / raw)
To: herbert; +Cc: christophe.leroy, linux-crypto, horia.geanta, Fabio Estevam
Use devm_platform_ioremap_resource() to simplify the code a bit.
While at it, remove unneeded error message in case of
devm_platform_ioremap_resource() failure, as the core mm code
will take care of it.
Signed-off-by: Fabio Estevam <festevam@gmail.com>
---
Changes since v1:
- Adjust the error check for devm_platform_ioremap_resource()
- Remove error message on devm_platform_ioremap_resource() failure
drivers/crypto/talitos.c | 11 +++--------
1 file changed, 3 insertions(+), 8 deletions(-)
diff --git a/drivers/crypto/talitos.c b/drivers/crypto/talitos.c
index 32a7e747dc5f..688affec36c9 100644
--- a/drivers/crypto/talitos.c
+++ b/drivers/crypto/talitos.c
@@ -3336,7 +3336,6 @@ static int talitos_probe(struct platform_device *ofdev)
struct talitos_private *priv;
int i, err;
int stride;
- struct resource *res;
priv = devm_kzalloc(dev, sizeof(struct talitos_private), GFP_KERNEL);
if (!priv)
@@ -3350,13 +3349,9 @@ static int talitos_probe(struct platform_device *ofdev)
spin_lock_init(&priv->reg_lock);
- res = platform_get_resource(ofdev, IORESOURCE_MEM, 0);
- if (!res)
- return -ENXIO;
- priv->reg = devm_ioremap(dev, res->start, resource_size(res));
- if (!priv->reg) {
- dev_err(dev, "failed to of_iomap\n");
- err = -ENOMEM;
+ priv->reg = devm_platform_ioremap_resource(ofdev, 0);
+ if (IS_ERR(priv->reg)) {
+ err = PTR_ERR(priv->reg);
goto err_out;
}
--
2.17.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH v2] crypto: talitos - Use devm_platform_ioremap_resource()
2019-06-06 17:28 [PATCH v2] crypto: talitos - Use devm_platform_ioremap_resource() Fabio Estevam
@ 2019-06-06 17:45 ` Christophe Leroy
2019-06-06 17:51 ` Fabio Estevam
0 siblings, 1 reply; 3+ messages in thread
From: Christophe Leroy @ 2019-06-06 17:45 UTC (permalink / raw)
To: Fabio Estevam, herbert; +Cc: linux-crypto, horia.geanta
Le 06/06/2019 à 19:28, Fabio Estevam a écrit :
> Use devm_platform_ioremap_resource() to simplify the code a bit.
>
> While at it, remove unneeded error message in case of
> devm_platform_ioremap_resource() failure, as the core mm code
> will take care of it.
devm_platform_ioremap_resource() doesn't use devm_ioremap() but
devm_ioremap_ressource() which does an devm_request_mem_region() in
addition.
Have you checked that it has no impact ?
On SOCs, areas of memory are often shared between several drivers.
devm_ioremap_ressource() can only be used if we are 100% sure that this
area of memory is not shared with any other driver.
Christophe
>
> Signed-off-by: Fabio Estevam <festevam@gmail.com>
> ---
> Changes since v1:
> - Adjust the error check for devm_platform_ioremap_resource()
> - Remove error message on devm_platform_ioremap_resource() failure
>
> drivers/crypto/talitos.c | 11 +++--------
> 1 file changed, 3 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/crypto/talitos.c b/drivers/crypto/talitos.c
> index 32a7e747dc5f..688affec36c9 100644
> --- a/drivers/crypto/talitos.c
> +++ b/drivers/crypto/talitos.c
> @@ -3336,7 +3336,6 @@ static int talitos_probe(struct platform_device *ofdev)
> struct talitos_private *priv;
> int i, err;
> int stride;
> - struct resource *res;
>
> priv = devm_kzalloc(dev, sizeof(struct talitos_private), GFP_KERNEL);
> if (!priv)
> @@ -3350,13 +3349,9 @@ static int talitos_probe(struct platform_device *ofdev)
>
> spin_lock_init(&priv->reg_lock);
>
> - res = platform_get_resource(ofdev, IORESOURCE_MEM, 0);
> - if (!res)
> - return -ENXIO;
> - priv->reg = devm_ioremap(dev, res->start, resource_size(res));
> - if (!priv->reg) {
> - dev_err(dev, "failed to of_iomap\n");
> - err = -ENOMEM;
> + priv->reg = devm_platform_ioremap_resource(ofdev, 0);
> + if (IS_ERR(priv->reg)) {
> + err = PTR_ERR(priv->reg);
> goto err_out;
> }
>
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v2] crypto: talitos - Use devm_platform_ioremap_resource()
2019-06-06 17:45 ` Christophe Leroy
@ 2019-06-06 17:51 ` Fabio Estevam
0 siblings, 0 replies; 3+ messages in thread
From: Fabio Estevam @ 2019-06-06 17:51 UTC (permalink / raw)
To: Christophe Leroy
Cc: Herbert Xu, open list:HARDWARE RANDOM NUMBER GENERATOR CORE,
Horia Geanta Neag
Hi Christophe,
On Thu, Jun 6, 2019 at 2:45 PM Christophe Leroy <christophe.leroy@c-s.fr> wrote:
> Have you checked that it has no impact ?
>
> On SOCs, areas of memory are often shared between several drivers.
> devm_ioremap_ressource() can only be used if we are 100% sure that this
> area of memory is not shared with any other driver.
Thanks for the clarification. I think we should stay on the safe side
and discard this patch then.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-06-06 17:51 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-06 17:28 [PATCH v2] crypto: talitos - Use devm_platform_ioremap_resource() Fabio Estevam
2019-06-06 17:45 ` Christophe Leroy
2019-06-06 17:51 ` Fabio Estevam
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.