All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] crypto: acomp - allow registration of multiple acomps
@ 2017-04-19 13:23 Giovanni Cabiddu
  2017-04-21 13:16 ` Herbert Xu
  0 siblings, 1 reply; 2+ messages in thread
From: Giovanni Cabiddu @ 2017-04-19 13:23 UTC (permalink / raw)
  To: herbert; +Cc: linux-crypto, weigang.li, giovanni.cabiddu, Giovanni Cabiddu

Add crypto_register_acomps and crypto_unregister_acomps to allow
the registration of multiple implementations with one call.

Signed-off-by: Giovanni Cabiddu <giovanni.cabiddu@intel.com>
---
 crypto/acompress.c                  | 29 +++++++++++++++++++++++++++++
 include/crypto/internal/acompress.h |  3 +++
 2 files changed, 32 insertions(+)

diff --git a/crypto/acompress.c b/crypto/acompress.c
index 47d1162..1544b7c 100644
--- a/crypto/acompress.c
+++ b/crypto/acompress.c
@@ -166,5 +166,34 @@ int crypto_unregister_acomp(struct acomp_alg *alg)
 }
 EXPORT_SYMBOL_GPL(crypto_unregister_acomp);
 
+int crypto_register_acomps(struct acomp_alg *algs, int count)
+{
+	int i, ret;
+
+	for (i = 0; i < count; i++) {
+		ret = crypto_register_acomp(&algs[i]);
+		if (ret)
+			goto err;
+	}
+
+	return 0;
+
+err:
+	for (--i; i >= 0; --i)
+		crypto_unregister_acomp(&algs[i]);
+
+	return ret;
+}
+EXPORT_SYMBOL_GPL(crypto_register_acomps);
+
+void crypto_unregister_acomps(struct acomp_alg *algs, int count)
+{
+	int i;
+
+	for (i = count - 1; i >= 0; --i)
+		crypto_unregister_acomp(&algs[i]);
+}
+EXPORT_SYMBOL_GPL(crypto_unregister_acomps);
+
 MODULE_LICENSE("GPL");
 MODULE_DESCRIPTION("Asynchronous compression type");
diff --git a/include/crypto/internal/acompress.h b/include/crypto/internal/acompress.h
index 1de2b5a..51052f6 100644
--- a/include/crypto/internal/acompress.h
+++ b/include/crypto/internal/acompress.h
@@ -78,4 +78,7 @@ int crypto_register_acomp(struct acomp_alg *alg);
  */
 int crypto_unregister_acomp(struct acomp_alg *alg);
 
+int crypto_register_acomps(struct acomp_alg *algs, int count);
+void crypto_unregister_acomps(struct acomp_alg *algs, int count);
+
 #endif
-- 
2.9.3

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

* Re: [PATCH] crypto: acomp - allow registration of multiple acomps
  2017-04-19 13:23 [PATCH] crypto: acomp - allow registration of multiple acomps Giovanni Cabiddu
@ 2017-04-21 13:16 ` Herbert Xu
  0 siblings, 0 replies; 2+ messages in thread
From: Herbert Xu @ 2017-04-21 13:16 UTC (permalink / raw)
  To: Giovanni Cabiddu; +Cc: linux-crypto, weigang.li, giovanni.cabiddu

On Wed, Apr 19, 2017 at 02:23:05PM +0100, Giovanni Cabiddu wrote:
> Add crypto_register_acomps and crypto_unregister_acomps to allow
> the registration of multiple implementations with one call.
> 
> Signed-off-by: Giovanni Cabiddu <giovanni.cabiddu@intel.com>

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

end of thread, other threads:[~2017-04-21 13:16 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-19 13:23 [PATCH] crypto: acomp - allow registration of multiple acomps Giovanni Cabiddu
2017-04-21 13:16 ` Herbert Xu

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.