[prev in list] [next in list] [prev in thread] [next in thread] 

List:       fwts-devel
Subject:    ACK: [PATCH] bios: mpcheck: make function args const, change scope of array bus_types
From:       ivanhu <ivan.hu () canonical ! com>
Date:       2021-04-21 7:11:12
Message-ID: 6f70a310-88dc-f834-bc9a-c9109ee21a0d () canonical ! com
[Download RAW message or body]



On 4/12/21 5:16 PM, Colin King wrote:
> From: Colin Ian King <colin.king@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@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;
>  
> 


Acked-by: Ivan Hu <ivan.hu@canonical.com>

-- 
fwts-devel mailing list
fwts-devel@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/fwts-devel

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic