[PATCH i-g-t v3 1/8] lib/amdgpu: fixup print/scan formatting for files in lib

Kamil Konieczny kamil.konieczny at linux.intel.com
Mon May 26 11:27:17 UTC 2025


Hi Jan,
On 2025-05-26 at 08:07:33 +0000, Jan Sokolowski wrote:
> Compiling on other architectures than x86-64 causes a lot
> of print/scan formatting warnings.
> 
> Fix formatting by using proper formatters, eg. PRIu64.
> 
> Signed-off-by: Jan Sokolowski <jan.sokolowski at intel.com>
> Reviewed-by Vitaly Prosyak <vitaly.prosyak at amd.com>
> Cc: George Zhang <george.zhang at amd.com>
> Cc: Vitaly Prosyak <vitaly.prosyak at amd.com>
> ---
>  lib/amdgpu/amd_deadlock_helpers.c | 19 ++++++++++---------
>  1 file changed, 10 insertions(+), 9 deletions(-)
> 
> diff --git a/lib/amdgpu/amd_deadlock_helpers.c b/lib/amdgpu/amd_deadlock_helpers.c
> index 98251061c..1fcaa6745 100644
> --- a/lib/amdgpu/amd_deadlock_helpers.c
> +++ b/lib/amdgpu/amd_deadlock_helpers.c
> @@ -4,6 +4,7 @@
>   */
>  
>  #include <amdgpu.h>
> +#include <inttypes.h>
>  #include "amdgpu_drm.h"
>  #include "amd_PM4.h"
>  #include "amd_sdma.h"
> @@ -249,13 +250,13 @@ void amdgpu_wait_memory_helper(amdgpu_device_handle device_handle, unsigned int
>  			if (support_page) {
>  				snprintf(cmd, sizeof(cmd) - 1, "sudo echo  0x%x > %s",
>  							0x3 << ring_id, sysfs);
> -				igt_info("Disable other rings, keep ring: %ld and %ld enabled, cmd: %s\n", ring_id, ring_id + 1, cmd);
> +				igt_info("Disable other rings, keep ring: %" PRIu64 " and %" PRIu64 " enabled, cmd: %s\n", ring_id, ring_id + 1, cmd);
>  				ring_id++;
>  
>  			} else {
>  				snprintf(cmd, sizeof(cmd) - 1, "sudo echo  0x%x > %s",
>  							0x1 << ring_id, sysfs);
> -				igt_info("Disable other rings, keep only ring: %ld enabled, cmd: %s\n", ring_id, cmd);
> +				igt_info("Disable other rings, keep only ring: %" PRIu64 " enabled, cmd: %s\n", ring_id, cmd);
>  			}
>  			r = system(cmd);
>  			igt_assert_eq(r, 0);
> @@ -266,7 +267,7 @@ void amdgpu_wait_memory_helper(amdgpu_device_handle device_handle, unsigned int
>  
>  	/* recover the sched mask */
>  	if (sched_mask > 1) {
> -		snprintf(cmd, sizeof(cmd) - 1, "sudo echo  0x%lx > %s", sched_mask, sysfs);
> +		snprintf(cmd, sizeof(cmd) - 1, "sudo echo  0x%" SCNx64 " > %s", sched_mask, sysfs);

s/SCNx64/PRIx64/


>  		r = system(cmd);
>  		igt_assert_eq(r, 0);
>  	}
> @@ -523,12 +524,12 @@ void bad_access_ring_helper(amdgpu_device_handle device_handle, unsigned int cmd
>  			if (support_page) {
>  				snprintf(cmd, sizeof(cmd) - 1, "sudo echo  0x%x > %s",
>  						0x3 << ring_id, sysfs);
> -				igt_info("Disable other rings, keep ring: %ld and %ld enabled, cmd: %s\n", ring_id, ring_id + 1, cmd);
> +				igt_info("Disable other rings, keep ring: %" PRIu64 " and %" PRIu64 " enabled, cmd: %s\n", ring_id, ring_id + 1, cmd);
>  				ring_id++;
>  			} else {
>  				snprintf(cmd, sizeof(cmd) - 1, "sudo echo  0x%x > %s",
>  						0x1 << ring_id, sysfs);
> -				igt_info("Disable other rings, keep only ring: %ld enabled, cmd: %s\n", ring_id, cmd);
> +				igt_info("Disable other rings, keep only ring: %" PRIu64 " enabled, cmd: %s\n", ring_id, cmd);
>  			}
>  
>  			r = system(cmd);
> @@ -540,7 +541,7 @@ void bad_access_ring_helper(amdgpu_device_handle device_handle, unsigned int cmd
>  
>  	/* recover the sched mask */
>  	if (sched_mask > 1) {
> -		snprintf(cmd, sizeof(cmd) - 1, "sudo echo  0x%lx > %s", sched_mask, sysfs);
> +		snprintf(cmd, sizeof(cmd) - 1, "sudo echo  0x%" PRIx64 " > %s", sched_mask, sysfs);
>  		r = system(cmd);
>  		igt_assert_eq(r, 0);
>  	}
> @@ -592,12 +593,12 @@ void amdgpu_hang_sdma_ring_helper(amdgpu_device_handle device_handle, uint8_t ha
>  			if (support_page) {
>  				snprintf(cmd, sizeof(cmd) - 1, "sudo echo  0x%x > %s",
>  						0x3 << ring_id, sysfs);
> -				igt_info("Disable other rings, keep ring: %ld and %ld enabled, cmd: %s\n", ring_id, ring_id + 1, cmd);
> +				igt_info("Disable other rings, keep ring: %" PRIu64 " and %" PRIu64 " enabled, cmd: %s\n", ring_id, ring_id + 1, cmd);
>  				ring_id++;
>  			} else {
>  				snprintf(cmd, sizeof(cmd) - 1, "sudo echo  0x%x > %s",
>  						0x1 << ring_id, sysfs);
> -				igt_info("Disable other rings, keep only ring: %ld enabled, cmd: %s\n", ring_id, cmd);
> +				igt_info("Disable other rings, keep only ring: %" PRIu64 " enabled, cmd: %s\n", ring_id, cmd);
>  			}
>  
>  			r = system(cmd);
> @@ -609,7 +610,7 @@ void amdgpu_hang_sdma_ring_helper(amdgpu_device_handle device_handle, uint8_t ha
>  
>  	/* recover the sched mask */
>  	if (sched_mask > 1) {
> -		snprintf(cmd, sizeof(cmd) - 1, "sudo echo  0x%lx > %s", sched_mask, sysfs);
> +		snprintf(cmd, sizeof(cmd) - 1, "sudo echo  0x%" SCNx64 " > %s", sched_mask, sysfs);

s/SCNx64/PRIx64/

Regards,
Kamil

>  		r = system(cmd);
>  		igt_assert_eq(r, 0);
>  	}
> -- 
> 2.34.1
> 


More information about the igt-dev mailing list