From: Andrey Smirnov <andrew.smirnov@gmail.com>
To: linux-crypto@vger.kernel.org
Cc: "Andrey Smirnov" <andrew.smirnov@gmail.com>,
"Chris Healy" <cphealy@gmail.com>,
"Lucas Stach" <l.stach@pengutronix.de>,
"Horia Geantă" <horia.geanta@nxp.com>,
"Herbert Xu" <herbert@gondor.apana.org.au>,
"Iuliana Prodan" <iuliana.prodan@nxp.com>,
linux-imx@nxp.com, linux-kernel@vger.kernel.org
Subject: [PATCH 2/5] crypto: caam - introduce caam_jr_cbk
Date: Tue, 5 Nov 2019 07:13:50 -0800 [thread overview]
Message-ID: <20191105151353.6522-3-andrew.smirnov@gmail.com> (raw)
In-Reply-To: <20191105151353.6522-1-andrew.smirnov@gmail.com>
Coalesce multiple ad-hoc definitions of the same function pointer into
a dedicated type to avoid repetition.
Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
Cc: Chris Healy <cphealy@gmail.com>
Cc: Lucas Stach <l.stach@pengutronix.de>
Cc: Horia Geantă <horia.geanta@nxp.com>
Cc: Herbert Xu <herbert@gondor.apana.org.au>
Cc: Iuliana Prodan <iuliana.prodan@nxp.com>
Cc: linux-imx@nxp.com
Cc: linux-crypto@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
---
drivers/crypto/caam/intern.h | 3 ++-
drivers/crypto/caam/jr.c | 9 +++------
drivers/crypto/caam/jr.h | 7 ++++---
3 files changed, 9 insertions(+), 10 deletions(-)
diff --git a/drivers/crypto/caam/intern.h b/drivers/crypto/caam/intern.h
index c7c10c90464b..fe2ca2ad6ff0 100644
--- a/drivers/crypto/caam/intern.h
+++ b/drivers/crypto/caam/intern.h
@@ -11,6 +11,7 @@
#define INTERN_H
#include "ctrl.h"
+#include "jr.h"
/* Currently comes from Kconfig param as a ^2 (driver-required) */
#define JOBR_DEPTH (1 << CONFIG_CRYPTO_DEV_FSL_CAAM_RINGSIZE)
@@ -31,7 +32,7 @@
* Each entry on an output ring needs one of these
*/
struct caam_jrentry_info {
- void (*callbk)(struct device *dev, u32 *desc, u32 status, void *arg);
+ caam_jr_cbk callbk;
void *cbkarg; /* Argument per ring entry */
u32 *desc_addr_virt; /* Stored virt addr for postprocessing */
dma_addr_t desc_addr_dma; /* Stored bus addr for done matching */
diff --git a/drivers/crypto/caam/jr.c b/drivers/crypto/caam/jr.c
index 49c98a7f6723..3e78fedeea30 100644
--- a/drivers/crypto/caam/jr.c
+++ b/drivers/crypto/caam/jr.c
@@ -197,7 +197,7 @@ static void caam_jr_dequeue(unsigned long devarg)
int hw_idx, sw_idx, i, head, tail;
struct device *dev = (struct device *)devarg;
struct caam_drv_private_jr *jrp = dev_get_drvdata(dev);
- void (*usercall)(struct device *dev, u32 *desc, u32 status, void *arg);
+ caam_jr_cbk usercall;
u32 *userdesc, userstatus;
void *userarg;
u32 outring_used = 0;
@@ -354,10 +354,7 @@ EXPORT_SYMBOL(caam_jr_free);
* @areq: optional pointer to a user argument for use at callback
* time.
**/
-int caam_jr_enqueue(struct device *dev, u32 *desc,
- void (*cbk)(struct device *dev, u32 *desc,
- u32 status, void *areq),
- void *areq)
+int caam_jr_enqueue(struct device *dev, u32 *desc, caam_jr_cbk cbk, void *areq)
{
struct caam_drv_private_jr *jrp = dev_get_drvdata(dev);
struct caam_jrentry_info *head_entry;
@@ -386,7 +383,7 @@ int caam_jr_enqueue(struct device *dev, u32 *desc,
head_entry = &jrp->entinfo[head];
head_entry->desc_addr_virt = desc;
head_entry->desc_size = desc_size;
- head_entry->callbk = (void *)cbk;
+ head_entry->callbk = cbk;
head_entry->cbkarg = areq;
head_entry->desc_addr_dma = desc_dma;
diff --git a/drivers/crypto/caam/jr.h b/drivers/crypto/caam/jr.h
index eab611530f36..81acc6a6909f 100644
--- a/drivers/crypto/caam/jr.h
+++ b/drivers/crypto/caam/jr.h
@@ -9,11 +9,12 @@
#define JR_H
/* Prototypes for backend-level services exposed to APIs */
+typedef void (*caam_jr_cbk)(struct device *dev, u32 *desc, u32 status,
+ void *areq);
+
struct device *caam_jr_alloc(void);
void caam_jr_free(struct device *rdev);
-int caam_jr_enqueue(struct device *dev, u32 *desc,
- void (*cbk)(struct device *dev, u32 *desc, u32 status,
- void *areq),
+int caam_jr_enqueue(struct device *dev, u32 *desc, caam_jr_cbk cbk,
void *areq);
#endif /* JR_H */
--
2.21.0
next prev parent reply other threads:[~2019-11-05 15:14 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-11-05 15:13 [PATCH 0/5] CAAM JR lifecycle Andrey Smirnov
2019-11-05 15:13 ` [PATCH 1/5] crypto: caam - use static initialization Andrey Smirnov
2019-11-20 7:06 ` Horia Geanta
2019-11-05 15:13 ` Andrey Smirnov [this message]
2019-11-20 7:09 ` [PATCH 2/5] crypto: caam - introduce caam_jr_cbk Horia Geanta
2019-11-05 15:13 ` [PATCH 3/5] crypto: caam - convert JR API to use struct caam_drv_private_jr Andrey Smirnov
2019-11-06 9:04 ` kbuild test robot
2019-11-05 15:13 ` [PATCH 4/5] crypto: caam - do not create a platform devices for JRs Andrey Smirnov
2019-11-05 15:13 ` [PATCH 5/5] crypto: caam - disable CAAM's bind/unbind attributes Andrey Smirnov
2019-11-06 7:27 ` [PATCH 0/5] CAAM JR lifecycle Vakul Garg
2019-11-06 15:19 ` Andrey Smirnov
2019-11-13 18:57 ` Horia Geanta
2019-11-13 19:25 ` Andrey Smirnov
2019-11-17 6:15 ` Andrey Smirnov
2020-01-08 15:50 ` Andrey Smirnov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20191105151353.6522-3-andrew.smirnov@gmail.com \
--to=andrew.smirnov@gmail.com \
--cc=cphealy@gmail.com \
--cc=herbert@gondor.apana.org.au \
--cc=horia.geanta@nxp.com \
--cc=iuliana.prodan@nxp.com \
--cc=l.stach@pengutronix.de \
--cc=linux-crypto@vger.kernel.org \
--cc=linux-imx@nxp.com \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®