]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
crypto: caam - move cpu_to_caam_dma() selection to runtime
authorAndrey Smirnov <andrew.smirnov@gmail.com>
Tue, 20 Aug 2019 20:23:56 +0000 (13:23 -0700)
committerHerbert Xu <herbert@gondor.apana.org.au>
Fri, 30 Aug 2019 08:05:30 +0000 (18:05 +1000)
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
intended.

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
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
drivers/crypto/caam/regs.h

index 489d6c1eec7dc5d1eb4ec5cc9e4c3e2a37fb3500..0df4cf32fe788f3c5e60a5a34643370e85179955 100644 (file)
@@ -188,13 +188,21 @@ static inline u64 caam_dma64_to_cpu(u64 value)
        return caam64_to_cpu(value);
 }
 
-#ifdef CONFIG_ARCH_DMA_ADDR_T_64BIT
-#define cpu_to_caam_dma(value) cpu_to_caam_dma64(value)
-#define caam_dma_to_cpu(value) caam_dma64_to_cpu(value)
-#else
-#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)
+{
+       if (IS_ENABLED(CONFIG_ARCH_DMA_ADDR_T_64BIT))
+               return cpu_to_caam_dma64(value);
+       else
+               return cpu_to_caam32(value);
+}
+
+static inline u64 caam_dma_to_cpu(u64 value)
+{
+       if (IS_ENABLED(CONFIG_ARCH_DMA_ADDR_T_64BIT))
+               return caam_dma64_to_cpu(value);
+       else
+               return caam32_to_cpu(value);
+}
 
 /*
  * jr_outentry