Skip to contentSkip to conversation

regmap: fix regmap_read_poll_timeout warning about sandbox_timer_add_offset

PATCH Superseded Neil Armstrong 2 participants 3 messages Apr 17, 2019 – Apr 23, 2019 Network drivers

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 regmap: fix regmap_read_poll_timeout warning about sandbox_timer_add_offset

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 fix renames the sandbox_timer_add_offset() to a generic timer_test_add_offset() function defined in time.h and renames the implementation and test usages.

Cc Simon Glass <[email protected]>
Fixes df9cf1cc08 ("test: dm: regmap: Fix the long test delay")
---
 arch/sandbox/include/asm/test.h | 8 --------
 board/sandbox/sandbox.c         | 2 +-
 drivers/net/sandbox.c           | 2 +-
 drivers/timer/sandbox_timer.c   | 2 +-
 include/regmap.h                | 2 +-
 include/time.h                  | 8 ++++++++
 6 files changed, 12 insertions(+), 12 deletions(-)
arch/sandbox/include/asm/test.h +0 -8
index fc52f47f82..e956a05262 100644
@@ -59,14 +59,6 @@ void sandbox_i2c_eeprom_set_test_mode(struct udevice *dev,
 
 void sandbox_i2c_eeprom_set_offset_len(struct udevice *dev, int offset_len);
 
-/*
- * sandbox_timer_add_offset()
- *
- * Allow tests to add to the time reported through lib/time.c functions
- * offset: number of milliseconds to advance the system time
- */
-void sandbox_timer_add_offset(unsigned long offset);
-
 /**
  * sandbox_i2c_rtc_set_offset() - set the time offset from system/base time
  *
board/sandbox/sandbox.c +1 -1
index 397e7561d4..9ca1eca027 100644
@@ -31,7 +31,7 @@ void flush_cache(unsigned long start, unsigned long size)
 /* system timer offset in ms */
 static unsigned long sandbox_timer_offset;
 
-void sandbox_timer_add_offset(unsigned long offset)
+void timer_test_add_offset(unsigned long offset)
 {
 	sandbox_timer_offset += offset;
 }
drivers/net/sandbox.c +1 -1
index decce2fa59..c136392350 100644
@@ -350,7 +350,7 @@ static int sb_eth_recv(struct udevice *dev, int flags, uchar **packetp)
 	struct eth_sandbox_priv *priv = dev_get_priv(dev);
 
 	if (skip_timeout) {
-		sandbox_timer_add_offset(11000UL);
+		timer_test_add_offset(11000UL);
 		skip_timeout = false;
 	}
 
drivers/timer/sandbox_timer.c +1 -1
index 6d2b045fe8..5228486082 100644
@@ -14,7 +14,7 @@
 /* system timer offset in ms */
 static unsigned long sandbox_timer_offset;
 
-void sandbox_timer_add_offset(unsigned long offset)
+void timer_test_add_offset(unsigned long offset)
 {
 	sandbox_timer_offset += offset;
 }
include/regmap.h +1 -1
index 8359c511d2..3cd7a66cea 100644
@@ -274,7 +274,7 @@ int regmap_raw_read_range(struct regmap *map, uint range_num, uint offset,
 		if (cond) \
 			break; \
 		if (IS_ENABLED(CONFIG_SANDBOX) && test_add_time) \
-			sandbox_timer_add_offset(test_add_time); \
+			timer_test_add_offset(test_add_time); \
 		if ((timeout_ms) && get_timer(__start) > (timeout_ms)) { \
 			__ret = regmap_read((map), (addr), &(val)); \
 			break; \
include/time.h +8 -0
index 825991e222..9fd0d73fb4 100644
@@ -13,6 +13,14 @@ unsigned long get_timer(unsigned long base);
  */
 unsigned long timer_get_us(void);
 
+/*
+ * timer_test_add_offset()
+ *
+ * Allow tests to add to the time reported through lib/time.c functions
+ * offset: number of milliseconds to advance the system time
+ */
+void timer_test_add_offset(unsigned long offset);
+
 /*
  *	These inlines deal with timer wrapping correctly. You are
  *	strongly encouraged to use them
Signature · 1 line
2.21.0
#1 lore raw

PATCH v2 1/1 regmap: fix regmap_read_poll_timeout warning about sandbox_timer_add_offset

Quoted 21 lines · Neil Armstrong

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 fix renames the sandbox_timer_add_offset() to a generic timer_test_add_offset() function defined in time.h and renames the implementation and test usages.

Cc Simon Glass <[email protected]>
Fixes df9cf1cc08 ("test: dm: regmap: Fix the long test delay")
Quoted 8 lines
---
 arch/sandbox/include/asm/test.h | 8 --------
 board/sandbox/sandbox.c         | 2 +-
 drivers/net/sandbox.c           | 2 +-
 drivers/timer/sandbox_timer.c   | 2 +-
 include/regmap.h                | 2 +-
 include/time.h                  | 8 ++++++++
 6 files changed, 12 insertions(+), 12 deletions(-)
#2 lore raw

PATCH v2 1/1 regmap: fix regmap_read_poll_timeout warning about sandbox_timer_add_offset

Quoted 31 lines · Simon Glass
Quoted 21 lines · Neil Armstrong

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 fix renames the sandbox_timer_add_offset() to a generic timer_test_add_offset() function defined in time.h and renames the implementation and test usages.

Cc Simon Glass <[email protected]>
Fixes df9cf1cc08 ("test: dm: regmap: Fix the long test delay")
Quoted 8 lines
---
 arch/sandbox/include/asm/test.h | 8 --------
 board/sandbox/sandbox.c         | 2 +-
 drivers/net/sandbox.c           | 2 +-
 drivers/timer/sandbox_timer.c   | 2 +-
 include/regmap.h                | 2 +-
 include/time.h                  | 8 ++++++++
 6 files changed, 12 insertions(+), 12 deletions(-)
Quoted 2 lines

Thanks,
Applied to u-boot-amlogic