From: Simon Glass Date: Mon, 30 Sep 2019 08:40:40 -0600 Subject: [U-Boot] [PATCH 09/41] spl: bootcount: Move code out of header file In-Reply-To: <20190930144112.175618-1-sjg@chromium.org> References: <20190930144112.175618-1-sjg@chromium.org> Message-ID: <20190930144112.175618-10-sjg@chromium.org> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de It is not good practice to write code in a header file. If it is included multiple times then the code can cause duplicate functions. Move the bootcount_store() and bootcount_load() functions into SPL. Note: bootcount is a bit strange in that it uses driver model but does not define proper drivers. This should be fixed. Signed-off-by: Simon Glass --- common/spl/spl.c | 11 +++++++++++ include/bootcount.h | 4 ---- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/common/spl/spl.c b/common/spl/spl.c index 7a443a0f322..6e3d4bd599d 100644 --- a/common/spl/spl.c +++ b/common/spl/spl.c @@ -790,3 +790,14 @@ ulong spl_relocate_stack_gd(void) return 0; #endif } + +#if defined(CONFIG_BOOTCOUNT_LIMIT) && !defined(CONFIG_SPL_BOOTCOUNT_LIMIT) +void bootcount_store(ulong a) +{ +} + +ulong bootcount_load(void) +{ + return 0; +} +#endif diff --git a/include/bootcount.h b/include/bootcount.h index 8fa8cf82181..a26a3852338 100644 --- a/include/bootcount.h +++ b/include/bootcount.h @@ -127,10 +127,6 @@ static inline void bootcount_inc(void) #endif /* !CONFIG_SPL_BUILD */ } -#if defined(CONFIG_SPL_BUILD) && !defined(CONFIG_SPL_BOOTCOUNT_LIMIT) -void bootcount_store(ulong a) {}; -ulong bootcount_load(void) { return 0; } -#endif /* CONFIG_SPL_BUILD && !CONFIG_SPL_BOOTCOUNT_LIMIT */ #else static inline int bootcount_error(void) { return 0; } static inline void bootcount_inc(void) {} -- 2.23.0.444.g18eeb5a265-goog