diff options
author | Alexander Shiyan <eagle.alexander923@gmail.com> | 2022-06-06 09:40:34 +0300 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2022-06-09 09:36:53 +0200 |
commit | 17423de8649345d3e41165d013e0ec28a35711bb (patch) | |
tree | 5cf08b33d3fb863341c48b12003fa3dbae1a3d70 /arch/arm/mach-omap | |
parent | 6e51c28558cb480c2d21c0590138d9408801651a (diff) | |
download | barebox-17423de8649345d3e41165d013e0ec28a35711bb.tar.gz barebox-17423de8649345d3e41165d013e0ec28a35711bb.tar.xz |
ARM: OMAP: syslib: Optimize wait_on_value() function
Saves up to 8 bytes in THUMB mode.
Signed-off-by: Alexander Shiyan <eagle.alexander923@gmail.com>
Link: https://lore.barebox.org/20220606064034.9568-1-eagle.alexander923@gmail.com
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'arch/arm/mach-omap')
-rw-r--r-- | arch/arm/mach-omap/syslib.c | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/arch/arm/mach-omap/syslib.c b/arch/arm/mach-omap/syslib.c index 42da348c5a..488f0ab859 100644 --- a/arch/arm/mach-omap/syslib.c +++ b/arch/arm/mach-omap/syslib.c @@ -52,19 +52,16 @@ void sdelay(unsigned long loops) * @param[in] read_addr address to read from * @param[in] bound max iterations * - * @return 1 if match_value is found, else if bound iterations reached, + * @return non zero if match_value is found, else if bound iterations reached, * returns 0 */ u32 wait_on_value(u32 read_bit_mask, u32 match_value, u32 read_addr, u32 bound) { - u32 i = 0, val; do { - ++i; - val = readl(read_addr) & read_bit_mask; + u32 val = readl(read_addr) & read_bit_mask; if (val == match_value) - return 1; - if (i == bound) - return 0; - } while (1); -} + break; + } while (--bound); + return bound; +} |