crypto: caam - Contain caam_jr_strstatus() ugliness
The tentacles of this function were firmly attached to various places in the CAAM code. Just cut them, or this cthulhu function will sprout them anew. Signed-off-by: Marek Vasut <marex@denx.de> Cc: Herbert Xu <herbert@gondor.apana.org.au> Cc: Horia Geanta <horia.geanta@freescale.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
This commit is contained in:
parent
9f84951fc6
commit
fa9659cd4d
@ -918,11 +918,8 @@ static void aead_encrypt_done(struct device *jrdev, u32 *desc, u32 err,
|
|||||||
edesc = (struct aead_edesc *)((char *)desc -
|
edesc = (struct aead_edesc *)((char *)desc -
|
||||||
offsetof(struct aead_edesc, hw_desc));
|
offsetof(struct aead_edesc, hw_desc));
|
||||||
|
|
||||||
if (err) {
|
if (err)
|
||||||
char tmp[CAAM_ERROR_STR_MAX];
|
caam_jr_strstatus(jrdev, err);
|
||||||
|
|
||||||
dev_err(jrdev, "%08x: %s\n", err, caam_jr_strstatus(tmp, err));
|
|
||||||
}
|
|
||||||
|
|
||||||
aead_unmap(jrdev, edesc, req);
|
aead_unmap(jrdev, edesc, req);
|
||||||
|
|
||||||
@ -969,11 +966,8 @@ static void aead_decrypt_done(struct device *jrdev, u32 *desc, u32 err,
|
|||||||
req->cryptlen - ctx->authsize, 1);
|
req->cryptlen - ctx->authsize, 1);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (err) {
|
if (err)
|
||||||
char tmp[CAAM_ERROR_STR_MAX];
|
caam_jr_strstatus(jrdev, err);
|
||||||
|
|
||||||
dev_err(jrdev, "%08x: %s\n", err, caam_jr_strstatus(tmp, err));
|
|
||||||
}
|
|
||||||
|
|
||||||
aead_unmap(jrdev, edesc, req);
|
aead_unmap(jrdev, edesc, req);
|
||||||
|
|
||||||
@ -1018,11 +1012,8 @@ static void ablkcipher_encrypt_done(struct device *jrdev, u32 *desc, u32 err,
|
|||||||
edesc = (struct ablkcipher_edesc *)((char *)desc -
|
edesc = (struct ablkcipher_edesc *)((char *)desc -
|
||||||
offsetof(struct ablkcipher_edesc, hw_desc));
|
offsetof(struct ablkcipher_edesc, hw_desc));
|
||||||
|
|
||||||
if (err) {
|
if (err)
|
||||||
char tmp[CAAM_ERROR_STR_MAX];
|
caam_jr_strstatus(jrdev, err);
|
||||||
|
|
||||||
dev_err(jrdev, "%08x: %s\n", err, caam_jr_strstatus(tmp, err));
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
print_hex_dump(KERN_ERR, "dstiv @"__stringify(__LINE__)": ",
|
print_hex_dump(KERN_ERR, "dstiv @"__stringify(__LINE__)": ",
|
||||||
@ -1053,11 +1044,8 @@ static void ablkcipher_decrypt_done(struct device *jrdev, u32 *desc, u32 err,
|
|||||||
|
|
||||||
edesc = (struct ablkcipher_edesc *)((char *)desc -
|
edesc = (struct ablkcipher_edesc *)((char *)desc -
|
||||||
offsetof(struct ablkcipher_edesc, hw_desc));
|
offsetof(struct ablkcipher_edesc, hw_desc));
|
||||||
if (err) {
|
if (err)
|
||||||
char tmp[CAAM_ERROR_STR_MAX];
|
caam_jr_strstatus(jrdev, err);
|
||||||
|
|
||||||
dev_err(jrdev, "%08x: %s\n", err, caam_jr_strstatus(tmp, err));
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
print_hex_dump(KERN_ERR, "dstiv @"__stringify(__LINE__)": ",
|
print_hex_dump(KERN_ERR, "dstiv @"__stringify(__LINE__)": ",
|
||||||
|
@ -633,11 +633,8 @@ static void ahash_done(struct device *jrdev, u32 *desc, u32 err,
|
|||||||
|
|
||||||
edesc = (struct ahash_edesc *)((char *)desc -
|
edesc = (struct ahash_edesc *)((char *)desc -
|
||||||
offsetof(struct ahash_edesc, hw_desc));
|
offsetof(struct ahash_edesc, hw_desc));
|
||||||
if (err) {
|
if (err)
|
||||||
char tmp[CAAM_ERROR_STR_MAX];
|
caam_jr_strstatus(jrdev, err);
|
||||||
|
|
||||||
dev_err(jrdev, "%08x: %s\n", err, caam_jr_strstatus(tmp, err));
|
|
||||||
}
|
|
||||||
|
|
||||||
ahash_unmap(jrdev, edesc, req, digestsize);
|
ahash_unmap(jrdev, edesc, req, digestsize);
|
||||||
kfree(edesc);
|
kfree(edesc);
|
||||||
@ -671,11 +668,8 @@ static void ahash_done_bi(struct device *jrdev, u32 *desc, u32 err,
|
|||||||
|
|
||||||
edesc = (struct ahash_edesc *)((char *)desc -
|
edesc = (struct ahash_edesc *)((char *)desc -
|
||||||
offsetof(struct ahash_edesc, hw_desc));
|
offsetof(struct ahash_edesc, hw_desc));
|
||||||
if (err) {
|
if (err)
|
||||||
char tmp[CAAM_ERROR_STR_MAX];
|
caam_jr_strstatus(jrdev, err);
|
||||||
|
|
||||||
dev_err(jrdev, "%08x: %s\n", err, caam_jr_strstatus(tmp, err));
|
|
||||||
}
|
|
||||||
|
|
||||||
ahash_unmap_ctx(jrdev, edesc, req, ctx->ctx_len, DMA_BIDIRECTIONAL);
|
ahash_unmap_ctx(jrdev, edesc, req, ctx->ctx_len, DMA_BIDIRECTIONAL);
|
||||||
kfree(edesc);
|
kfree(edesc);
|
||||||
@ -709,11 +703,8 @@ static void ahash_done_ctx_src(struct device *jrdev, u32 *desc, u32 err,
|
|||||||
|
|
||||||
edesc = (struct ahash_edesc *)((char *)desc -
|
edesc = (struct ahash_edesc *)((char *)desc -
|
||||||
offsetof(struct ahash_edesc, hw_desc));
|
offsetof(struct ahash_edesc, hw_desc));
|
||||||
if (err) {
|
if (err)
|
||||||
char tmp[CAAM_ERROR_STR_MAX];
|
caam_jr_strstatus(jrdev, err);
|
||||||
|
|
||||||
dev_err(jrdev, "%08x: %s\n", err, caam_jr_strstatus(tmp, err));
|
|
||||||
}
|
|
||||||
|
|
||||||
ahash_unmap_ctx(jrdev, edesc, req, digestsize, DMA_FROM_DEVICE);
|
ahash_unmap_ctx(jrdev, edesc, req, digestsize, DMA_FROM_DEVICE);
|
||||||
kfree(edesc);
|
kfree(edesc);
|
||||||
@ -747,11 +738,8 @@ static void ahash_done_ctx_dst(struct device *jrdev, u32 *desc, u32 err,
|
|||||||
|
|
||||||
edesc = (struct ahash_edesc *)((char *)desc -
|
edesc = (struct ahash_edesc *)((char *)desc -
|
||||||
offsetof(struct ahash_edesc, hw_desc));
|
offsetof(struct ahash_edesc, hw_desc));
|
||||||
if (err) {
|
if (err)
|
||||||
char tmp[CAAM_ERROR_STR_MAX];
|
caam_jr_strstatus(jrdev, err);
|
||||||
|
|
||||||
dev_err(jrdev, "%08x: %s\n", err, caam_jr_strstatus(tmp, err));
|
|
||||||
}
|
|
||||||
|
|
||||||
ahash_unmap_ctx(jrdev, edesc, req, ctx->ctx_len, DMA_TO_DEVICE);
|
ahash_unmap_ctx(jrdev, edesc, req, ctx->ctx_len, DMA_TO_DEVICE);
|
||||||
kfree(edesc);
|
kfree(edesc);
|
||||||
|
@ -103,11 +103,8 @@ static void rng_done(struct device *jrdev, u32 *desc, u32 err, void *context)
|
|||||||
bd = (struct buf_data *)((char *)desc -
|
bd = (struct buf_data *)((char *)desc -
|
||||||
offsetof(struct buf_data, hw_desc));
|
offsetof(struct buf_data, hw_desc));
|
||||||
|
|
||||||
if (err) {
|
if (err)
|
||||||
char tmp[CAAM_ERROR_STR_MAX];
|
caam_jr_strstatus(jrdev, err);
|
||||||
|
|
||||||
dev_err(jrdev, "%08x: %s\n", err, caam_jr_strstatus(tmp, err));
|
|
||||||
}
|
|
||||||
|
|
||||||
atomic_set(&bd->empty, BUF_NOT_EMPTY);
|
atomic_set(&bd->empty, BUF_NOT_EMPTY);
|
||||||
complete(&bd->filled);
|
complete(&bd->filled);
|
||||||
|
@ -243,8 +243,9 @@ static void report_cond_code_status(u32 status, char *outstr)
|
|||||||
SPRINTFCAT(outstr, "%s() not implemented", __func__, sizeof(__func__));
|
SPRINTFCAT(outstr, "%s() not implemented", __func__, sizeof(__func__));
|
||||||
}
|
}
|
||||||
|
|
||||||
char *caam_jr_strstatus(char *outstr, u32 status)
|
void caam_jr_strstatus(struct device *jrdev, u32 status)
|
||||||
{
|
{
|
||||||
|
char outstr[CAAM_ERROR_STR_MAX];
|
||||||
static const struct stat_src {
|
static const struct stat_src {
|
||||||
void (*report_ssed)(u32 status, char *outstr);
|
void (*report_ssed)(u32 status, char *outstr);
|
||||||
char *error;
|
char *error;
|
||||||
@ -265,6 +266,6 @@ char *caam_jr_strstatus(char *outstr, u32 status)
|
|||||||
if (status_src[ssrc].report_ssed)
|
if (status_src[ssrc].report_ssed)
|
||||||
status_src[ssrc].report_ssed(status, outstr);
|
status_src[ssrc].report_ssed(status, outstr);
|
||||||
|
|
||||||
return outstr;
|
dev_err(jrdev, "%08x: %s\n", status, outstr);
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(caam_jr_strstatus);
|
EXPORT_SYMBOL(caam_jr_strstatus);
|
||||||
|
@ -7,5 +7,5 @@
|
|||||||
#ifndef CAAM_ERROR_H
|
#ifndef CAAM_ERROR_H
|
||||||
#define CAAM_ERROR_H
|
#define CAAM_ERROR_H
|
||||||
#define CAAM_ERROR_STR_MAX 302
|
#define CAAM_ERROR_STR_MAX 302
|
||||||
extern char *caam_jr_strstatus(char *outstr, u32 status);
|
void caam_jr_strstatus(struct device *jrdev, u32 status);
|
||||||
#endif /* CAAM_ERROR_H */
|
#endif /* CAAM_ERROR_H */
|
||||||
|
@ -19,11 +19,8 @@ void split_key_done(struct device *dev, u32 *desc, u32 err,
|
|||||||
dev_err(dev, "%s %d: err 0x%x\n", __func__, __LINE__, err);
|
dev_err(dev, "%s %d: err 0x%x\n", __func__, __LINE__, err);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (err) {
|
if (err)
|
||||||
char tmp[CAAM_ERROR_STR_MAX];
|
caam_jr_strstatus(dev, err);
|
||||||
|
|
||||||
dev_err(dev, "%08x: %s\n", err, caam_jr_strstatus(tmp, err));
|
|
||||||
}
|
|
||||||
|
|
||||||
res->err = err;
|
res->err = err;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user