1 // SPDX-License-Identifier: GPL-2.0-or-later
3 #include <linux/kernel.h>
4 #include <linux/slab.h>
5 #include <linux/sw842.h>
6 #include <linux/vmalloc.h>
8 #include "backend_842.h"
10 static void release_params_842(struct zcomp_params
*params
)
14 static int setup_params_842(struct zcomp_params
*params
)
19 static void destroy_842(struct zcomp_ctx
*ctx
)
24 static int create_842(struct zcomp_params
*params
, struct zcomp_ctx
*ctx
)
26 ctx
->context
= kmalloc(SW842_MEM_COMPRESS
, GFP_KERNEL
);
32 static int compress_842(struct zcomp_params
*params
, struct zcomp_ctx
*ctx
,
33 struct zcomp_req
*req
)
35 unsigned int dlen
= req
->dst_len
;
38 ret
= sw842_compress(req
->src
, req
->src_len
, req
->dst
, &dlen
,
45 static int decompress_842(struct zcomp_params
*params
, struct zcomp_ctx
*ctx
,
46 struct zcomp_req
*req
)
48 unsigned int dlen
= req
->dst_len
;
50 return sw842_decompress(req
->src
, req
->src_len
, req
->dst
, &dlen
);
53 const struct zcomp_ops backend_842
= {
54 .compress
= compress_842
,
55 .decompress
= decompress_842
,
56 .create_ctx
= create_842
,
57 .destroy_ctx
= destroy_842
,
58 .setup_params
= setup_params_842
,
59 .release_params
= release_params_842
,