linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/3] crypto: s5p-sss - simplify getting of_device_id match data
@ 2021-04-16 12:23 Krzysztof Kozlowski
  2021-04-16 12:23 ` [PATCH 2/3] crypto: s5p-sss - remove unneeded local variable initialization Krzysztof Kozlowski
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Krzysztof Kozlowski @ 2021-04-16 12:23 UTC (permalink / raw)
  To: Krzysztof Kozlowski, Vladimir Zapolskiy, Herbert Xu,
	David S. Miller, linux-crypto, linux-samsung-soc, linux-kernel

Use of_device_get_match_data() to make the code slightly smaller.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
---
 drivers/crypto/s5p-sss.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/drivers/crypto/s5p-sss.c b/drivers/crypto/s5p-sss.c
index 8ed08130196f..d613bd557016 100644
--- a/drivers/crypto/s5p-sss.c
+++ b/drivers/crypto/s5p-sss.c
@@ -20,6 +20,7 @@
 #include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/of.h>
+#include <linux/of_device.h>
 #include <linux/platform_device.h>
 #include <linux/scatterlist.h>
 
@@ -424,13 +425,9 @@ MODULE_DEVICE_TABLE(of, s5p_sss_dt_match);
 static inline const struct samsung_aes_variant *find_s5p_sss_version
 				   (const struct platform_device *pdev)
 {
-	if (IS_ENABLED(CONFIG_OF) && (pdev->dev.of_node)) {
-		const struct of_device_id *match;
+	if (IS_ENABLED(CONFIG_OF) && (pdev->dev.of_node))
+		return of_device_get_match_data(&pdev->dev);
 
-		match = of_match_node(s5p_sss_dt_match,
-					pdev->dev.of_node);
-		return (const struct samsung_aes_variant *)match->data;
-	}
 	return (const struct samsung_aes_variant *)
 			platform_get_device_id(pdev)->driver_data;
 }
-- 
2.25.1


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

* [PATCH 2/3] crypto: s5p-sss - remove unneeded local variable initialization
  2021-04-16 12:23 [PATCH 1/3] crypto: s5p-sss - simplify getting of_device_id match data Krzysztof Kozlowski
@ 2021-04-16 12:23 ` Krzysztof Kozlowski
  2021-04-16 12:23 ` [PATCH 3/3] crypto: s5p-sss - consistently use local 'dev' variable in probe() Krzysztof Kozlowski
  2021-04-22  7:47 ` [PATCH 1/3] crypto: s5p-sss - simplify getting of_device_id match data Herbert Xu
  2 siblings, 0 replies; 4+ messages in thread
From: Krzysztof Kozlowski @ 2021-04-16 12:23 UTC (permalink / raw)
  To: Krzysztof Kozlowski, Vladimir Zapolskiy, Herbert Xu,
	David S. Miller, linux-crypto, linux-samsung-soc, linux-kernel

The initialization of 'err' local variable is not needed as it is
shortly after overwritten.

Addresses-Coverity: Unused value
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
---
 drivers/crypto/s5p-sss.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/crypto/s5p-sss.c b/drivers/crypto/s5p-sss.c
index d613bd557016..8c310816deab 100644
--- a/drivers/crypto/s5p-sss.c
+++ b/drivers/crypto/s5p-sss.c
@@ -2156,7 +2156,7 @@ static struct skcipher_alg algs[] = {
 static int s5p_aes_probe(struct platform_device *pdev)
 {
 	struct device *dev = &pdev->dev;
-	int i, j, err = -ENODEV;
+	int i, j, err;
 	const struct samsung_aes_variant *variant;
 	struct s5p_aes_dev *pdata;
 	struct resource *res;
-- 
2.25.1


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

* [PATCH 3/3] crypto: s5p-sss - consistently use local 'dev' variable in probe()
  2021-04-16 12:23 [PATCH 1/3] crypto: s5p-sss - simplify getting of_device_id match data Krzysztof Kozlowski
  2021-04-16 12:23 ` [PATCH 2/3] crypto: s5p-sss - remove unneeded local variable initialization Krzysztof Kozlowski
@ 2021-04-16 12:23 ` Krzysztof Kozlowski
  2021-04-22  7:47 ` [PATCH 1/3] crypto: s5p-sss - simplify getting of_device_id match data Herbert Xu
  2 siblings, 0 replies; 4+ messages in thread
From: Krzysztof Kozlowski @ 2021-04-16 12:23 UTC (permalink / raw)
  To: Krzysztof Kozlowski, Vladimir Zapolskiy, Herbert Xu,
	David S. Miller, linux-crypto, linux-samsung-soc, linux-kernel

For code readability, the probe() function uses 'dev' variable instead
of '&pdev->dev', so update remaining places.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
---
 drivers/crypto/s5p-sss.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/crypto/s5p-sss.c b/drivers/crypto/s5p-sss.c
index 8c310816deab..55aa3a71169b 100644
--- a/drivers/crypto/s5p-sss.c
+++ b/drivers/crypto/s5p-sss.c
@@ -2186,14 +2186,14 @@ static int s5p_aes_probe(struct platform_device *pdev)
 	}
 
 	pdata->res = res;
-	pdata->ioaddr = devm_ioremap_resource(&pdev->dev, res);
+	pdata->ioaddr = devm_ioremap_resource(dev, res);
 	if (IS_ERR(pdata->ioaddr)) {
 		if (!pdata->use_hash)
 			return PTR_ERR(pdata->ioaddr);
 		/* try AES without HASH */
 		res->end -= 0x300;
 		pdata->use_hash = false;
-		pdata->ioaddr = devm_ioremap_resource(&pdev->dev, res);
+		pdata->ioaddr = devm_ioremap_resource(dev, res);
 		if (IS_ERR(pdata->ioaddr))
 			return PTR_ERR(pdata->ioaddr);
 	}
-- 
2.25.1


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

* Re: [PATCH 1/3] crypto: s5p-sss - simplify getting of_device_id match data
  2021-04-16 12:23 [PATCH 1/3] crypto: s5p-sss - simplify getting of_device_id match data Krzysztof Kozlowski
  2021-04-16 12:23 ` [PATCH 2/3] crypto: s5p-sss - remove unneeded local variable initialization Krzysztof Kozlowski
  2021-04-16 12:23 ` [PATCH 3/3] crypto: s5p-sss - consistently use local 'dev' variable in probe() Krzysztof Kozlowski
@ 2021-04-22  7:47 ` Herbert Xu
  2 siblings, 0 replies; 4+ messages in thread
From: Herbert Xu @ 2021-04-22  7:47 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: Vladimir Zapolskiy, David S. Miller, linux-crypto,
	linux-samsung-soc, linux-kernel

On Fri, Apr 16, 2021 at 02:23:09PM +0200, Krzysztof Kozlowski wrote:
> Use of_device_get_match_data() to make the code slightly smaller.
> 
> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
> ---
>  drivers/crypto/s5p-sss.c | 9 +++------
>  1 file changed, 3 insertions(+), 6 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] 4+ messages in thread

end of thread, other threads:[~2021-04-22  7:47 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-16 12:23 [PATCH 1/3] crypto: s5p-sss - simplify getting of_device_id match data Krzysztof Kozlowski
2021-04-16 12:23 ` [PATCH 2/3] crypto: s5p-sss - remove unneeded local variable initialization Krzysztof Kozlowski
2021-04-16 12:23 ` [PATCH 3/3] crypto: s5p-sss - consistently use local 'dev' variable in probe() Krzysztof Kozlowski
2021-04-22  7:47 ` [PATCH 1/3] crypto: s5p-sss - simplify getting of_device_id match data Herbert Xu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).