Commit bd40bf1a authored by Ard Biesheuvel's avatar Ard Biesheuvel Committed by Herbert Xu
Browse files

crypto: cavium/zip - drop obsolete 'comp' implementation



The 'comp' API is obsolete and will be removed, so remove this comp
implementation.

Signed-off-by: default avatarArd Biesheuvel <ardb@kernel.org>
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
parent 8beb4045
Loading
Loading
Loading
Loading
+0 −40
Original line number Diff line number Diff line
@@ -195,46 +195,6 @@ static int zip_decompress(const u8 *src, unsigned int slen,
	return ret;
}

/* Legacy Compress framework start */
int zip_alloc_comp_ctx_deflate(struct crypto_tfm *tfm)
{
	struct zip_kernel_ctx *zip_ctx = crypto_tfm_ctx(tfm);

	return zip_ctx_init(zip_ctx, 0);
}

int zip_alloc_comp_ctx_lzs(struct crypto_tfm *tfm)
{
	struct zip_kernel_ctx *zip_ctx = crypto_tfm_ctx(tfm);

	return zip_ctx_init(zip_ctx, 1);
}

void zip_free_comp_ctx(struct crypto_tfm *tfm)
{
	struct zip_kernel_ctx *zip_ctx = crypto_tfm_ctx(tfm);

	zip_ctx_exit(zip_ctx);
}

int  zip_comp_compress(struct crypto_tfm *tfm,
		       const u8 *src, unsigned int slen,
		       u8 *dst, unsigned int *dlen)
{
	struct zip_kernel_ctx *zip_ctx = crypto_tfm_ctx(tfm);

	return zip_compress(src, slen, dst, dlen, zip_ctx);
}

int  zip_comp_decompress(struct crypto_tfm *tfm,
			 const u8 *src, unsigned int slen,
			 u8 *dst, unsigned int *dlen)
{
	struct zip_kernel_ctx *zip_ctx = crypto_tfm_ctx(tfm);

	return zip_decompress(src, slen, dst, dlen, zip_ctx);
} /* Legacy compress framework end */

/* SCOMP framework start */
void *zip_alloc_scomp_ctx_deflate(void)
{
+0 −11
Original line number Diff line number Diff line
@@ -46,7 +46,6 @@
#ifndef __ZIP_CRYPTO_H__
#define __ZIP_CRYPTO_H__

#include <linux/crypto.h>
#include <crypto/internal/scompress.h>
#include "common.h"
#include "zip_deflate.h"
@@ -57,16 +56,6 @@ struct zip_kernel_ctx {
	struct zip_operation zip_decomp;
};

int  zip_alloc_comp_ctx_deflate(struct crypto_tfm *tfm);
int  zip_alloc_comp_ctx_lzs(struct crypto_tfm *tfm);
void zip_free_comp_ctx(struct crypto_tfm *tfm);
int  zip_comp_compress(struct crypto_tfm *tfm,
		       const u8 *src, unsigned int slen,
		       u8 *dst, unsigned int *dlen);
int  zip_comp_decompress(struct crypto_tfm *tfm,
			 const u8 *src, unsigned int slen,
			 u8 *dst, unsigned int *dlen);

void *zip_alloc_scomp_ctx_deflate(void);
void *zip_alloc_scomp_ctx_lzs(void);
void  zip_free_scomp_ctx(void *zip_ctx);
+1 −49
Original line number Diff line number Diff line
@@ -371,36 +371,6 @@ static struct pci_driver zip_driver = {

/* Kernel Crypto Subsystem Interface */

static struct crypto_alg zip_comp_deflate = {
	.cra_name		= "deflate",
	.cra_driver_name	= "deflate-cavium",
	.cra_flags		= CRYPTO_ALG_TYPE_COMPRESS,
	.cra_ctxsize		= sizeof(struct zip_kernel_ctx),
	.cra_priority           = 300,
	.cra_module		= THIS_MODULE,
	.cra_init		= zip_alloc_comp_ctx_deflate,
	.cra_exit		= zip_free_comp_ctx,
	.cra_u			= { .compress = {
		.coa_compress	= zip_comp_compress,
		.coa_decompress	= zip_comp_decompress
		 } }
};

static struct crypto_alg zip_comp_lzs = {
	.cra_name		= "lzs",
	.cra_driver_name	= "lzs-cavium",
	.cra_flags		= CRYPTO_ALG_TYPE_COMPRESS,
	.cra_ctxsize		= sizeof(struct zip_kernel_ctx),
	.cra_priority           = 300,
	.cra_module		= THIS_MODULE,
	.cra_init		= zip_alloc_comp_ctx_lzs,
	.cra_exit		= zip_free_comp_ctx,
	.cra_u			= { .compress = {
		.coa_compress	= zip_comp_compress,
		.coa_decompress	= zip_comp_decompress
		 } }
};

static struct scomp_alg zip_scomp_deflate = {
	.alloc_ctx		= zip_alloc_scomp_ctx_deflate,
	.free_ctx		= zip_free_scomp_ctx,
@@ -431,22 +401,10 @@ static int zip_register_compression_device(void)
{
	int ret;

	ret = crypto_register_alg(&zip_comp_deflate);
	if (ret < 0) {
		zip_err("Deflate algorithm registration failed\n");
		return ret;
	}

	ret = crypto_register_alg(&zip_comp_lzs);
	if (ret < 0) {
		zip_err("LZS algorithm registration failed\n");
		goto err_unregister_alg_deflate;
	}

	ret = crypto_register_scomp(&zip_scomp_deflate);
	if (ret < 0) {
		zip_err("Deflate scomp algorithm registration failed\n");
		goto err_unregister_alg_lzs;
		return ret;
	}

	ret = crypto_register_scomp(&zip_scomp_lzs);
@@ -459,18 +417,12 @@ static int zip_register_compression_device(void)

err_unregister_scomp_deflate:
	crypto_unregister_scomp(&zip_scomp_deflate);
err_unregister_alg_lzs:
	crypto_unregister_alg(&zip_comp_lzs);
err_unregister_alg_deflate:
	crypto_unregister_alg(&zip_comp_deflate);

	return ret;
}

static void zip_unregister_compression_device(void)
{
	crypto_unregister_alg(&zip_comp_deflate);
	crypto_unregister_alg(&zip_comp_lzs);
	crypto_unregister_scomp(&zip_scomp_deflate);
	crypto_unregister_scomp(&zip_scomp_lzs);
}