[PATCH] bios: mpcheck: make function args const, change scope of array bus_types

Colin King colin.king at canonical.com
Mon Apr 12 09:16:31 UTC 2021


From: Colin Ian King <colin.king at canonical.com>

There are some read-only function arguments that can be make const.
Also move the array bus_types into the function mpcheck_test_bus_entries
as the scope of this array is just for mpcheck_test_bus_entries.

Signed-off-by: Colin Ian King <colin.king at canonical.com>
---
 src/bios/multiproc/mpcheck.c | 52 +++++++++++++++++++-----------------
 1 file changed, 27 insertions(+), 25 deletions(-)

diff --git a/src/bios/multiproc/mpcheck.c b/src/bios/multiproc/mpcheck.c
index e9237615..793381b4 100644
--- a/src/bios/multiproc/mpcheck.c
+++ b/src/bios/multiproc/mpcheck.c
@@ -27,7 +27,7 @@ static bool fwts_mp_not_used = false;
 
 #define LEVEL(level)	fwts_mp_not_used ? LOG_LEVEL_LOW : level
 
-static bool mpcheck_find_bus(uint8_t id, int depth)
+static bool mpcheck_find_bus(const uint8_t id, const int depth)
 {
 	fwts_list_link	*entry;
 
@@ -36,6 +36,7 @@ static bool mpcheck_find_bus(uint8_t id, int depth)
 
 	fwts_list_foreach(entry, &mp_data.entries) {
 		uint8_t *data = fwts_list_data(uint8_t *, entry);
+
 		if (*data == FWTS_MP_BUS_ENTRY) {
 			fwts_mp_bus_entry *bus_entry =
 				fwts_list_data(fwts_mp_bus_entry *, entry);
@@ -63,12 +64,13 @@ static int mpcheck_test_cpu_entries(fwts_framework *fw)
 
 	fwts_list_foreach(entry1, &mp_data.entries) {
 		uint8_t *data1 = fwts_list_data(uint8_t *, entry1);
+
 		if (*data1 == FWTS_MP_CPU_ENTRY) {
 			fwts_list_link	*entry2;
 			int m = 0;
-
 			uint32_t phys_addr1 = mp_data.phys_addr +
 				((void *)data1 - (void *)mp_data.header);
+
 			fwts_mp_processor_entry *cpu_entry1 =
 				fwts_list_data(fwts_mp_processor_entry *, entry1);
 
@@ -147,28 +149,6 @@ static int mpcheck_test_cpu_entries(fwts_framework *fw)
 	return FWTS_OK;
 }
 
-static const char *const bus_types[] = {
-	"CBUS",
-	"CBUSII",
-	"EISA",
-	"FUTURE",
-	"INTERN",
-	"ISA",
-	"MBI",
-	"MBII",
-	"MCA",
-	"MPI",
-	"MPSA",
-	"NUBUS",
-	"PCI",
-	"PCMCIA",
-	"TC",
-	"VL",
-	"VME",
-	"XPRESS",
-	NULL,
-};
-
 static int mpcheck_test_bus_entries(fwts_framework *fw)
 {
 	bool failed = false;
@@ -176,6 +156,28 @@ static int mpcheck_test_bus_entries(fwts_framework *fw)
 	fwts_list_link	*entry;
 	int prev_bus_id = -1;
 
+	static const char *const bus_types[] = {
+		"CBUS",
+		"CBUSII",
+		"EISA",
+		"FUTURE",
+		"INTERN",
+		"ISA",
+		"MBI",
+		"MBII",
+		"MCA",
+		"MPI",
+		"MPSA",
+		"NUBUS",
+		"PCI",
+		"PCMCIA",
+		"TC",
+		"VL",
+		"VME",
+		"XPRESS",
+		NULL,
+	};
+
 	fwts_list_foreach(entry, &mp_data.entries) {
 		uint8_t *data = fwts_list_data(uint8_t *, entry);
 		if (*data == FWTS_MP_BUS_ENTRY) {
@@ -271,7 +273,7 @@ static int mpcheck_test_io_apic_entries(fwts_framework *fw)
 	return FWTS_OK;
 }
 
-static bool mpcheck_find_io_apic(uint8_t id)
+static bool mpcheck_find_io_apic(const uint8_t id)
 {
 	fwts_list_link	*entry;
 
-- 
2.30.2




More information about the fwts-devel mailing list