* [PATCH] drm/amdgpu: fix seq_printf format string
@ 2015-11-10 12:17 Arnd Bergmann
2015-11-10 20:17 ` Alex Deucher
0 siblings, 1 reply; 2+ messages in thread
From: Arnd Bergmann @ 2015-11-10 12:17 UTC (permalink / raw)
To: linux-arm-kernel
The amdgpu driver has a debugfs interface that shows the amount of
VRAM in use, but the newly added code causes a build error on
all 32-bit architectures:
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c:1076:17: warning: format '%lu' expects argument of type 'long unsigned int', but argument 4 has type 'long long int' [-Wformat=]
This fixes the format string to use "%llu" for printing 64-bit
numbers, which works everywhere, as long as we also cast to 'u64'.
Unlike atomic64_t, u64 is defined as 'unsigned long long' on
all architectures.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Fixes: a2ef8a974931 ("drm/amdgpu: add vram usage into debugfs")
---
This appeared a few weeks ago with ARM allmodconfig. I was waiting for
someone to complain about the warning on x86 first, but that apparently
has not happened.
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
index 81bb8e9fc26d..d4bac5f49939 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
@@ -1073,10 +1073,10 @@ static int amdgpu_mm_dump_table(struct seq_file *m, void *data)
ret = drm_mm_dump_table(m, mm);
spin_unlock(&glob->lru_lock);
if (ttm_pl == TTM_PL_VRAM)
- seq_printf(m, "man size:%llu pages, ram usage:%luMB, vis usage:%luMB\n",
+ seq_printf(m, "man size:%llu pages, ram usage:%lluMB, vis usage:%lluMB\n",
adev->mman.bdev.man[ttm_pl].size,
- atomic64_read(&adev->vram_usage) >> 20,
- atomic64_read(&adev->vram_vis_usage) >> 20);
+ (u64)atomic64_read(&adev->vram_usage) >> 20,
+ (u64)atomic64_read(&adev->vram_vis_usage) >> 20);
return ret;
}
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [PATCH] drm/amdgpu: fix seq_printf format string
2015-11-10 12:17 [PATCH] drm/amdgpu: fix seq_printf format string Arnd Bergmann
@ 2015-11-10 20:17 ` Alex Deucher
0 siblings, 0 replies; 2+ messages in thread
From: Alex Deucher @ 2015-11-10 20:17 UTC (permalink / raw)
To: linux-arm-kernel
On Tue, Nov 10, 2015 at 7:17 AM, Arnd Bergmann <arnd@arndb.de> wrote:
> The amdgpu driver has a debugfs interface that shows the amount of
> VRAM in use, but the newly added code causes a build error on
> all 32-bit architectures:
>
> drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c:1076:17: warning: format '%lu' expects argument of type 'long unsigned int', but argument 4 has type 'long long int' [-Wformat=]
>
> This fixes the format string to use "%llu" for printing 64-bit
> numbers, which works everywhere, as long as we also cast to 'u64'.
> Unlike atomic64_t, u64 is defined as 'unsigned long long' on
> all architectures.
>
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> Fixes: a2ef8a974931 ("drm/amdgpu: add vram usage into debugfs")
Applied. thanks!
Alex
> ---
> This appeared a few weeks ago with ARM allmodconfig. I was waiting for
> someone to complain about the warning on x86 first, but that apparently
> has not happened.
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
> index 81bb8e9fc26d..d4bac5f49939 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
> @@ -1073,10 +1073,10 @@ static int amdgpu_mm_dump_table(struct seq_file *m, void *data)
> ret = drm_mm_dump_table(m, mm);
> spin_unlock(&glob->lru_lock);
> if (ttm_pl == TTM_PL_VRAM)
> - seq_printf(m, "man size:%llu pages, ram usage:%luMB, vis usage:%luMB\n",
> + seq_printf(m, "man size:%llu pages, ram usage:%lluMB, vis usage:%lluMB\n",
> adev->mman.bdev.man[ttm_pl].size,
> - atomic64_read(&adev->vram_usage) >> 20,
> - atomic64_read(&adev->vram_vis_usage) >> 20);
> + (u64)atomic64_read(&adev->vram_usage) >> 20,
> + (u64)atomic64_read(&adev->vram_vis_usage) >> 20);
> return ret;
> }
>
>
> _______________________________________________
> dri-devel mailing list
> dri-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-11-10 20:17 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-11-10 12:17 [PATCH] drm/amdgpu: fix seq_printf format string Arnd Bergmann
2015-11-10 20:17 ` Alex Deucher
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).