linux-crypto.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/3] crypto: picoxcell - Cleanups removing non-DT code
@ 2017-01-02 17:06 Javier Martinez Canillas
  2017-01-02 17:06 ` [PATCH 1/3] crypto: picoxcell - Allow driver to build COMPILE_TEST is enabled Javier Martinez Canillas
                   ` (5 more replies)
  0 siblings, 6 replies; 8+ messages in thread
From: Javier Martinez Canillas @ 2017-01-02 17:06 UTC (permalink / raw)
  To: linux-kernel
  Cc: Herbert Xu, Arnd Bergmann, Javier Martinez Canillas,
	linux-crypto, Jamie Iles, David S. Miller, linux-arm-kernel

Hello,

This small series contains a couple of cleanups that removes some driver's code
that isn't needed due the driver being for a DT-only platform.

The changes were suggested by Arnd Bergmann as a response to a previous patch:
https://lkml.org/lkml/2017/1/2/342

Patch #1 allows the driver to be built when the COMPILE_TEST option is enabled.
Patch #2 removes the platform ID table since isn't needed for DT-only drivers.
Patch #3 removes a wrapper function that's also not needed if driver is DT-only.

Best regards,


Javier Martinez Canillas (3):
  crypto: picoxcell - Allow driver to build COMPILE_TEST is enabled
  crypto: picoxcell - Remove platform device ID table
  crypto: picoxcell - Remove spacc_is_compatible() wrapper function

 drivers/crypto/Kconfig            |  2 +-
 drivers/crypto/picoxcell_crypto.c | 28 +++-------------------------
 2 files changed, 4 insertions(+), 26 deletions(-)

-- 
2.7.4

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

* [PATCH 1/3] crypto: picoxcell - Allow driver to build COMPILE_TEST is enabled
  2017-01-02 17:06 [PATCH 0/3] crypto: picoxcell - Cleanups removing non-DT code Javier Martinez Canillas
@ 2017-01-02 17:06 ` Javier Martinez Canillas
  2017-01-02 17:06 ` [PATCH 2/3] crypto: picoxcell - Remove platform device ID table Javier Martinez Canillas
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 8+ messages in thread
From: Javier Martinez Canillas @ 2017-01-02 17:06 UTC (permalink / raw)
  To: linux-kernel
  Cc: Arnd Bergmann, Javier Martinez Canillas, Herbert Xu,
	linux-crypto, David S. Miller

Driver only has runtime but no build time dependency with ARCH_PICOXCELL.
So it can be built for testing purposes if COMPILE_TEST option is enabled.

This is useful to have more build coverage and make sure that the driver
is not affected by changes that could cause build regressions.

Suggested-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com>
---

 drivers/crypto/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/crypto/Kconfig b/drivers/crypto/Kconfig
index 79564785ae30..35b1c4829696 100644
--- a/drivers/crypto/Kconfig
+++ b/drivers/crypto/Kconfig
@@ -339,7 +339,7 @@ config CRYPTO_DEV_OMAP_DES
 
 config CRYPTO_DEV_PICOXCELL
 	tristate "Support for picoXcell IPSEC and Layer2 crypto engines"
-	depends on ARCH_PICOXCELL && HAVE_CLK
+	depends on (ARCH_PICOXCELL || COMPILE_TEST) && HAVE_CLK
 	select CRYPTO_AEAD
 	select CRYPTO_AES
 	select CRYPTO_AUTHENC
-- 
2.7.4

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

* [PATCH 2/3] crypto: picoxcell - Remove platform device ID table
  2017-01-02 17:06 [PATCH 0/3] crypto: picoxcell - Cleanups removing non-DT code Javier Martinez Canillas
  2017-01-02 17:06 ` [PATCH 1/3] crypto: picoxcell - Allow driver to build COMPILE_TEST is enabled Javier Martinez Canillas
@ 2017-01-02 17:06 ` Javier Martinez Canillas
  2017-01-02 17:06 ` [PATCH 3/3] crypto: picoxcell - Remove spacc_is_compatible() wrapper function Javier Martinez Canillas
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 8+ messages in thread
From: Javier Martinez Canillas @ 2017-01-02 17:06 UTC (permalink / raw)
  To: linux-kernel
  Cc: Herbert Xu, Arnd Bergmann, Javier Martinez Canillas,
	linux-crypto, Jamie Iles, David S. Miller, linux-arm-kernel

This driver is only used in the picoxcell platform and this is DT-only.

So only a OF device ID table is needed and there's no need to have a
platform device ID table. This patch removes the unneeded table.

Suggested-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com>
---

 drivers/crypto/picoxcell_crypto.c | 7 -------
 1 file changed, 7 deletions(-)

diff --git a/drivers/crypto/picoxcell_crypto.c b/drivers/crypto/picoxcell_crypto.c
index 47576098831f..539effbbfc7a 100644
--- a/drivers/crypto/picoxcell_crypto.c
+++ b/drivers/crypto/picoxcell_crypto.c
@@ -1803,12 +1803,6 @@ static int spacc_remove(struct platform_device *pdev)
 	return 0;
 }
 
-static const struct platform_device_id spacc_id_table[] = {
-	{ "picochip,spacc-ipsec", },
-	{ "picochip,spacc-l2", },
-	{ }
-};
-
 static struct platform_driver spacc_driver = {
 	.probe		= spacc_probe,
 	.remove		= spacc_remove,
@@ -1819,7 +1813,6 @@ static struct platform_driver spacc_driver = {
 #endif /* CONFIG_PM */
 		.of_match_table	= of_match_ptr(spacc_of_id_table),
 	},
-	.id_table	= spacc_id_table,
 };
 
 module_platform_driver(spacc_driver);
-- 
2.7.4

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

* [PATCH 3/3] crypto: picoxcell - Remove spacc_is_compatible() wrapper function
  2017-01-02 17:06 [PATCH 0/3] crypto: picoxcell - Cleanups removing non-DT code Javier Martinez Canillas
  2017-01-02 17:06 ` [PATCH 1/3] crypto: picoxcell - Allow driver to build COMPILE_TEST is enabled Javier Martinez Canillas
  2017-01-02 17:06 ` [PATCH 2/3] crypto: picoxcell - Remove platform device ID table Javier Martinez Canillas
@ 2017-01-02 17:06 ` Javier Martinez Canillas
  2017-01-02 17:10 ` [PATCH 0/3] crypto: picoxcell - Cleanups removing non-DT code Arnd Bergmann
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 8+ messages in thread
From: Javier Martinez Canillas @ 2017-01-02 17:06 UTC (permalink / raw)
  To: linux-kernel
  Cc: Herbert Xu, Arnd Bergmann, Javier Martinez Canillas,
	linux-crypto, Jamie Iles, David S. Miller, linux-arm-kernel

The function is used to check either the platform device ID name or the OF
node's compatible (depending how the device was registered) to know which
device type was registered.

But the driver is for a DT-only platform and so there's no need for this
level of indirection since the devices can only be registered via OF.

Suggested-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com>

---

 drivers/crypto/picoxcell_crypto.c | 21 +++------------------
 1 file changed, 3 insertions(+), 18 deletions(-)

diff --git a/drivers/crypto/picoxcell_crypto.c b/drivers/crypto/picoxcell_crypto.c
index 539effbbfc7a..b6f14844702e 100644
--- a/drivers/crypto/picoxcell_crypto.c
+++ b/drivers/crypto/picoxcell_crypto.c
@@ -1616,32 +1616,17 @@ static const struct of_device_id spacc_of_id_table[] = {
 MODULE_DEVICE_TABLE(of, spacc_of_id_table);
 #endif /* CONFIG_OF */
 
-static bool spacc_is_compatible(struct platform_device *pdev,
-				const char *spacc_type)
-{
-	const struct platform_device_id *platid = platform_get_device_id(pdev);
-
-	if (platid && !strcmp(platid->name, spacc_type))
-		return true;
-
-#ifdef CONFIG_OF
-	if (of_device_is_compatible(pdev->dev.of_node, spacc_type))
-		return true;
-#endif /* CONFIG_OF */
-
-	return false;
-}
-
 static int spacc_probe(struct platform_device *pdev)
 {
 	int i, err, ret = -EINVAL;
 	struct resource *mem, *irq;
+	struct device_node *np = pdev->dev.of_node;
 	struct spacc_engine *engine = devm_kzalloc(&pdev->dev, sizeof(*engine),
 						   GFP_KERNEL);
 	if (!engine)
 		return -ENOMEM;
 
-	if (spacc_is_compatible(pdev, "picochip,spacc-ipsec")) {
+	if (of_device_is_compatible(np, "picochip,spacc-ipsec")) {
 		engine->max_ctxs	= SPACC_CRYPTO_IPSEC_MAX_CTXS;
 		engine->cipher_pg_sz	= SPACC_CRYPTO_IPSEC_CIPHER_PG_SZ;
 		engine->hash_pg_sz	= SPACC_CRYPTO_IPSEC_HASH_PG_SZ;
@@ -1650,7 +1635,7 @@ static int spacc_probe(struct platform_device *pdev)
 		engine->num_algs	= ARRAY_SIZE(ipsec_engine_algs);
 		engine->aeads		= ipsec_engine_aeads;
 		engine->num_aeads	= ARRAY_SIZE(ipsec_engine_aeads);
-	} else if (spacc_is_compatible(pdev, "picochip,spacc-l2")) {
+	} else if (of_device_is_compatible(np, "picochip,spacc-l2")) {
 		engine->max_ctxs	= SPACC_CRYPTO_L2_MAX_CTXS;
 		engine->cipher_pg_sz	= SPACC_CRYPTO_L2_CIPHER_PG_SZ;
 		engine->hash_pg_sz	= SPACC_CRYPTO_L2_HASH_PG_SZ;
-- 
2.7.4

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

* Re: [PATCH 0/3] crypto: picoxcell - Cleanups removing non-DT code
  2017-01-02 17:06 [PATCH 0/3] crypto: picoxcell - Cleanups removing non-DT code Javier Martinez Canillas
                   ` (2 preceding siblings ...)
  2017-01-02 17:06 ` [PATCH 3/3] crypto: picoxcell - Remove spacc_is_compatible() wrapper function Javier Martinez Canillas
@ 2017-01-02 17:10 ` Arnd Bergmann
  2017-01-02 17:49   ` Javier Martinez Canillas
  2017-01-07 15:05 ` Jamie Iles
  2017-01-12 16:39 ` Herbert Xu
  5 siblings, 1 reply; 8+ messages in thread
From: Arnd Bergmann @ 2017-01-02 17:10 UTC (permalink / raw)
  To: Javier Martinez Canillas
  Cc: Herbert Xu, linux-kernel, linux-crypto, Jamie Iles,
	David S. Miller, linux-arm-kernel

On Monday, January 2, 2017 2:06:56 PM CET Javier Martinez Canillas wrote:
> 
> This small series contains a couple of cleanups that removes some driver's code
> that isn't needed due the driver being for a DT-only platform.
> 
> The changes were suggested by Arnd Bergmann as a response to a previous patch:
> https://lkml.org/lkml/2017/1/2/342
> 
> Patch #1 allows the driver to be built when the COMPILE_TEST option is enabled.
> Patch #2 removes the platform ID table since isn't needed for DT-only drivers.
> Patch #3 removes a wrapper function that's also not needed if driver is DT-only.
> 
> 

Looks good, but I don't know if the first patch causes some build warnings
on non-ARM platforms, better wait at least for the 0-day build results,
and maybe build-test on x86-32 and x86-64.

	Arnd

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

* Re: [PATCH 0/3] crypto: picoxcell - Cleanups removing non-DT code
  2017-01-02 17:10 ` [PATCH 0/3] crypto: picoxcell - Cleanups removing non-DT code Arnd Bergmann
@ 2017-01-02 17:49   ` Javier Martinez Canillas
  0 siblings, 0 replies; 8+ messages in thread
From: Javier Martinez Canillas @ 2017-01-02 17:49 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: linux-kernel, Jamie Iles, David S. Miller, linux-crypto,
	Herbert Xu, linux-arm-kernel

Hello Arnd,

On 01/02/2017 02:10 PM, Arnd Bergmann wrote:
> On Monday, January 2, 2017 2:06:56 PM CET Javier Martinez Canillas wrote:
>>
>> This small series contains a couple of cleanups that removes some driver's code
>> that isn't needed due the driver being for a DT-only platform.
>>
>> The changes were suggested by Arnd Bergmann as a response to a previous patch:
>> https://lkml.org/lkml/2017/1/2/342
>>
>> Patch #1 allows the driver to be built when the COMPILE_TEST option is enabled.
>> Patch #2 removes the platform ID table since isn't needed for DT-only drivers.
>> Patch #3 removes a wrapper function that's also not needed if driver is DT-only.
>>
>>
> 
> Looks good, but I don't know if the first patch causes some build warnings

Thanks for looking at the patches.

> on non-ARM platforms, better wait at least for the 0-day build results,
> and maybe build-test on x86-32 and x86-64.
> 

I should had mentioned that I built tested for arm, arm64, x86-32 and x86-64,
and saw now issues. But I agree with you that it's better to wait for the
0-day builder in case it reports issues on some platforms.

> 	Arnd
> 

Best regards,
-- 
Javier Martinez Canillas
Open Source Group
Samsung Research America

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

* Re: [PATCH 0/3] crypto: picoxcell - Cleanups removing non-DT code
  2017-01-02 17:06 [PATCH 0/3] crypto: picoxcell - Cleanups removing non-DT code Javier Martinez Canillas
                   ` (3 preceding siblings ...)
  2017-01-02 17:10 ` [PATCH 0/3] crypto: picoxcell - Cleanups removing non-DT code Arnd Bergmann
@ 2017-01-07 15:05 ` Jamie Iles
  2017-01-12 16:39 ` Herbert Xu
  5 siblings, 0 replies; 8+ messages in thread
From: Jamie Iles @ 2017-01-07 15:05 UTC (permalink / raw)
  To: Javier Martinez Canillas
  Cc: linux-kernel, Arnd Bergmann, Jamie Iles, David S. Miller,
	linux-crypto, Herbert Xu, linux-arm-kernel

Hi Javier,

On Mon, Jan 02, 2017 at 02:06:56PM -0300, Javier Martinez Canillas wrote:
> Hello,
> 
> This small series contains a couple of cleanups that removes some driver's code
> that isn't needed due the driver being for a DT-only platform.
> 
> The changes were suggested by Arnd Bergmann as a response to a previous patch:
> https://lkml.org/lkml/2017/1/2/342
> 
> Patch #1 allows the driver to be built when the COMPILE_TEST option is enabled.
> Patch #2 removes the platform ID table since isn't needed for DT-only drivers.
> Patch #3 removes a wrapper function that's also not needed if driver is DT-only.
> 
> Best regards,
> 
> 
> Javier Martinez Canillas (3):
>   crypto: picoxcell - Allow driver to build COMPILE_TEST is enabled
>   crypto: picoxcell - Remove platform device ID table
>   crypto: picoxcell - Remove spacc_is_compatible() wrapper function
> 
>  drivers/crypto/Kconfig            |  2 +-
>  drivers/crypto/picoxcell_crypto.c | 28 +++-------------------------
>  2 files changed, 4 insertions(+), 26 deletions(-)

Acked-by: Jamie Iles <jamie@jamieiles.com>

Thanks,

Jamie

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

* Re: [PATCH 0/3] crypto: picoxcell - Cleanups removing non-DT code
  2017-01-02 17:06 [PATCH 0/3] crypto: picoxcell - Cleanups removing non-DT code Javier Martinez Canillas
                   ` (4 preceding siblings ...)
  2017-01-07 15:05 ` Jamie Iles
@ 2017-01-12 16:39 ` Herbert Xu
  5 siblings, 0 replies; 8+ messages in thread
From: Herbert Xu @ 2017-01-12 16:39 UTC (permalink / raw)
  To: Javier Martinez Canillas
  Cc: linux-kernel, Arnd Bergmann, Jamie Iles, David S. Miller,
	linux-crypto, linux-arm-kernel

On Mon, Jan 02, 2017 at 02:06:56PM -0300, Javier Martinez Canillas wrote:
> Hello,
> 
> This small series contains a couple of cleanups that removes some driver's code
> that isn't needed due the driver being for a DT-only platform.
> 
> The changes were suggested by Arnd Bergmann as a response to a previous patch:
> https://lkml.org/lkml/2017/1/2/342
> 
> Patch #1 allows the driver to be built when the COMPILE_TEST option is enabled.
> Patch #2 removes the platform ID table since isn't needed for DT-only drivers.
> Patch #3 removes a wrapper function that's also not needed if driver is DT-only.

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] 8+ messages in thread

end of thread, other threads:[~2017-01-12 16:39 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-01-02 17:06 [PATCH 0/3] crypto: picoxcell - Cleanups removing non-DT code Javier Martinez Canillas
2017-01-02 17:06 ` [PATCH 1/3] crypto: picoxcell - Allow driver to build COMPILE_TEST is enabled Javier Martinez Canillas
2017-01-02 17:06 ` [PATCH 2/3] crypto: picoxcell - Remove platform device ID table Javier Martinez Canillas
2017-01-02 17:06 ` [PATCH 3/3] crypto: picoxcell - Remove spacc_is_compatible() wrapper function Javier Martinez Canillas
2017-01-02 17:10 ` [PATCH 0/3] crypto: picoxcell - Cleanups removing non-DT code Arnd Bergmann
2017-01-02 17:49   ` Javier Martinez Canillas
2017-01-07 15:05 ` Jamie Iles
2017-01-12 16:39 ` 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).