[PATCH 25/35] global_data: log: Reorder and shrink fields
Simon Glass
sjg at chromium.org
Wed Jul 24 17:09:12 CEST 2024
Some of the logging fields are larger than they need to be. Shrink them
and adjust the ordering to improve alignment.
Signed-off-by: Simon Glass <sjg at chromium.org>
---
include/asm-generic/global_data.h | 43 +++++++++++++++----------------
test/log/log_test.c | 6 ++---
2 files changed, 24 insertions(+), 25 deletions(-)
diff --git a/include/asm-generic/global_data.h b/include/asm-generic/global_data.h
index c8699c9e963..6ec80a2ccdf 100644
--- a/include/asm-generic/global_data.h
+++ b/include/asm-generic/global_data.h
@@ -338,6 +338,16 @@ struct global_data {
struct bootstage_data *bootstage;
#endif
#ifdef CONFIG_LOG
+ /**
+ * @log_head: list of logging devices
+ */
+ struct list_head log_head;
+ /**
+ * @log_fmt: bit mask for logging format
+ *
+ * The @log_fmt bit mask selects the fields to be shown in log messages.
+ * &enum log_fmt defines the bits of the bit mask.
+ */
/**
* @log_drop_count: number of dropped log messages
*
@@ -352,44 +362,33 @@ struct global_data {
* For logging devices without filters @default_log_level defines the
* logging level, cf. &enum log_level_t.
*/
- int default_log_level;
- /**
- * @log_head: list of logging devices
- */
- struct list_head log_head;
- /**
- * @log_fmt: bit mask for logging format
- *
- * The @log_fmt bit mask selects the fields to be shown in log messages.
- * &enum log_fmt defines the bits of the bit mask.
- */
- int log_fmt;
-
- /**
- * @processing_msg: a log message is being processed
- *
- * This flag is used to suppress the creation of additional messages
- * while another message is being processed.
- */
- bool processing_msg;
+ char default_log_level;
+ char log_fmt;
/**
* @logc_prev: logging category of previous message
*
* This value is used as logging category for continuation messages.
*/
- int logc_prev;
+ unsigned char logc_prev;
/**
* @logl_prev: logging level of the previous message
*
* This value is used as logging level for continuation messages.
*/
- int logl_prev;
+ unsigned char logl_prev;
/**
* @log_cont: Previous log line did not finished wtih \n
*
* This allows for chained log messages on the same line
*/
bool log_cont;
+ /**
+ * @processing_msg: a log message is being processed
+ *
+ * This flag is used to suppress the creation of additional messages
+ * while another message is being processed.
+ */
+ bool processing_msg;
#endif
#if CONFIG_IS_ENABLED(BLOBLIST)
/**
diff --git a/test/log/log_test.c b/test/log/log_test.c
index 855353a9c40..2ccc187916f 100644
--- a/test/log/log_test.c
+++ b/test/log/log_test.c
@@ -379,9 +379,9 @@ int log_test_level_deny(struct unit_test_state *uts)
ut_assertok(console_record_reset_enable());
log_run();
- check_log_entries_flags_levels(EXPECT_LOG | EXPECT_DIRECT | EXPECT_FORCE,
- LOGL_WARNING + 1,
- min(gd->default_log_level, LOGL_INFO));
+ check_log_entries_flags_levels(
+ EXPECT_LOG | EXPECT_DIRECT | EXPECT_FORCE,
+ LOGL_WARNING + 1, min((int)gd->default_log_level, LOGL_INFO));
ut_assertok(log_remove_filter("console", filt1));
ut_assertok(log_remove_filter("console", filt2));
--
2.34.1
More information about the U-Boot
mailing list