[PATCH i-g-t v2 5/8] lib/xe/xe_sriov*: fixup print/scan formatting for files in lib

Bernatowicz, Marcin marcin.bernatowicz at linux.intel.com
Fri May 23 13:21:57 UTC 2025



On 5/19/2025 1:30 PM, 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. SCNu64.
> 
> Signed-off-by: Jan Sokolowski <jan.sokolowski at intel.com>
> Cc: Lukasz Laguna <lukasz.laguna at intel.com>
> Cc: Marcin Bernatowicz <marcin.bernatowicz at linux.intel.com>
> ---
>   lib/xe/xe_sriov_debugfs.c      | 18 +++++++++---------
>   lib/xe/xe_sriov_provisioning.c |  2 +-
>   2 files changed, 10 insertions(+), 10 deletions(-)
> 
> diff --git a/lib/xe/xe_sriov_debugfs.c b/lib/xe/xe_sriov_debugfs.c
> index 8f30fa312..9b743f657 100644
> --- a/lib/xe/xe_sriov_debugfs.c
> +++ b/lib/xe/xe_sriov_debugfs.c
> @@ -105,18 +105,18 @@ static int parse_provisioned_range(const char *line,
>   	switch (res) {
>   	case XE_SRIOV_SHARED_RES_CONTEXTS:
>   	case XE_SRIOV_SHARED_RES_DOORBELLS:
> -		if (sscanf(line, "VF%u: %lu-%lu", &range->vf_id, &range->start, &range->end) == 3)
> +		if (sscanf(line, "VF%u: %" SCNu64 "-%" SCNu64, &range->vf_id, &range->start, &range->end) == 3)
>   			ret = 0;
>   		break;
>   	case XE_SRIOV_SHARED_RES_GGTT:
> -		if (sscanf(line, "VF%u: %lx-%lx", &range->vf_id, &range->start, &range->end) == 3)
> +		if (sscanf(line, "VF%u: %" SCNx64 "-%" SCNx64, &range->vf_id, &range->start, &range->end) == 3)
>   			ret = 0;
>   		break;
>   	case XE_SRIOV_SHARED_RES_LMEM:
>   		/* Convert to an inclusive range as is the case for other resources.
>   		 * The start is always 0 and the end is the value read - 1.
>   		 */
> -		if (sscanf(line, "VF%u: %lu", &range->vf_id, &range->end) == 2)
> +		if (sscanf(line, "VF%u: %" SCNu64, &range->vf_id, &range->end) == 2)
>   			ret = 0;
>   		if (!range->end)
>   			return -1;
> @@ -232,8 +232,8 @@ static int validate_vf_ids(enum xe_sriov_shared_res res,
>   				  nr_ranges);
>   			for (unsigned int i = 0; i < limit; i++) {
>   				igt_debug((res == XE_SRIOV_SHARED_RES_GGTT) ?
> -						  "%s:VF%u: %lx-%lx\n" :
> -						  "%s:VF%u: %lu-%lu\n",
> +						  "%s:VF%u: %" PRIx64 "-%" PRIx64 "\n" :
> +						  "%s:VF%u: %" PRIu64 "-%" PRIu64 "\n",
>   					  xe_sriov_shared_res_to_string(res),
>   					  ranges[i].vf_id, ranges[i].start, ranges[i].end);
>   			}
> @@ -504,16 +504,16 @@ int __xe_sriov_vf_debugfs_get_selfconfig(int vf, enum xe_sriov_shared_res res,
>   	while (getline(&line, &n, file) >= 0) {
>   		switch (res) {
>   		case XE_SRIOV_SHARED_RES_CONTEXTS:
> -			ret = sscanf(line, "GuC contexts: %lu", value);
> +			ret = sscanf(line, "GuC contexts: %" SCNu64, value);
>   			break;
>   		case XE_SRIOV_SHARED_RES_DOORBELLS:
> -			ret = sscanf(line, "GuC doorbells: %lu", value);
> +			ret = sscanf(line, "GuC doorbells: %" SCNu64, value);
>   			break;
>   		case XE_SRIOV_SHARED_RES_GGTT:
> -			ret = sscanf(line, "GGTT size: %lu", value);
> +			ret = sscanf(line, "GGTT size: %" SCNu64, value);
>   			break;
>   		case XE_SRIOV_SHARED_RES_LMEM:
> -			ret = sscanf(line, "LMEM size: %lu", value);
> +			ret = sscanf(line, "LMEM size: %" SCNu64, value);
>   			break;
>   		}
>   
> diff --git a/lib/xe/xe_sriov_provisioning.c b/lib/xe/xe_sriov_provisioning.c
> index aa265247e..2a02f7cc8 100644
> --- a/lib/xe/xe_sriov_provisioning.c
> +++ b/lib/xe/xe_sriov_provisioning.c
> @@ -75,7 +75,7 @@ static int append_range(struct xe_sriov_provisioned_range **ranges,
>   
>   	*ranges = new_ranges;
>   	if (*nr_ranges < MAX_DEBUG_ENTRIES)
> -		igt_debug("Found VF%u GGTT range [%#x-%#x] num_ptes=%ld\n",
> +		igt_debug("Found VF%u GGTT range [%#x-%#x] num_ptes=%zu\n",
>   			  vf_id, start, end,
>   			  (end - start + sizeof(xe_ggtt_pte_t)) /
>   			  sizeof(xe_ggtt_pte_t));
LGTM,
Reviewed-by: Marcin Bernatowicz <marcin.bernatowicz at linux.intel.com>


More information about the igt-dev mailing list