[PATCH 02/18] acpi: acpitables: print format using inttypes

IvanHu ivan.hu at canonical.com
Tue Oct 2 02:11:45 UTC 2012


On 09/24/2012 03:03 AM, Colin King wrote:
> From: Colin Ian King <colin.king at canonical.com>
>
> Signed-off-by: Colin Ian King <colin.king at canonical.com>
> ---
>   src/acpi/acpitables/acpitables.c |   97 ++++++++++++++++++++++++++------------
>   1 file changed, 68 insertions(+), 29 deletions(-)
>
> diff --git a/src/acpi/acpitables/acpitables.c b/src/acpi/acpitables/acpitables.c
> index 73c06a9..1aa3f44 100644
> --- a/src/acpi/acpitables/acpitables.c
> +++ b/src/acpi/acpitables/acpitables.c
> @@ -21,6 +21,7 @@
>   #include <dirent.h>
>   #include <ctype.h>
>   #include <unistd.h>
> +#include <inttypes.h>
>
>   #include "fwts.h"
>
> @@ -30,8 +31,9 @@ static void acpi_table_check_ecdt(fwts_framework *fw, fwts_acpi_table_info *tabl
>
>   	if ((ecdt->ec_control.address_space_id != 0) &&
>               (ecdt->ec_control.address_space_id != 1)) {
> -		fwts_failed(fw, LOG_LEVEL_MEDIUM, "ECDTECCtrlAddrSpaceID", "ECDT EC_CONTROL address space id = %hhu, "
> -				"should be 0 or 1 (System I/O Space or System Memory Space)",
> +		fwts_failed(fw, LOG_LEVEL_MEDIUM, "ECDTECCtrlAddrSpaceID",
> +				"ECDT EC_CONTROL address space id = %" PRIu8
> +				", should be 0 or 1 (System I/O Space or System Memory Space)",
>   				ecdt->ec_control.address_space_id);
>   		fwts_advice(fw, "The ECDT EC_CONTROL address space id was invalid, however the kernel ACPI EC driver "
>   				"will just assume it an I/O port address.  This will not affect "
> @@ -40,8 +42,9 @@ static void acpi_table_check_ecdt(fwts_framework *fw, fwts_acpi_table_info *tabl
>
>   	if ((ecdt->ec_data.address_space_id != 0) &&
>               (ecdt->ec_data.address_space_id != 1)) {
> -		fwts_failed(fw, LOG_LEVEL_MEDIUM, "ECDTECDataAddrSpaceID", "ECDT EC_CONTROL address space id = %hhu, "
> -				"should be 0 or 1 (System I/O Space or System Memory Space)",
> +		fwts_failed(fw, LOG_LEVEL_MEDIUM, "ECDTECDataAddrSpaceID",
> +				"ECDT EC_CONTROL address space id = %" PRIu8
> +				", should be 0 or 1 (System I/O Space or System Memory Space)",
>   				ecdt->ec_data.address_space_id);
>   		fwts_advice(fw, "The ECDT EC_DATA address space id was invalid, however the kernel ACPI EC driver "
>   				"will just assume it an I/O port address.  This will not affect "
> @@ -97,8 +100,11 @@ static void acpi_table_check_fadt(fwts_framework *fw, fwts_acpi_table_info *tabl
>   						"If FIRMWARE_CTRL and X_FIRMWARE_CTRL are defined, then the kernel just uses the 64 bit version of "
>   						"the pointer.");
>   				if (((uint64_t)fadt->firmware_control != fadt->x_firmware_ctrl)) {
> -					fwts_failed(fw, LOG_LEVEL_MEDIUM, "FwCtrl32and64Differ", "FIRMWARE_CONTROL is 0x%x and differs from X_FIRMWARE_CONTROL 0x%llx",
> -						(unsigned int)fadt->firmware_control, (unsigned long long int)fadt->x_firmware_ctrl);
> +					fwts_failed(fw, LOG_LEVEL_MEDIUM, "FwCtrl32and64Differ",
> +						"FIRMWARE_CONTROL is 0x%" PRIx32 " and differs "
> +						"from X_FIRMWARE_CONTROL 0x%" PRIx64,
> +						fadt->firmware_control,
> +						fadt->x_firmware_ctrl);
>   					fwts_advice(fw, "One would expect the 32 bit FIRMWARE_CTRL and 64 bit X_FIRMWARE_CTRL "
>   							"pointers to point to the same FACS, however they don't which is clearly ambiguous and wrong. "
>   							"The kernel works around this by using the 64 bit X_FIRMWARE_CTRL pointer to the FACS. ");
> @@ -115,8 +121,10 @@ static void acpi_table_check_fadt(fwts_framework *fw, fwts_acpi_table_info *tabl
>   			fwts_advice(fw, "An ACPI 2.0 FADT is being used however the 64 bit X_DSDT is null."
>   					"The kernel will fall back to using the 32 bit DSDT pointer instead.");
>   		} else if ((uint64_t)fadt->dsdt != fadt->x_dsdt) {
> -			fwts_failed(fw, LOG_LEVEL_MEDIUM, "FADT32And64Mismatch", "FADT 32 bit DSDT (0x%x) does not point to same physical address as 64 bit X_DSDT (0x%llx).",
> -				(unsigned int)fadt->dsdt, (unsigned long long int)fadt->x_dsdt);
> +			fwts_failed(fw, LOG_LEVEL_MEDIUM, "FADT32And64Mismatch",
> +				"FADT 32 bit DSDT (0x%" PRIx32 ") does not point to same "
> +				"physical address as 64 bit X_DSDT (0x%" PRIx64 ").",
> +				fadt->dsdt, fadt->x_dsdt);
>   			fwts_advice(fw, "One would expect the 32 bit DSDT and 64 bit X_DSDT "
>   					"pointers to point to the same DSDT, however they don't which is clearly ambiguous and wrong. "
>   					"The kernel works around this by using the 64 bit X_DSDT pointer to the DSDT. ");
> @@ -146,19 +154,22 @@ static void acpi_table_check_fadt(fwts_framework *fw, fwts_acpi_table_info *tabl
>   	}
>
>   	if (fadt->pm_tmr_len != 4) {
> -		fwts_failed(fw, LOG_LEVEL_MEDIUM, "FADTBadPMTMRLEN", "FADT PM_TMR_LEN is %hhu, should be 4.", fadt->pm_tmr_len);
> +		fwts_failed(fw, LOG_LEVEL_MEDIUM, "FADTBadPMTMRLEN",
> +			"FADT PM_TMR_LEN is %" PRIu8 ", should be 4.", fadt->pm_tmr_len);
>   		fwts_advice(fw, "FADT field PM_TMR_LEN defines the number of bytes decoded by PM_TMR_BLK. "
>   				"This fields value must be 4. If it is not the correct size then the kernel "
>   				"will not request a region for the pm timer block. ");
>   	}
>   	if (fadt->gpe0_blk_len & 1) {
> -		fwts_failed(fw, LOG_LEVEL_MEDIUM, "FADTBadGPEBLKLEN", "FADT GPE0_BLK_LEN is %hhu, should a multiple of 2.", (int)fadt->gpe0_blk_len);
> +		fwts_failed(fw, LOG_LEVEL_MEDIUM, "FADTBadGPEBLKLEN", "FADT GPE0_BLK_LEN is %" PRIu8
> +			", should a multiple of 2.", fadt->gpe0_blk_len);
>   		fwts_advice(fw, "The FADT GPE_BLK_LEN should be a multiple of 2. Because it isn't, the ACPI driver will "
>   				"not map in the GPE0 region. This could mean that General Purpose Events will not "
>   				"function correctly (for example lid or ac-power events).");
>   	}
>   	if (fadt->gpe1_blk_len & 1) {
> -		fwts_failed(fw, LOG_LEVEL_MEDIUM, "FADTBadGPE1BLKLEN", "FADT GPE1_BLK_LEN is %hhu, should a multiple of 2.", fadt->gpe1_blk_len);
> +		fwts_failed(fw, LOG_LEVEL_MEDIUM, "FADTBadGPE1BLKLEN", "FADT GPE1_BLK_LEN is %" PRIu8
> +			", should a multiple of 2.", fadt->gpe1_blk_len);
>   		fwts_advice(fw, "The FADT GPE_BLK_LEN should be a multiple of 2. Because it isn't, the ACPI driver will "
>   				"not map in the GPE1 region. This could mean that General Purpose Events will not "
>   				"function correctly (for example lid or ac-power events).");
> @@ -173,13 +184,15 @@ static void acpi_table_check_fadt(fwts_framework *fw, fwts_acpi_table_info *tabl
>   	 */
>   	/*
>   	if (fadt->p_lvl2_lat > 100) {
> -		fwts_warning(fw, "FADT P_LVL2_LAT is %hu, a value > 100 indicates a system not to support a C2 state.", fadt->p_lvl2_lat);
> +		fwts_warning(fw, "FADT P_LVL2_LAT is %" PRIi16 ", a value > 100 indicates a "
> +			"system not to support a C2 state.", fadt->p_lvl2_lat);

Shouldn't it be PRIu16?

Since it doesn't affect the result,

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



>   		fwts_advice(fw, "The FADT P_LVL2_LAT setting specifies the C2 latency in microseconds. The ACPI specification "
>   				"states that a value > 100 indicates that C2 is not supported and hence the "
>   				"ACPI processor idle routine will not use C2 power states.");
>   	}




More information about the fwts-devel mailing list