Lines Matching refs:comp
46 static void zcomp_strm_free(struct zcomp *comp, struct zcomp_strm *zstrm) in zcomp_strm_free() argument
48 comp->ops->destroy_ctx(&zstrm->ctx); in zcomp_strm_free()
54 static int zcomp_strm_init(struct zcomp *comp, struct zcomp_strm *zstrm) in zcomp_strm_init() argument
58 ret = comp->ops->create_ctx(comp->params, &zstrm->ctx); in zcomp_strm_init()
69 zcomp_strm_free(comp, zstrm); in zcomp_strm_init()
75 static const struct zcomp_ops *lookup_backend_ops(const char *comp) in lookup_backend_ops() argument
80 if (sysfs_streq(comp, backends[i]->name)) in lookup_backend_ops()
87 bool zcomp_available_algorithm(const char *comp) in zcomp_available_algorithm() argument
89 return lookup_backend_ops(comp) != NULL; in zcomp_available_algorithm()
93 ssize_t zcomp_available_show(const char *comp, char *buf, ssize_t at) in zcomp_available_show() argument
98 if (!strcmp(comp, backends[i]->name)) { in zcomp_available_show()
110 struct zcomp_strm *zcomp_stream_get(struct zcomp *comp) in zcomp_stream_get() argument
113 struct zcomp_strm *zstrm = raw_cpu_ptr(comp->stream); in zcomp_stream_get()
137 int zcomp_compress(struct zcomp *comp, struct zcomp_strm *zstrm, in zcomp_compress() argument
149 ret = comp->ops->compress(comp->params, &zstrm->ctx, &req); in zcomp_compress()
155 int zcomp_decompress(struct zcomp *comp, struct zcomp_strm *zstrm, in zcomp_decompress() argument
166 return comp->ops->decompress(comp->params, &zstrm->ctx, &req); in zcomp_decompress()
171 struct zcomp *comp = hlist_entry(node, struct zcomp, node); in zcomp_cpu_up_prepare() local
172 struct zcomp_strm *zstrm = per_cpu_ptr(comp->stream, cpu); in zcomp_cpu_up_prepare()
175 ret = zcomp_strm_init(comp, zstrm); in zcomp_cpu_up_prepare()
183 struct zcomp *comp = hlist_entry(node, struct zcomp, node); in zcomp_cpu_dead() local
184 struct zcomp_strm *zstrm = per_cpu_ptr(comp->stream, cpu); in zcomp_cpu_dead()
187 zcomp_strm_free(comp, zstrm); in zcomp_cpu_dead()
192 static int zcomp_init(struct zcomp *comp, struct zcomp_params *params) in zcomp_init() argument
196 comp->stream = alloc_percpu(struct zcomp_strm); in zcomp_init()
197 if (!comp->stream) in zcomp_init()
200 comp->params = params; in zcomp_init()
201 ret = comp->ops->setup_params(comp->params); in zcomp_init()
206 mutex_init(&per_cpu_ptr(comp->stream, cpu)->lock); in zcomp_init()
208 ret = cpuhp_state_add_instance(CPUHP_ZCOMP_PREPARE, &comp->node); in zcomp_init()
215 comp->ops->release_params(comp->params); in zcomp_init()
216 free_percpu(comp->stream); in zcomp_init()
220 void zcomp_destroy(struct zcomp *comp) in zcomp_destroy() argument
222 cpuhp_state_remove_instance(CPUHP_ZCOMP_PREPARE, &comp->node); in zcomp_destroy()
223 comp->ops->release_params(comp->params); in zcomp_destroy()
224 free_percpu(comp->stream); in zcomp_destroy()
225 kfree(comp); in zcomp_destroy()
230 struct zcomp *comp; in zcomp_create() local
241 comp = kzalloc(sizeof(struct zcomp), GFP_KERNEL); in zcomp_create()
242 if (!comp) in zcomp_create()
245 comp->ops = lookup_backend_ops(alg); in zcomp_create()
246 if (!comp->ops) { in zcomp_create()
247 kfree(comp); in zcomp_create()
251 error = zcomp_init(comp, params); in zcomp_create()
253 kfree(comp); in zcomp_create()
256 return comp; in zcomp_create()