ACK: [PATCH] fwts_firmware: move feature_names into fwts_firmware_feature_string

Alex Hung alex.hung at canonical.com
Sun Apr 11 20:54:34 UTC 2021


On 2021-04-11 7:33 a.m., Colin King wrote:
> From: Colin Ian King <colin.king at canonical.com>
> 
> The scope of array feature_names is limited to function
> fwts_firmware_feature_string to move the array into the function.
> Make the read-only struct field 'feature' comst.
> 
> Signed-off-by: Colin Ian King <colin.king at canonical.com>
> ---
>  src/lib/src/fwts_firmware.c | 18 +++++++++---------
>  1 file changed, 9 insertions(+), 9 deletions(-)
> 
> diff --git a/src/lib/src/fwts_firmware.c b/src/lib/src/fwts_firmware.c
> index 25517a17..ba0b939c 100644
> --- a/src/lib/src/fwts_firmware.c
> +++ b/src/lib/src/fwts_firmware.c
> @@ -26,15 +26,6 @@
>  static fwts_firmware_type firmware_type;
>  static bool firmware_type_valid;
>  
> -static const struct {
> -	fwts_firmware_feature feature;
> -	const char name[16];
> -} feature_names[] = {
> -	{ FWTS_FW_FEATURE_ACPI,		"ACPI" },
> -	{ FWTS_FW_FEATURE_DEVICETREE,	"devicetree" },
> -	{ FWTS_FW_FEATURE_IPMI,		"IPMI" },
> -};
> -
>  /*
>   *  fwts_memory_map_entry_compare()
>   *	callback used to sort memory_map entries on start address
> @@ -86,6 +77,15 @@ int fwts_firmware_features(void)
>  
>  const char *fwts_firmware_feature_string(const fwts_firmware_feature features)
>  {
> +	static const struct {
> +		const fwts_firmware_feature feature;
> +		const char name[16];
> +	} feature_names[] = {
> +		{ FWTS_FW_FEATURE_ACPI,		"ACPI" },
> +		{ FWTS_FW_FEATURE_DEVICETREE,	"devicetree" },
> +		{ FWTS_FW_FEATURE_IPMI,		"IPMI" },
> +	};
> +
>  	const int n = FWTS_ARRAY_SIZE(feature_names);
>  	static const char sep[] = ", ";
>  	static char str[60];
> 

Acked-by: Alex Hung <alex.hung at canonical.com>



More information about the fwts-devel mailing list