ARM: OMAP: syslib: Optimize wait_on_value() function
Subsystems (2)
PATCH 1/1 ARM: OMAP: syslib: Optimize wait_on_value() function
Saves up to 8 bytes in THUMB mode.
Signed-off-by Alexander Shiyan <[email protected]>
--- arch/arm/mach-omap/syslib.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-)
arch/arm/mach-omap/syslib.c +6 -9
@@ -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; +}
Signature · 7 lines
2.32.0 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
Sascha Hauer
AppliedQuoted 6 lines · Alexander Shiyan
Saves up to 8 bytes in THUMB mode.
Signed-off-by Alexander Shiyan <[email protected]>--- arch/arm/mach-omap/syslib.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-)
Applied, thanks
Sascha
Quoted 40 lines
arch/arm/mach-omap/syslib.c +6
-9@@ -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; +}Signature · 7 lines
2.32.0 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
Signature · 9 lines
Pengutronix e.K. | | Steuerwalder Str. 21 | http://www.pengutronix.de/ | 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox