|
@@ -86,6 +86,44 @@ static void put_driver(struct nx842_driver *driver)
|
|
|
module_put(driver->owner);
|
|
|
}
|
|
|
|
|
|
+/**
|
|
|
+ * nx842_constraints
|
|
|
+ *
|
|
|
+ * This provides the driver's constraints. Different nx842 implementations
|
|
|
+ * may have varying requirements. The constraints are:
|
|
|
+ * @alignment: All buffers should be aligned to this
|
|
|
+ * @multiple: All buffer lengths should be a multiple of this
|
|
|
+ * @minimum: Buffer lengths must not be less than this amount
|
|
|
+ * @maximum: Buffer lengths must not be more than this amount
|
|
|
+ *
|
|
|
+ * The constraints apply to all buffers and lengths, both input and output,
|
|
|
+ * for both compression and decompression, except for the minimum which
|
|
|
+ * only applies to compression input and decompression output; the
|
|
|
+ * compressed data can be less than the minimum constraint. It can be
|
|
|
+ * assumed that compressed data will always adhere to the multiple
|
|
|
+ * constraint.
|
|
|
+ *
|
|
|
+ * The driver may succeed even if these constraints are violated;
|
|
|
+ * however the driver can return failure or suffer reduced performance
|
|
|
+ * if any constraint is not met.
|
|
|
+ */
|
|
|
+int nx842_constraints(struct nx842_constraints *c)
|
|
|
+{
|
|
|
+ struct nx842_driver *driver = get_driver();
|
|
|
+ int ret = 0;
|
|
|
+
|
|
|
+ if (!driver)
|
|
|
+ return -ENODEV;
|
|
|
+
|
|
|
+ BUG_ON(!c);
|
|
|
+ memcpy(c, driver->constraints, sizeof(*c));
|
|
|
+
|
|
|
+ put_driver(driver);
|
|
|
+
|
|
|
+ return ret;
|
|
|
+}
|
|
|
+EXPORT_SYMBOL_GPL(nx842_constraints);
|
|
|
+
|
|
|
int nx842_compress(const unsigned char *in, unsigned int in_len,
|
|
|
unsigned char *out, unsigned int *out_len,
|
|
|
void *wrkmem)
|