[v7,10/15] crypto: caam - move cpu_to_caam_dma() selection to runtime
diff mbox series

Message ID 20190812200739.30389-11-andrew.smirnov@gmail.com
State Superseded
Delegated to: Herbert Xu
Headers show
  • crypto: caam - Add i.MX8MQ support
Related show

Commit Message

Andrey Smirnov Aug. 12, 2019, 8:07 p.m. UTC
Instead of selecting the implementation of
cpu_to_caam_dma()/caam_dma_to_cpu() at build time using the
preprocessor, convert the code to do that at run-time using IS_ENABLED
macro. This is needed to add support for i.MX8MQ. No functional change

Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
Cc: Chris Spencer <christopher.spencer@sea.co.uk>
Cc: Cory Tusar <cory.tusar@zii.aero>
Cc: Chris Healy <cphealy@gmail.com>
Cc: Lucas Stach <l.stach@pengutronix.de>
Cc: Horia Geantă <horia.geanta@nxp.com>
Cc: Aymen Sghaier <aymen.sghaier@nxp.com>
Cc: Leonard Crestez <leonard.crestez@nxp.com>
Cc: linux-crypto@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
 drivers/crypto/caam/regs.h | 22 +++++++++++++++-------
 1 file changed, 15 insertions(+), 7 deletions(-)

diff mbox series

diff --git a/drivers/crypto/caam/regs.h b/drivers/crypto/caam/regs.h
index fb494d14f262..511e28ba740a 100644
--- a/drivers/crypto/caam/regs.h
+++ b/drivers/crypto/caam/regs.h
@@ -188,13 +188,21 @@  static inline u64 caam_dma64_to_cpu(u64 value)
 	return caam64_to_cpu(value);
-#define cpu_to_caam_dma(value) cpu_to_caam_dma64(value)
-#define caam_dma_to_cpu(value) caam_dma64_to_cpu(value)
-#define cpu_to_caam_dma(value) cpu_to_caam32(value)
-#define caam_dma_to_cpu(value) caam32_to_cpu(value)
-#endif /* CONFIG_ARCH_DMA_ADDR_T_64BIT */
+static inline u64 cpu_to_caam_dma(u64 value)
+		return cpu_to_caam_dma64(value);
+	else
+		return cpu_to_caam32(value);
+static inline u64 caam_dma_to_cpu(u64 value)
+		return caam_dma64_to_cpu(value);
+	else
+		return caam32_to_cpu(value);
  * jr_outentry