diff options
author | Stefan Roese <sr@denx.de> | 2010-09-08 15:34:58 +0200 |
---|---|---|
committer | Wolfgang Denk <wd@denx.de> | 2010-10-12 21:15:10 +0200 |
commit | f852628638654f2dfa5eee3ec6a307a17b138ba7 (patch) | |
tree | 06d273a843f009b70e1b61614550cec6585078aa /lib/zlib.c | |
parent | 6213b8ffa58ed605cefb8de25c2d103dcba56502 (diff) | |
download | u-boot-imx-f852628638654f2dfa5eee3ec6a307a17b138ba7.zip u-boot-imx-f852628638654f2dfa5eee3ec6a307a17b138ba7.tar.gz u-boot-imx-f852628638654f2dfa5eee3ec6a307a17b138ba7.tar.bz2 |
zlib/gunzip: Use WATCHDOG_RESET macro
As usually done in U-Boot, the watchdog_reset code is called via a
macro (WATCHDOG_RESET). In zlib.c this was done differently, by using
a function pointer which is initialized with WATCHDOG_RESET upon watchdog
usage or with NULL otherwise. This patch now uses the plain
WATCHDOG_RESET macros to call the function resulting in slightly smaller
U-Boot images and simpler code.
U-Boot code size reduction:
PowerPC board with watchdog support (lwmon5):
-> 80 bytes smaller image size
PowerPC board without watchdog support (sequoia):
-> 112 bytes smaller image size
Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Detlev Zundel <dzu@denx.de>
Cc: Wolfgang Denk <wd@denx.de>
Acked-by: Detlev Zundel <dzu@denx.de>
Diffstat (limited to 'lib/zlib.c')
-rw-r--r-- | lib/zlib.c | 10 |
1 files changed, 4 insertions, 6 deletions
@@ -29,6 +29,7 @@ #include <common.h> #include <compiler.h> #include <asm/unaligned.h> +#include <watchdog.h> #include "u-boot/zlib.h" #undef OFF /* avoid conflicts */ @@ -1075,8 +1076,7 @@ z_streamp strm; state->hold = 0; state->bits = 0; state->lencode = state->distcode = state->next = state->codes; - if (strm->outcb != Z_NULL) - (*strm->outcb)(Z_NULL, 0); + WATCHDOG_RESET(); Tracev((stderr, "inflate: reset\n")); return Z_OK; } @@ -1776,8 +1776,7 @@ int flush; Tracev((stderr, "inflate: codes ok\n")); state->mode = LEN; case LEN: - if (strm->outcb != Z_NULL) /* for watchdog (U-Boot) */ - (*strm->outcb)(Z_NULL, 0); + WATCHDOG_RESET(); if (have >= 6 && left >= 258) { RESTORE(); inflate_fast(strm, out); @@ -1990,8 +1989,7 @@ z_streamp strm; return Z_STREAM_ERROR; state = (struct inflate_state FAR *)strm->state; if (state->window != Z_NULL) { - if (strm->outcb != Z_NULL) - (*strm->outcb)(Z_NULL, 0); + WATCHDOG_RESET(); ZFREE(strm, state->window); } ZFREE(strm, strm->state); |