[U-Boot] [PATCH] regmap: fix regmap_read_poll_timeout warning about sandbox_timer_add_offset

Neil Armstrong narmstrong at baylibre.com
Thu Apr 11 15:12:04 UTC 2019


When fixing sandbox test for regmap_read_poll_timeout(), the
sandbox_timer_add_offset was introduced but only defined in sandbox code
thus generating warnings when used out of sandbox :

include/regmap.h:289:2: note: in expansion of macro 'regmap_read_poll_timeout_test'
regmap_read_poll_timeout_test(map, addr, val, cond, sleep_us, \
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/spi/meson_spifc.c:169:8: note: in expansion of macro 'regmap_read_poll_timeout'
ret = regmap_read_poll_timeout(spifc->regmap, REG_SLAVE, data,
        ^~~~~~~~~~~~~~~~~~~~~~~~
drivers/spi/meson_spifc.c: In function 'meson_spifc_txrx':
include/regmap.h:277:4: warning: implicit declaration of function 'sandbox_timer_add_offset' [-Wimplicit-function-declaration]

This simply adds an empty static inline sandbox_timer_add_offset()
implementation that will be dropped by the compiler optimization routines.

Cc: Simon Glass <sjg at chromium.org>
Reported-by: Tom Rini <trini at konsulko.com>
Fixes: df9cf1cc08 ("test: dm: regmap: Fix the long test delay")
Signed-off-by: Neil Armstrong <narmstrong at baylibre.com>
---
 include/regmap.h | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/include/regmap.h b/include/regmap.h
index 8359c511d2..144cffbcc0 100644
--- a/include/regmap.h
+++ b/include/regmap.h
@@ -239,6 +239,10 @@ int regmap_raw_read_range(struct regmap *map, uint range_num, uint offset,
 #define regmap_get(map, type, member, valp) \
 	regmap_range_get(map, 0, type, member, valp)
 
+#ifndef CONFIG_SANDBOX
+static inline void sandbox_timer_add_offset(unsigned long offset) { }
+#endif
+
 /**
  * regmap_read_poll_timeout - Poll until a condition is met or a timeout occurs
  *
-- 
2.21.0



More information about the U-Boot mailing list