mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: Barebox List <barebox@lists.infradead.org>
Subject: [PATCH] hab/caam: Fix compilation of caam driver when hab is disabled
Date: Thu, 11 Apr 2019 11:52:58 +0200	[thread overview]
Message-ID: <20190411095258.27952-1-s.hauer@pengutronix.de> (raw)

The caam driver needs the variable habv4_need_rng_software_self_test,
but this is only declared when HABV4 is enabled. Instead of exporting
a variable rather provide a function to test if a software selftest
of the random number generator is needed.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 drivers/crypto/caam/ctrl.c | 3 +--
 drivers/hab/habv4.c        | 9 +++++++--
 include/hab.h              | 7 +++++--
 3 files changed, 13 insertions(+), 6 deletions(-)

diff --git a/drivers/crypto/caam/ctrl.c b/drivers/crypto/caam/ctrl.c
index 39910131b1..4fe3eea3e6 100644
--- a/drivers/crypto/caam/ctrl.c
+++ b/drivers/crypto/caam/ctrl.c
@@ -573,8 +573,7 @@ static int caam_probe(struct device_d *dev)
 	cha_vid_ls = rd_reg32(&ctrl->perfmon.cha_id_ls);
 
 	/* habv4_need_rng_software_self_test is determined by habv4_get_status() */
-	if (IS_ENABLED(CONFIG_CRYPTO_DEV_FSL_CAAM_RNG_SELF_TEST) &&
-	    habv4_need_rng_software_self_test) {
+	if (caam_need_rng_software_selftest()) {
 		u8 caam_era;
 		u8 rngvid;
 		u8 rngrev;
diff --git a/drivers/hab/habv4.c b/drivers/hab/habv4.c
index ca95c01e7b..6d2aabff59 100644
--- a/drivers/hab/habv4.c
+++ b/drivers/hab/habv4.c
@@ -392,8 +392,13 @@ static void habv4_display_event(uint8_t *data, uint32_t len)
  * self-test in ROM code. In this case, an HAB event is generated, and a
  * software self-test should be run. This variable is set to @c true by
  * habv4_get_status() when this occurs. */
-bool habv4_need_rng_software_self_test = false;
-EXPORT_SYMBOL(habv4_need_rng_software_self_test);
+static bool habv4_need_rng_software_self_test;
+
+bool caam_need_rng_software_selftest(void)
+{
+	return IS_ENABLED(CONFIG_CRYPTO_DEV_FSL_CAAM_RNG_SELF_TEST) &&
+		habv4_need_rng_software_self_test)
+}
 
 #define RNG_FAIL_EVENT_SIZE 36
 static uint8_t habv4_known_rng_fail_events[][RNG_FAIL_EVENT_SIZE] = {
diff --git a/include/hab.h b/include/hab.h
index 30eace7685..a74b7dafce 100644
--- a/include/hab.h
+++ b/include/hab.h
@@ -20,11 +20,10 @@
 
 #include <errno.h>
 
-extern bool habv4_need_rng_software_self_test;
-
 #ifdef CONFIG_HABV4
 int imx28_hab_get_status(void);
 int imx6_hab_get_status(void);
+bool caam_need_rng_software_selftest(void);
 #else
 static inline int imx28_hab_get_status(void)
 {
@@ -34,6 +33,10 @@ static inline int imx6_hab_get_status(void)
 {
 	return -EPERM;
 }
+static inline bool caam_need_rng_software_selftest(void)
+{
+	return false;
+}
 #endif
 
 #ifdef CONFIG_HABV3
-- 
2.20.1


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

                 reply	other threads:[~2019-04-11  9:53 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20190411095258.27952-1-s.hauer@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=barebox@lists.infradead.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