From: Simon Glass <sjg@chromium.org>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v4 09/42] spl: bootcount: Move code out of header file
Date: Thu, 14 Nov 2019 12:57:17 -0700 [thread overview]
Message-ID: <20191114195751.30357-2-sjg@chromium.org> (raw)
In-Reply-To: <20191114195751.30357-1-sjg@chromium.org>
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 <sjg@chromium.org>
---
Changes in v4: None
Changes in v3: None
Changes in v2: None
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 cc5507f757..a2ef13a41c 100644
--- a/common/spl/spl.c
+++ b/common/spl/spl.c
@@ -830,3 +830,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 8fa8cf8218..a26a385233 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.24.0.rc1.363.gb1bccd3e3d-goog
next prev parent reply other threads:[~2019-11-14 19:57 UTC|newest]
Thread overview: 60+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-11-14 19:57 [U-Boot] [PATCH v4 00/42] common: Further reduce common.h Simon Glass
2019-11-14 19:57 ` [U-Boot] [PATCH v4 01/42] common: Move older CPU functions to their own header Simon Glass
2019-11-20 0:45 ` Tom Rini
2019-11-14 19:57 ` [U-Boot] [PATCH v4 02/42] Drop CONFIG_SHOW_ACTIVITY Simon Glass
2019-11-14 19:57 ` [U-Boot] [PATCH v4 03/42] common: Drop global inclusion of status_led.h Simon Glass
2019-11-14 19:57 ` [U-Boot] [PATCH v4 04/42] status_led: Tidy up the code style Simon Glass
2019-11-14 19:57 ` [U-Boot] [PATCH v4 05/42] common: Move random-number functions into their own header Simon Glass
2019-11-14 19:57 ` [U-Boot] [PATCH v4 06/42] common: Drop linux/crc8.h Simon Glass
2019-11-14 19:57 ` [U-Boot] [PATCH v4 07/42] crc: Fix code style with crc functions Simon Glass
2019-11-14 19:57 ` [U-Boot] [PATCH v4 08/42] crc32: Use the crc.h header for " Simon Glass
2019-11-14 19:57 ` Simon Glass [this message]
2019-11-20 0:46 ` [U-Boot] [PATCH v4 09/42] spl: bootcount: Move code out of header file Tom Rini
2019-11-14 19:57 ` [U-Boot] [PATCH v4 10/42] common: Move bootcount functions to their " Simon Glass
2019-11-20 0:45 ` Tom Rini
2019-11-14 19:57 ` [U-Boot] [PATCH v4 11/42] common: Move sorting functions to their own " Simon Glass
2019-11-14 19:57 ` [U-Boot] [PATCH v4 12/42] Move strtomhz() to vsprintf.h Simon Glass
2019-11-20 0:45 ` Tom Rini
2019-11-14 19:57 ` [U-Boot] [PATCH v4 13/42] common: Move env_get_ip() to net.h Simon Glass
2019-11-18 21:27 ` Joe Hershberger
2019-11-14 19:57 ` [U-Boot] [PATCH v4 14/42] serial: usb: Correct the usbtty_...() prototypes Simon Glass
2019-11-14 19:57 ` [U-Boot] [PATCH v4 15/42] common: Move serial_printf() to the serial header Simon Glass
2019-11-14 19:57 ` [U-Boot] [PATCH v4 16/42] common: Move serial functions out of common.h Simon Glass
2019-11-14 19:57 ` [U-Boot] [PATCH v4 17/42] common: Add a new lz4.h header file Simon Glass
2019-11-14 19:57 ` [U-Boot] [PATCH v4 18/42] common: Move some time functions out of common.h Simon Glass
2019-11-14 19:57 ` [U-Boot] [PATCH v4 19/42] common: Move wait_ticks " Simon Glass
2019-11-14 19:57 ` [U-Boot] [PATCH v4 20/42] arm: pxa: Drop pxa_wait_ticks() Simon Glass
2019-11-14 19:57 ` [U-Boot] [PATCH v4 21/42] common: Move timer_get_us() function out of common.h Simon Glass
2019-11-14 19:57 ` [U-Boot] [PATCH v4 22/42] common: Move get_ticks() " Simon Glass
2019-11-14 19:57 ` [U-Boot] [PATCH v4 23/42] common: Move mii_init() " Simon Glass
2019-11-14 19:57 ` [U-Boot] [PATCH v4 24/42] common: Move some CPU functions " Simon Glass
2019-11-20 0:45 ` Tom Rini
2019-11-14 19:57 ` [U-Boot] [PATCH v4 25/42] common: Drop cpu_init() Simon Glass
2019-11-14 19:57 ` [U-Boot] [PATCH v4 26/42] common: Move checkcpu() out of common.h Simon Glass
2019-11-20 0:46 ` Tom Rini
2019-11-14 19:57 ` [U-Boot] [PATCH v4 27/42] common: Move some SMP functions " Simon Glass
2019-11-20 0:46 ` Tom Rini
2019-11-14 19:57 ` [U-Boot] [PATCH v4 28/42] arm: powerpc: Tidy up code style for cache functions Simon Glass
2019-11-14 19:57 ` [U-Boot] [PATCH v4 29/42] common: Move some cache and MMU functions out of common.h Simon Glass
2019-11-20 0:46 ` Tom Rini
2019-11-14 19:57 ` [U-Boot] [PATCH v4 30/42] common: Drop checkicache() and checkdcache() Simon Glass
2019-11-14 19:57 ` [U-Boot] [PATCH v4 31/42] common: Move ARM cache operations out of common.h Simon Glass
2019-11-15 12:46 ` Daniel Schwierzeck
2019-11-15 16:46 ` Simon Glass
2019-11-20 0:46 ` Tom Rini
2019-11-14 19:57 ` [U-Boot] [PATCH v4 32/42] arm: powerpc: Tidy up code style for interrupt functions Simon Glass
2019-11-14 19:57 ` [U-Boot] [PATCH v4 33/42] common: Move interrupt functions into a new header Simon Glass
2019-11-14 19:57 ` [U-Boot] [PATCH v4 34/42] common: Move enable/disable_interrupts out of common.h Simon Glass
2019-11-14 19:57 ` [U-Boot] [PATCH v4 35/42] common: Move command functions " Simon Glass
2019-11-14 19:57 ` [U-Boot] [PATCH v4 36/42] common: Drop board_show_dram() Simon Glass
2019-11-14 19:57 ` [U-Boot] [PATCH v4 37/42] common: Move board_get_usable_ram_top() out of common.h Simon Glass
2019-11-14 19:57 ` [U-Boot] [PATCH v4 38/42] common: Move some board functions " Simon Glass
2019-11-14 19:57 ` [U-Boot] [PATCH v4 39/42] common: Move pci_init_board() " Simon Glass
2019-11-14 19:57 ` [U-Boot] [PATCH v4 40/42] common: Move trap_init() " Simon Glass
2019-11-15 13:07 ` Daniel Schwierzeck
2019-11-14 19:57 ` [U-Boot] [PATCH v4 41/42] common: Drop get_endaddr() Simon Glass
2019-11-14 19:57 ` [U-Boot] [PATCH v4 42/42] common: Move old EEPROM functions into a new header Simon Glass
2019-11-21 22:23 ` [U-Boot] [PATCH v4 00/42] common: Further reduce common.h Simon Glass
2019-11-21 23:03 ` Tom Rini
2019-11-22 0:21 ` Simon Glass
2019-12-03 3:10 ` Tom Rini
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20191114195751.30357-2-sjg@chromium.org \
--to=sjg@chromium.org \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.