diff options
author | Simon Glass <sjg@chromium.org> | 2011-06-16 13:11:41 -0700 |
---|---|---|
committer | Simon Glass <sjg@chromium.org> | 2011-08-29 10:39:31 -0700 |
commit | fea2a094904aa9fd76ae423339927dcd2e058049 (patch) | |
tree | d99fb80e4567509f238fe67d66694f03be58ca42 /arch | |
parent | 84d9e903f1b6d9c48e3615fd4bb5b2eee3ff79a4 (diff) |
Add assert() for debug assertions
assert() is like BUG_ON() but compiles to nothing unless DEBUG is defined.
This is useful when a condition is an error but a board reset is unlikely
to fix it, so it is better to soldier on in hope. Assertion failures should
be caught during development/test.
It turns out that assert() is defined separately in a few places in U-Boot
with various meanings.
Build errors exposed by this change (and defining DEBUG) are also fixed in
this commit.
BUG=chromium-os:11623
TEST=build U-Boot for seaboard
Change-Id: I27500491d2328405694bfd65ab991d42d9641927
Reviewed-on: http://gerrit.chromium.org/gerrit/2777
Tested-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anton Staaf <robotboy@chromium.org>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/arm/cpu/armv7/tegra2/clock.c | 11 | ||||
-rw-r--r-- | arch/arm/cpu/armv7/tegra2/pinmux.c | 8 | ||||
-rw-r--r-- | arch/arm/include/asm/arch-tegra2/pinmux.h | 4 |
3 files changed, 4 insertions, 19 deletions
diff --git a/arch/arm/cpu/armv7/tegra2/clock.c b/arch/arm/cpu/armv7/tegra2/clock.c index 55d955aefde..fe7f4a30305 100644 --- a/arch/arm/cpu/armv7/tegra2/clock.c +++ b/arch/arm/cpu/armv7/tegra2/clock.c @@ -30,14 +30,6 @@ #include <common.h> #include <div64.h> -#ifdef DEBUG -#define assert(x) \ - ({ if (!(x)) printf("Assertion failure '%s' %s line %d\n", \ - #x, __FILE__, __LINE__); }) -#else -#define assert(x) -#endif - /* * This is our record of the current clock rate of each clock. We don't * fill all of these in since we are only really interested in clocks which @@ -677,7 +669,8 @@ unsigned clock_adjust_periph_pll_div(enum periph_id periph_id, if (adjust_periph_pll(periph_id, parent, divider)) return -1U; debug("periph %d, rate=%d, reg=%p = %x\n", periph_id, rate, - reg, readl(get_periph_source_reg(periph_id))); + get_periph_source_reg(periph_id), + readl(get_periph_source_reg(periph_id))); /* Check what we ended up with. This shouldn't matter though */ effective_rate = clock_get_periph_rate(periph_id, parent); diff --git a/arch/arm/cpu/armv7/tegra2/pinmux.c b/arch/arm/cpu/armv7/tegra2/pinmux.c index 4334e7b6edd..013a39aca15 100644 --- a/arch/arm/cpu/armv7/tegra2/pinmux.c +++ b/arch/arm/cpu/armv7/tegra2/pinmux.c @@ -27,14 +27,6 @@ #include <asm/arch/pinmux.h> #include <common.h> -#ifdef DEBUG -#define assert(x) \ - ({ if (!(x)) printf("Assertion failure '%s' %s line %d\n", \ - #x, __FILE__, __LINE__); }) -#else -#define assert(x) -#endif - /* * This defines the order of the pin mux control bits in the registers. For * some reason there is no correspendence between the tristate, pin mux and diff --git a/arch/arm/include/asm/arch-tegra2/pinmux.h b/arch/arm/include/asm/arch-tegra2/pinmux.h index c4be95cf08e..469d742cc30 100644 --- a/arch/arm/include/asm/arch-tegra2/pinmux.h +++ b/arch/arm/include/asm/arch-tegra2/pinmux.h @@ -259,8 +259,8 @@ enum pmux_func { }; /* return 1 if a pmux_func is in range */ -#define pmux_func_isvalid(func) ((func) >= 0 && (func) < FUNC_COUNT && \ - (func) != FUNC_RSVD) +#define pmux_func_isvalid(func) ((func) >= 0 && (func) < PMUX_FUNC_COUNT && \ + (func) != PMUX_FUNC_RSVD) /* The pullup/pulldown state of a pin group */ enum pmux_pull { |