mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 1/5] crypto: omap-des - Use devm_platform_get_and_ioremap_resource()
@ 2023-07-05  7:21 Yangtao Li
  2023-07-05  7:21 ` [PATCH 2/5] crypto: keembay - Convert to devm_platform_ioremap_resource() Yangtao Li
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Yangtao Li @ 2023-07-05  7:21 UTC (permalink / raw)
  To: Herbert Xu, David S. Miller; +Cc: Yangtao Li, linux-crypto, linux-kernel

Convert platform_get_resource(), devm_ioremap_resource() to a single
call to devm_platform_get_and_ioremap_resource(), as this is exactly
what this function does.

Signed-off-by: Yangtao Li <frank.li@vivo.com>
---
 drivers/crypto/omap-des.c | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/drivers/crypto/omap-des.c b/drivers/crypto/omap-des.c
index f783769ea110..371a51094e34 100644
--- a/drivers/crypto/omap-des.c
+++ b/drivers/crypto/omap-des.c
@@ -971,18 +971,12 @@ static int omap_des_probe(struct platform_device *pdev)
 	dd->dev = dev;
 	platform_set_drvdata(pdev, dd);
 
-	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	if (!res) {
-		dev_err(dev, "no MEM resource info\n");
-		goto err_res;
-	}
-
 	err = (dev->of_node) ? omap_des_get_of(dd, pdev) :
 			       omap_des_get_pdev(dd, pdev);
 	if (err)
 		goto err_res;
 
-	dd->io_base = devm_ioremap_resource(dev, res);
+	dd->io_base = devm_platform_get_and_ioremap_resource(pdev, 0, &res);
 	if (IS_ERR(dd->io_base)) {
 		err = PTR_ERR(dd->io_base);
 		goto err_res;
-- 
2.39.0


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 2/5] crypto: keembay - Convert to devm_platform_ioremap_resource()
  2023-07-05  7:21 [PATCH 1/5] crypto: omap-des - Use devm_platform_get_and_ioremap_resource() Yangtao Li
@ 2023-07-05  7:21 ` Yangtao Li
  2023-07-05  7:21 ` [PATCH 3/5] crypto: atmel-aes - Use devm_platform_get_and_ioremap_resource() Yangtao Li
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Yangtao Li @ 2023-07-05  7:21 UTC (permalink / raw)
  To: Daniele Alessandrelli, Declan Murphy, Herbert Xu, David S. Miller
  Cc: Yangtao Li, linux-crypto, linux-kernel

Use devm_platform_ioremap_resource() to simplify code.

Signed-off-by: Yangtao Li <frank.li@vivo.com>
---
 drivers/crypto/intel/keembay/keembay-ocs-hcu-core.c | 10 +---------
 1 file changed, 1 insertion(+), 9 deletions(-)

diff --git a/drivers/crypto/intel/keembay/keembay-ocs-hcu-core.c b/drivers/crypto/intel/keembay/keembay-ocs-hcu-core.c
index d4bcbed1f546..51a6de6294cb 100644
--- a/drivers/crypto/intel/keembay/keembay-ocs-hcu-core.c
+++ b/drivers/crypto/intel/keembay/keembay-ocs-hcu-core.c
@@ -1170,7 +1170,6 @@ static int kmb_ocs_hcu_probe(struct platform_device *pdev)
 {
 	struct device *dev = &pdev->dev;
 	struct ocs_hcu_dev *hcu_dev;
-	struct resource *hcu_mem;
 	int rc;
 
 	hcu_dev = devm_kzalloc(dev, sizeof(*hcu_dev), GFP_KERNEL);
@@ -1184,14 +1183,7 @@ static int kmb_ocs_hcu_probe(struct platform_device *pdev)
 	if (rc)
 		return rc;
 
-	/* Get the memory address and remap. */
-	hcu_mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	if (!hcu_mem) {
-		dev_err(dev, "Could not retrieve io mem resource.\n");
-		return -ENODEV;
-	}
-
-	hcu_dev->io_base = devm_ioremap_resource(dev, hcu_mem);
+	hcu_dev->io_base = devm_platform_ioremap_resource(pdev, 0);
 	if (IS_ERR(hcu_dev->io_base))
 		return PTR_ERR(hcu_dev->io_base);
 
-- 
2.39.0


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 3/5] crypto: atmel-aes - Use devm_platform_get_and_ioremap_resource()
  2023-07-05  7:21 [PATCH 1/5] crypto: omap-des - Use devm_platform_get_and_ioremap_resource() Yangtao Li
  2023-07-05  7:21 ` [PATCH 2/5] crypto: keembay - Convert to devm_platform_ioremap_resource() Yangtao Li
@ 2023-07-05  7:21 ` Yangtao Li
  2023-07-05  7:21 ` [PATCH 4/5] crypto: atmel-sha " Yangtao Li
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Yangtao Li @ 2023-07-05  7:21 UTC (permalink / raw)
  To: Herbert Xu, David S. Miller, Nicolas Ferre, Alexandre Belloni,
	Claudiu Beznea
  Cc: Yangtao Li, linux-crypto, linux-arm-kernel, linux-kernel

Convert platform_get_resource(), devm_ioremap_resource() to a single
call to devm_platform_get_and_ioremap_resource(), as this is exactly
what this function does.

Signed-off-by: Yangtao Li <frank.li@vivo.com>
---
 drivers/crypto/atmel-aes.c | 15 +++------------
 1 file changed, 3 insertions(+), 12 deletions(-)

diff --git a/drivers/crypto/atmel-aes.c b/drivers/crypto/atmel-aes.c
index 143d33fbb316..9692254faad9 100644
--- a/drivers/crypto/atmel-aes.c
+++ b/drivers/crypto/atmel-aes.c
@@ -2566,11 +2566,9 @@ static int atmel_aes_probe(struct platform_device *pdev)
 
 	crypto_init_queue(&aes_dd->queue, ATMEL_AES_QUEUE_LENGTH);
 
-	/* Get the base address */
-	aes_res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	if (!aes_res) {
-		dev_err(dev, "no MEM resource info\n");
-		err = -ENODEV;
+	aes_dd->io_base = devm_platform_get_and_ioremap_resource(pdev, 0, &aes_res);
+	if (IS_ERR(aes_dd->io_base)) {
+		err = PTR_ERR(aes_dd->io_base);
 		goto err_tasklet_kill;
 	}
 	aes_dd->phys_base = aes_res->start;
@@ -2597,13 +2595,6 @@ static int atmel_aes_probe(struct platform_device *pdev)
 		goto err_tasklet_kill;
 	}
 
-	aes_dd->io_base = devm_ioremap_resource(&pdev->dev, aes_res);
-	if (IS_ERR(aes_dd->io_base)) {
-		dev_err(dev, "can't ioremap\n");
-		err = PTR_ERR(aes_dd->io_base);
-		goto err_tasklet_kill;
-	}
-
 	err = clk_prepare(aes_dd->iclk);
 	if (err)
 		goto err_tasklet_kill;
-- 
2.39.0


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 4/5] crypto: atmel-sha - Use devm_platform_get_and_ioremap_resource()
  2023-07-05  7:21 [PATCH 1/5] crypto: omap-des - Use devm_platform_get_and_ioremap_resource() Yangtao Li
  2023-07-05  7:21 ` [PATCH 2/5] crypto: keembay - Convert to devm_platform_ioremap_resource() Yangtao Li
  2023-07-05  7:21 ` [PATCH 3/5] crypto: atmel-aes - Use devm_platform_get_and_ioremap_resource() Yangtao Li
@ 2023-07-05  7:21 ` Yangtao Li
  2023-07-05  7:21 ` [PATCH 5/5] crypto: atmel-tdes " Yangtao Li
  2023-07-14  8:58 ` [PATCH 1/5] crypto: omap-des " Herbert Xu
  4 siblings, 0 replies; 6+ messages in thread
From: Yangtao Li @ 2023-07-05  7:21 UTC (permalink / raw)
  To: Herbert Xu, David S. Miller, Nicolas Ferre, Alexandre Belloni,
	Claudiu Beznea
  Cc: Yangtao Li, linux-crypto, linux-arm-kernel, linux-kernel

Convert platform_get_resource(), devm_ioremap_resource() to a single
call to devm_platform_get_and_ioremap_resource(), as this is exactly
what this function does.

Signed-off-by: Yangtao Li <frank.li@vivo.com>
---
 drivers/crypto/atmel-sha.c | 15 +++------------
 1 file changed, 3 insertions(+), 12 deletions(-)

diff --git a/drivers/crypto/atmel-sha.c b/drivers/crypto/atmel-sha.c
index 6bef634d3c86..f2031f934be9 100644
--- a/drivers/crypto/atmel-sha.c
+++ b/drivers/crypto/atmel-sha.c
@@ -2604,11 +2604,9 @@ static int atmel_sha_probe(struct platform_device *pdev)
 
 	crypto_init_queue(&sha_dd->queue, ATMEL_SHA_QUEUE_LENGTH);
 
-	/* Get the base address */
-	sha_res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	if (!sha_res) {
-		dev_err(dev, "no MEM resource info\n");
-		err = -ENODEV;
+	sha_dd->io_base = devm_platform_get_and_ioremap_resource(pdev, 0, &sha_res);
+	if (IS_ERR(sha_dd->io_base)) {
+		err = PTR_ERR(sha_dd->io_base);
 		goto err_tasklet_kill;
 	}
 	sha_dd->phys_base = sha_res->start;
@@ -2635,13 +2633,6 @@ static int atmel_sha_probe(struct platform_device *pdev)
 		goto err_tasklet_kill;
 	}
 
-	sha_dd->io_base = devm_ioremap_resource(&pdev->dev, sha_res);
-	if (IS_ERR(sha_dd->io_base)) {
-		dev_err(dev, "can't ioremap\n");
-		err = PTR_ERR(sha_dd->io_base);
-		goto err_tasklet_kill;
-	}
-
 	err = clk_prepare(sha_dd->iclk);
 	if (err)
 		goto err_tasklet_kill;
-- 
2.39.0


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 5/5] crypto: atmel-tdes - Use devm_platform_get_and_ioremap_resource()
  2023-07-05  7:21 [PATCH 1/5] crypto: omap-des - Use devm_platform_get_and_ioremap_resource() Yangtao Li
                   ` (2 preceding siblings ...)
  2023-07-05  7:21 ` [PATCH 4/5] crypto: atmel-sha " Yangtao Li
@ 2023-07-05  7:21 ` Yangtao Li
  2023-07-14  8:58 ` [PATCH 1/5] crypto: omap-des " Herbert Xu
  4 siblings, 0 replies; 6+ messages in thread
From: Yangtao Li @ 2023-07-05  7:21 UTC (permalink / raw)
  To: Herbert Xu, David S. Miller, Nicolas Ferre, Alexandre Belloni,
	Claudiu Beznea
  Cc: Yangtao Li, linux-crypto, linux-arm-kernel, linux-kernel

Convert platform_get_resource(), devm_ioremap_resource() to a single
call to devm_platform_get_and_ioremap_resource(), as this is exactly
what this function does.

Signed-off-by: Yangtao Li <frank.li@vivo.com>
---
 drivers/crypto/atmel-tdes.c | 14 +++-----------
 1 file changed, 3 insertions(+), 11 deletions(-)

diff --git a/drivers/crypto/atmel-tdes.c b/drivers/crypto/atmel-tdes.c
index c9ded8be9c39..ba8981f326cf 100644
--- a/drivers/crypto/atmel-tdes.c
+++ b/drivers/crypto/atmel-tdes.c
@@ -1172,11 +1172,9 @@ static int atmel_tdes_probe(struct platform_device *pdev)
 
 	crypto_init_queue(&tdes_dd->queue, ATMEL_TDES_QUEUE_LENGTH);
 
-	/* Get the base address */
-	tdes_res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	if (!tdes_res) {
-		dev_err(dev, "no MEM resource info\n");
-		err = -ENODEV;
+	tdes_dd->io_base = devm_platform_get_and_ioremap_resource(pdev, 0, &tdes_res);
+	if (IS_ERR(tdes_dd->io_base)) {
+		err = PTR_ERR(tdes_dd->io_base);
 		goto err_tasklet_kill;
 	}
 	tdes_dd->phys_base = tdes_res->start;
@@ -1203,12 +1201,6 @@ static int atmel_tdes_probe(struct platform_device *pdev)
 		goto err_tasklet_kill;
 	}
 
-	tdes_dd->io_base = devm_ioremap_resource(&pdev->dev, tdes_res);
-	if (IS_ERR(tdes_dd->io_base)) {
-		err = PTR_ERR(tdes_dd->io_base);
-		goto err_tasklet_kill;
-	}
-
 	err = atmel_tdes_hw_version_init(tdes_dd);
 	if (err)
 		goto err_tasklet_kill;
-- 
2.39.0


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/5] crypto: omap-des - Use devm_platform_get_and_ioremap_resource()
  2023-07-05  7:21 [PATCH 1/5] crypto: omap-des - Use devm_platform_get_and_ioremap_resource() Yangtao Li
                   ` (3 preceding siblings ...)
  2023-07-05  7:21 ` [PATCH 5/5] crypto: atmel-tdes " Yangtao Li
@ 2023-07-14  8:58 ` Herbert Xu
  4 siblings, 0 replies; 6+ messages in thread
From: Herbert Xu @ 2023-07-14  8:58 UTC (permalink / raw)
  To: Yangtao Li; +Cc: David S. Miller, linux-crypto, linux-kernel

On Wed, Jul 05, 2023 at 03:21:54PM +0800, Yangtao Li wrote:
> Convert platform_get_resource(), devm_ioremap_resource() to a single
> call to devm_platform_get_and_ioremap_resource(), as this is exactly
> what this function does.
> 
> Signed-off-by: Yangtao Li <frank.li@vivo.com>
> ---
>  drivers/crypto/omap-des.c | 8 +-------
>  1 file changed, 1 insertion(+), 7 deletions(-)

All applied.  Thanks.
-- 
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] 6+ messages in thread

end of thread, other threads:[~2023-07-14  8:59 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-07-05  7:21 [PATCH 1/5] crypto: omap-des - Use devm_platform_get_and_ioremap_resource() Yangtao Li
2023-07-05  7:21 ` [PATCH 2/5] crypto: keembay - Convert to devm_platform_ioremap_resource() Yangtao Li
2023-07-05  7:21 ` [PATCH 3/5] crypto: atmel-aes - Use devm_platform_get_and_ioremap_resource() Yangtao Li
2023-07-05  7:21 ` [PATCH 4/5] crypto: atmel-sha " Yangtao Li
2023-07-05  7:21 ` [PATCH 5/5] crypto: atmel-tdes " Yangtao Li
2023-07-14  8:58 ` [PATCH 1/5] crypto: omap-des " Herbert Xu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®