2019-08-03 02:38:51

by Yue Haibing

[permalink] [raw]
Subject: [PATCH -next 00/12] crypto: use devm_platform_ioremap_resource() to simplify code

devm_platform_ioremap_resource() internally have platform_get_resource()
and devm_ioremap_resource() in it. So instead of calling them separately
use devm_platform_ioremap_resource() directly.

YueHaibing (12):
crypto: artpec6 - use devm_platform_ioremap_resource() to simplify
code
crypto: ccp - use devm_platform_ioremap_resource() to simplify code
crypto: exynos - use devm_platform_ioremap_resource() to simplify code
crypto: img-hash - use devm_platform_ioremap_resource() to simplify
code
crypto: inside-secure - use devm_platform_ioremap_resource() to
simplify code
crypto: mediatek - use devm_platform_ioremap_resource() to simplify
code
crypto: picoxcell - use devm_platform_ioremap_resource() to simplify
code
crypto: sunxi-ss - use devm_platform_ioremap_resource() to simplify
code
crypto: rockchip - use devm_platform_ioremap_resource() to simplify
code
crypto: stm32 - use devm_platform_ioremap_resource() to simplify code
crypto: qce - use devm_platform_ioremap_resource() to simplify code
crypto: qcom-rng - use devm_platform_ioremap_resource() to simplify
code

drivers/crypto/axis/artpec6_crypto.c | 4 +---
drivers/crypto/ccp/sp-platform.c | 4 +---
drivers/crypto/exynos-rng.c | 4 +---
drivers/crypto/img-hash.c | 4 +---
drivers/crypto/inside-secure/safexcel.c | 4 +---
drivers/crypto/mediatek/mtk-platform.c | 3 +--
drivers/crypto/picoxcell_crypto.c | 5 ++---
drivers/crypto/qce/core.c | 4 +---
drivers/crypto/qcom-rng.c | 4 +---
drivers/crypto/rockchip/rk3288_crypto.c | 4 +---
drivers/crypto/stm32/stm32-crc32.c | 4 +---
drivers/crypto/stm32/stm32-cryp.c | 4 +---
drivers/crypto/sunxi-ss/sun4i-ss-core.c | 4 +---
13 files changed, 14 insertions(+), 38 deletions(-)

--
2.7.4



2019-08-03 02:41:00

by Yue Haibing

[permalink] [raw]
Subject: [PATCH -next 02/12] crypto: ccp - use devm_platform_ioremap_resource() to simplify code

Use devm_platform_ioremap_resource() to simplify the code a bit.
This is detected by coccinelle.

Reported-by: Hulk Robot <[email protected]>
Signed-off-by: YueHaibing <[email protected]>
---
drivers/crypto/ccp/sp-platform.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/crypto/ccp/sp-platform.c b/drivers/crypto/ccp/sp-platform.c
index 1b45236..831aac1 100644
--- a/drivers/crypto/ccp/sp-platform.c
+++ b/drivers/crypto/ccp/sp-platform.c
@@ -125,7 +125,6 @@ static int sp_platform_probe(struct platform_device *pdev)
struct sp_platform *sp_platform;
struct device *dev = &pdev->dev;
enum dev_dma_attr attr;
- struct resource *ior;
int ret;

ret = -ENOMEM;
@@ -146,8 +145,7 @@ static int sp_platform_probe(struct platform_device *pdev)
goto e_err;
}

- ior = platform_get_resource(pdev, IORESOURCE_MEM, 0);
- sp->io_map = devm_ioremap_resource(dev, ior);
+ sp->io_map = devm_platform_ioremap_resource(pdev, 0);
if (IS_ERR(sp->io_map)) {
ret = PTR_ERR(sp->io_map);
goto e_err;
--
2.7.4


2019-08-03 02:42:58

by Yue Haibing

[permalink] [raw]
Subject: [PATCH -next 04/12] crypto: img-hash - use devm_platform_ioremap_resource() to simplify code

Use devm_platform_ioremap_resource() to simplify the code a bit.
This is detected by coccinelle.

Reported-by: Hulk Robot <[email protected]>
Signed-off-by: YueHaibing <[email protected]>
---
drivers/crypto/img-hash.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/crypto/img-hash.c b/drivers/crypto/img-hash.c
index d27c812..f5a71fa 100644
--- a/drivers/crypto/img-hash.c
+++ b/drivers/crypto/img-hash.c
@@ -958,9 +958,7 @@ static int img_hash_probe(struct platform_device *pdev)
crypto_init_queue(&hdev->queue, IMG_HASH_QUEUE_LENGTH);

/* Register bank */
- hash_res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-
- hdev->io_base = devm_ioremap_resource(dev, hash_res);
+ hdev->io_base = devm_platform_ioremap_resource(pdev, 0);
if (IS_ERR(hdev->io_base)) {
err = PTR_ERR(hdev->io_base);
dev_err(dev, "can't ioremap, returned %d\n", err);
--
2.7.4


2019-08-03 02:43:27

by Yue Haibing

[permalink] [raw]
Subject: [PATCH -next 07/12] crypto: picoxcell - use devm_platform_ioremap_resource() to simplify code

Use devm_platform_ioremap_resource() to simplify the code a bit.
This is detected by coccinelle.

Reported-by: Hulk Robot <[email protected]>
Signed-off-by: YueHaibing <[email protected]>
---
drivers/crypto/picoxcell_crypto.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/crypto/picoxcell_crypto.c b/drivers/crypto/picoxcell_crypto.c
index b985cb85..9a939b4 100644
--- a/drivers/crypto/picoxcell_crypto.c
+++ b/drivers/crypto/picoxcell_crypto.c
@@ -1624,7 +1624,7 @@ MODULE_DEVICE_TABLE(of, spacc_of_id_table);
static int spacc_probe(struct platform_device *pdev)
{
int i, err, ret;
- struct resource *mem, *irq;
+ struct resource *irq;
struct device_node *np = pdev->dev.of_node;
struct spacc_engine *engine = devm_kzalloc(&pdev->dev, sizeof(*engine),
GFP_KERNEL);
@@ -1653,8 +1653,7 @@ static int spacc_probe(struct platform_device *pdev)

engine->name = dev_name(&pdev->dev);

- mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
- engine->regs = devm_ioremap_resource(&pdev->dev, mem);
+ engine->regs = devm_platform_ioremap_resource(pdev, 0);
if (IS_ERR(engine->regs))
return PTR_ERR(engine->regs);

--
2.7.4


2019-08-03 02:45:35

by Yue Haibing

[permalink] [raw]
Subject: [PATCH -next 08/12] crypto: sunxi-ss - use devm_platform_ioremap_resource() to simplify code

Use devm_platform_ioremap_resource() to simplify the code a bit.
This is detected by coccinelle.

Reported-by: Hulk Robot <[email protected]>
Signed-off-by: YueHaibing <[email protected]>
---
drivers/crypto/sunxi-ss/sun4i-ss-core.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/crypto/sunxi-ss/sun4i-ss-core.c b/drivers/crypto/sunxi-ss/sun4i-ss-core.c
index 2e87042..9aa6fe0 100644
--- a/drivers/crypto/sunxi-ss/sun4i-ss-core.c
+++ b/drivers/crypto/sunxi-ss/sun4i-ss-core.c
@@ -225,7 +225,6 @@ static struct sun4i_ss_alg_template ss_algs[] = {

static int sun4i_ss_probe(struct platform_device *pdev)
{
- struct resource *res;
u32 v;
int err, i;
unsigned long cr;
@@ -240,8 +239,7 @@ static int sun4i_ss_probe(struct platform_device *pdev)
if (!ss)
return -ENOMEM;

- res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
- ss->base = devm_ioremap_resource(&pdev->dev, res);
+ ss->base = devm_platform_ioremap_resource(pdev, 0);
if (IS_ERR(ss->base)) {
dev_err(&pdev->dev, "Cannot request MMIO\n");
return PTR_ERR(ss->base);
--
2.7.4


2019-08-03 02:47:20

by Yue Haibing

[permalink] [raw]
Subject: [PATCH -next 10/12] crypto: stm32 - use devm_platform_ioremap_resource() to simplify code

Use devm_platform_ioremap_resource() to simplify the code a bit.
This is detected by coccinelle.

Reported-by: Hulk Robot <[email protected]>
Signed-off-by: YueHaibing <[email protected]>
---
drivers/crypto/stm32/stm32-crc32.c | 4 +---
drivers/crypto/stm32/stm32-cryp.c | 4 +---
2 files changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/crypto/stm32/stm32-crc32.c b/drivers/crypto/stm32/stm32-crc32.c
index 440c9f1..9e11c34 100644
--- a/drivers/crypto/stm32/stm32-crc32.c
+++ b/drivers/crypto/stm32/stm32-crc32.c
@@ -255,7 +255,6 @@ static int stm32_crc_probe(struct platform_device *pdev)
{
struct device *dev = &pdev->dev;
struct stm32_crc *crc;
- struct resource *res;
int ret;

crc = devm_kzalloc(dev, sizeof(*crc), GFP_KERNEL);
@@ -264,8 +263,7 @@ static int stm32_crc_probe(struct platform_device *pdev)

crc->dev = dev;

- res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
- crc->regs = devm_ioremap_resource(dev, res);
+ crc->regs = devm_platform_ioremap_resource(pdev, 0);
if (IS_ERR(crc->regs)) {
dev_err(dev, "Cannot map CRC IO\n");
return PTR_ERR(crc->regs);
diff --git a/drivers/crypto/stm32/stm32-cryp.c b/drivers/crypto/stm32/stm32-cryp.c
index 98ae028..2fe6f26 100644
--- a/drivers/crypto/stm32/stm32-cryp.c
+++ b/drivers/crypto/stm32/stm32-cryp.c
@@ -1955,7 +1955,6 @@ static int stm32_cryp_probe(struct platform_device *pdev)
{
struct device *dev = &pdev->dev;
struct stm32_cryp *cryp;
- struct resource *res;
struct reset_control *rst;
int irq, ret;

@@ -1969,8 +1968,7 @@ static int stm32_cryp_probe(struct platform_device *pdev)

cryp->dev = dev;

- res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
- cryp->regs = devm_ioremap_resource(dev, res);
+ cryp->regs = devm_platform_ioremap_resource(pdev, 0);
if (IS_ERR(cryp->regs))
return PTR_ERR(cryp->regs);

--
2.7.4


2019-08-03 02:51:42

by Yue Haibing

[permalink] [raw]
Subject: [PATCH -next 11/12] crypto: qce - use devm_platform_ioremap_resource() to simplify code

Use devm_platform_ioremap_resource() to simplify the code a bit.
This is detected by coccinelle.

Reported-by: Hulk Robot <[email protected]>
Signed-off-by: YueHaibing <[email protected]>
---
drivers/crypto/qce/core.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/crypto/qce/core.c b/drivers/crypto/qce/core.c
index ef1d74e..08d4ce3 100644
--- a/drivers/crypto/qce/core.c
+++ b/drivers/crypto/qce/core.c
@@ -167,7 +167,6 @@ static int qce_crypto_probe(struct platform_device *pdev)
{
struct device *dev = &pdev->dev;
struct qce_device *qce;
- struct resource *res;
int ret;

qce = devm_kzalloc(dev, sizeof(*qce), GFP_KERNEL);
@@ -177,8 +176,7 @@ static int qce_crypto_probe(struct platform_device *pdev)
qce->dev = dev;
platform_set_drvdata(pdev, qce);

- res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
- qce->base = devm_ioremap_resource(&pdev->dev, res);
+ qce->base = devm_platform_ioremap_resource(pdev, 0);
if (IS_ERR(qce->base))
return PTR_ERR(qce->base);

--
2.7.4


2019-08-03 02:58:34

by Yue Haibing

[permalink] [raw]
Subject: [PATCH -next 09/12] crypto: rockchip - use devm_platform_ioremap_resource() to simplify code

Use devm_platform_ioremap_resource() to simplify the code a bit.
This is detected by coccinelle.

Reported-by: Hulk Robot <[email protected]>
Signed-off-by: YueHaibing <[email protected]>
---
drivers/crypto/rockchip/rk3288_crypto.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/crypto/rockchip/rk3288_crypto.c b/drivers/crypto/rockchip/rk3288_crypto.c
index 8d7e254..e5714ef 100644
--- a/drivers/crypto/rockchip/rk3288_crypto.c
+++ b/drivers/crypto/rockchip/rk3288_crypto.c
@@ -311,7 +311,6 @@ MODULE_DEVICE_TABLE(of, crypto_of_id_table);

static int rk_crypto_probe(struct platform_device *pdev)
{
- struct resource *res;
struct device *dev = &pdev->dev;
struct rk_crypto_info *crypto_info;
int err = 0;
@@ -339,8 +338,7 @@ static int rk_crypto_probe(struct platform_device *pdev)

spin_lock_init(&crypto_info->lock);

- res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
- crypto_info->reg = devm_ioremap_resource(&pdev->dev, res);
+ crypto_info->reg = devm_platform_ioremap_resource(pdev, 0);
if (IS_ERR(crypto_info->reg)) {
err = PTR_ERR(crypto_info->reg);
goto err_crypto;
--
2.7.4


2019-08-03 03:04:26

by Yue Haibing

[permalink] [raw]
Subject: [PATCH -next 03/12] crypto: exynos - use devm_platform_ioremap_resource() to simplify code

Use devm_platform_ioremap_resource() to simplify the code a bit.
This is detected by coccinelle.

Reported-by: Hulk Robot <[email protected]>
Signed-off-by: YueHaibing <[email protected]>
---
drivers/crypto/exynos-rng.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/crypto/exynos-rng.c b/drivers/crypto/exynos-rng.c
index 2cfabb9..cbd8ca6 100644
--- a/drivers/crypto/exynos-rng.c
+++ b/drivers/crypto/exynos-rng.c
@@ -268,7 +268,6 @@ static struct rng_alg exynos_rng_alg = {
static int exynos_rng_probe(struct platform_device *pdev)
{
struct exynos_rng_dev *rng;
- struct resource *res;
int ret;

if (exynos_rng_dev)
@@ -289,8 +288,7 @@ static int exynos_rng_probe(struct platform_device *pdev)
return PTR_ERR(rng->clk);
}

- res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
- rng->mem = devm_ioremap_resource(&pdev->dev, res);
+ rng->mem = devm_platform_ioremap_resource(pdev, 0);
if (IS_ERR(rng->mem))
return PTR_ERR(rng->mem);

--
2.7.4


2019-08-03 13:51:14

by Yue Haibing

[permalink] [raw]
Subject: [PATCH -next 06/12] crypto: mediatek - use devm_platform_ioremap_resource() to simplify code

Use devm_platform_ioremap_resource() to simplify the code a bit.
This is detected by coccinelle.

Reported-by: Hulk Robot <[email protected]>
Signed-off-by: YueHaibing <[email protected]>
---
drivers/crypto/mediatek/mtk-platform.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/crypto/mediatek/mtk-platform.c b/drivers/crypto/mediatek/mtk-platform.c
index 125318a..12462136 100644
--- a/drivers/crypto/mediatek/mtk-platform.c
+++ b/drivers/crypto/mediatek/mtk-platform.c
@@ -481,7 +481,6 @@ static int mtk_desc_ring_alloc(struct mtk_cryp *cryp)

static int mtk_crypto_probe(struct platform_device *pdev)
{
- struct resource *res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
struct mtk_cryp *cryp;
int i, err;

@@ -489,7 +488,7 @@ static int mtk_crypto_probe(struct platform_device *pdev)
if (!cryp)
return -ENOMEM;

- cryp->base = devm_ioremap_resource(&pdev->dev, res);
+ cryp->base = devm_platform_ioremap_resource(pdev, 0);
if (IS_ERR(cryp->base))
return PTR_ERR(cryp->base);

--
2.7.4


2019-08-03 15:08:23

by Heiko Stuebner

[permalink] [raw]
Subject: Re: [PATCH -next 09/12] crypto: rockchip - use devm_platform_ioremap_resource() to simplify code

Am Freitag, 2. August 2019, 15:28:06 CEST schrieb YueHaibing:
> Use devm_platform_ioremap_resource() to simplify the code a bit.
> This is detected by coccinelle.
>
> Reported-by: Hulk Robot <[email protected]>
> Signed-off-by: YueHaibing <[email protected]>

looks like nice and simple improvement
Reviewed-by: Heiko Stuebner <[email protected]>

Thanks
Heiko


2019-08-04 03:47:43

by Jamie Iles

[permalink] [raw]
Subject: Re: [PATCH -next 07/12] crypto: picoxcell - use devm_platform_ioremap_resource() to simplify code

On Fri, Aug 02, 2019 at 09:28:04PM +0800, YueHaibing wrote:
> Use devm_platform_ioremap_resource() to simplify the code a bit.
> This is detected by coccinelle.
>
> Reported-by: Hulk Robot <[email protected]>
> Signed-off-by: YueHaibing <[email protected]>

Acked-by: Jamie Iles <[email protected]>

> ---
> drivers/crypto/picoxcell_crypto.c | 5 ++---
> 1 file changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/crypto/picoxcell_crypto.c b/drivers/crypto/picoxcell_crypto.c
> index b985cb85..9a939b4 100644
> --- a/drivers/crypto/picoxcell_crypto.c
> +++ b/drivers/crypto/picoxcell_crypto.c
> @@ -1624,7 +1624,7 @@ MODULE_DEVICE_TABLE(of, spacc_of_id_table);
> static int spacc_probe(struct platform_device *pdev)
> {
> int i, err, ret;
> - struct resource *mem, *irq;
> + struct resource *irq;
> struct device_node *np = pdev->dev.of_node;
> struct spacc_engine *engine = devm_kzalloc(&pdev->dev, sizeof(*engine),
> GFP_KERNEL);
> @@ -1653,8 +1653,7 @@ static int spacc_probe(struct platform_device *pdev)
>
> engine->name = dev_name(&pdev->dev);
>
> - mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> - engine->regs = devm_ioremap_resource(&pdev->dev, mem);
> + engine->regs = devm_platform_ioremap_resource(pdev, 0);
> if (IS_ERR(engine->regs))
> return PTR_ERR(engine->regs);
>
> --
> 2.7.4
>
>

2019-08-05 09:20:36

by Krzysztof Kozlowski

[permalink] [raw]
Subject: Re: [PATCH -next 03/12] crypto: exynos - use devm_platform_ioremap_resource() to simplify code

On Fri, 2 Aug 2019 at 15:31, YueHaibing <[email protected]> wrote:
>
> Use devm_platform_ioremap_resource() to simplify the code a bit.
> This is detected by coccinelle.
>
> Reported-by: Hulk Robot <[email protected]>
> Signed-off-by: YueHaibing <[email protected]>
> ---
> drivers/crypto/exynos-rng.c | 4 +---
> 1 file changed, 1 insertion(+), 3 deletions(-)
>

Reviewed-by: Krzysztof Kozlowski <[email protected]>

Best regards,
Krzysztof

2019-08-09 06:21:31

by Herbert Xu

[permalink] [raw]
Subject: Re: [PATCH -next 00/12] crypto: use devm_platform_ioremap_resource() to simplify code

On Fri, Aug 02, 2019 at 09:27:57PM +0800, YueHaibing wrote:
> devm_platform_ioremap_resource() internally have platform_get_resource()
> and devm_ioremap_resource() in it. So instead of calling them separately
> use devm_platform_ioremap_resource() directly.
>
> YueHaibing (12):
> crypto: artpec6 - use devm_platform_ioremap_resource() to simplify
> code
> crypto: ccp - use devm_platform_ioremap_resource() to simplify code
> crypto: exynos - use devm_platform_ioremap_resource() to simplify code
> crypto: img-hash - use devm_platform_ioremap_resource() to simplify
> code
> crypto: inside-secure - use devm_platform_ioremap_resource() to
> simplify code
> crypto: mediatek - use devm_platform_ioremap_resource() to simplify
> code
> crypto: picoxcell - use devm_platform_ioremap_resource() to simplify
> code
> crypto: sunxi-ss - use devm_platform_ioremap_resource() to simplify
> code
> crypto: rockchip - use devm_platform_ioremap_resource() to simplify
> code
> crypto: stm32 - use devm_platform_ioremap_resource() to simplify code
> crypto: qce - use devm_platform_ioremap_resource() to simplify code
> crypto: qcom-rng - use devm_platform_ioremap_resource() to simplify
> code
>
> drivers/crypto/axis/artpec6_crypto.c | 4 +---
> drivers/crypto/ccp/sp-platform.c | 4 +---
> drivers/crypto/exynos-rng.c | 4 +---
> drivers/crypto/img-hash.c | 4 +---
> drivers/crypto/inside-secure/safexcel.c | 4 +---
> drivers/crypto/mediatek/mtk-platform.c | 3 +--
> drivers/crypto/picoxcell_crypto.c | 5 ++---
> drivers/crypto/qce/core.c | 4 +---
> drivers/crypto/qcom-rng.c | 4 +---
> drivers/crypto/rockchip/rk3288_crypto.c | 4 +---
> drivers/crypto/stm32/stm32-crc32.c | 4 +---
> drivers/crypto/stm32/stm32-cryp.c | 4 +---
> drivers/crypto/sunxi-ss/sun4i-ss-core.c | 4 +---
> 13 files changed, 14 insertions(+), 38 deletions(-)

All applied. Thanks.
--
Email: Herbert Xu <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt