aboutsummaryrefslogtreecommitdiff
path: root/drivers/crypto/nx/nx-842.c
diff options
context:
space:
mode:
authorDan Streetman <ddstreet@ieee.org>2015-06-12 10:58:47 -0400
committerHerbert Xu <herbert@gondor.apana.org.au>2015-06-15 18:15:57 +0800
commit2c6f6eabc0bfcea0a62370038da713e3873cff31 (patch)
tree7c82b26a28581a9502c59a96e8f8a4fc5b94df2f /drivers/crypto/nx/nx-842.c
parent32be6d3e362b896c81aae7c635d44e5a91406ce2 (diff)
crypto: nx - replace NX842_MEM_COMPRESS with function
Replace the NX842_MEM_COMPRESS define with a function that returns the specific platform driver's required working memory size. The common nx-842.c driver refuses to load if there is no platform driver present, so instead of defining an approximate working memory size that's the maximum approximate size of both platform driver's size requirements, the platform driver can directly provide its specific, i.e. sizeof(struct nx842_workmem), size requirements which the 842-nx crypto compression driver will use. This saves memory by both reducing the required size of each driver to the specific sizeof() amount, as well as using the specific loaded platform driver's required amount, instead of the maximum of both. Signed-off-by: Dan Streetman <ddstreet@ieee.org> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'drivers/crypto/nx/nx-842.c')
-rw-r--r--drivers/crypto/nx/nx-842.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/drivers/crypto/nx/nx-842.c b/drivers/crypto/nx/nx-842.c
index 9f391d64c722..6e5e0d60d0c8 100644
--- a/drivers/crypto/nx/nx-842.c
+++ b/drivers/crypto/nx/nx-842.c
@@ -53,6 +53,17 @@ int nx842_constraints(struct nx842_constraints *c)
}
EXPORT_SYMBOL_GPL(nx842_constraints);
+/**
+ * nx842_workmem_size
+ *
+ * Get the amount of working memory the driver requires.
+ */
+size_t nx842_workmem_size(void)
+{
+ return nx842_platform_driver()->workmem_size;
+}
+EXPORT_SYMBOL_GPL(nx842_workmem_size);
+
int nx842_compress(const unsigned char *in, unsigned int ilen,
unsigned char *out, unsigned int *olen, void *wmem)
{