Skip to contentSkip to conversation

drm/vblank: Fix -Wformat compile warnings on some arches

PATCH In review Lyude Paul 3 participants 5 messages May 21, 2020 – May 23, 2020

Subsystems (2)
lore
Share & tools
lore

Lyude Paul

author
#0 lore raw

PATCH 1/1 drm/vblank: Fix -Wformat compile warnings on some arches

On some architectures like ppc64le and aarch64, compiling with -Wformat=1 will throw the following warnings:

In file included from drivers/gpu/drm/drm_vblank.c:33:
drivers/gpu/drm/drm_vblank.c: In function 'drm_update_vblank_count':
drivers/gpu/drm/drm_vblank.c:273:16: warning: format '%llu' expects argument of type 'long long unsigned int', but argument 4 has type 'long int' [-Wformat=]
DRM_DEBUG_VBL("updating vblank count on crtc %u:"
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./include/drm/drm_print.h:407:22: note: in definition of macro 'DRM_DEBUG_VBL'

    drm_dbg(DRM_UT_VBL, fmt, ##__VA_ARGS__)
                        ^~~
  drivers/gpu/drm/drm_vblank.c:274:22: note: format string is defined here
           " current=%llu, diff=%u, hw=%u hw_last=%u\n",
                     ~~~^
                     %lu

So, fix that with a typecast.

---
 drivers/gpu/drm/drm_vblank.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/drm_vblank.c +1 -1
index acb3c3f65b579..1a96db2dd16fa 100644
@@ -342,7 +342,7 @@ static void drm_update_vblank_count(struct drm_device *dev, unsigned int pipe,
 
 	DRM_DEBUG_VBL("updating vblank count on crtc %u:"
 		      " current=%llu, diff=%u, hw=%u hw_last=%u\n",
-		      pipe, atomic64_read(&vblank->count), diff,
+		      pipe, (unsigned long long)atomic64_read(&vblank->count), diff,
 		      cur_vblank, vblank->last);
 
 	if (diff == 0) {
Signature · 6 lines
2.26.2

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#1 lore raw
Quoted 32 lines · Lyude Paul

On some architectures like ppc64le and aarch64, compiling with -Wformat=1 will throw the following warnings:

In file included from drivers/gpu/drm/drm_vblank.c:33:
drivers/gpu/drm/drm_vblank.c: In function 'drm_update_vblank_count':
drivers/gpu/drm/drm_vblank.c:273:16: warning: format '%llu' expects argument of type 'long long unsigned int', but argument 4 has type 'long int' [-Wformat=]
DRM_DEBUG_VBL("updating vblank count on crtc %u:"
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./include/drm/drm_print.h:407:22: note: in definition of macro 'DRM_DEBUG_VBL'

    drm_dbg(DRM_UT_VBL, fmt, ##__VA_ARGS__)
                        ^~~
  drivers/gpu/drm/drm_vblank.c:274:22: note: format string is defined here
           " current=%llu, diff=%u, hw=%u hw_last=%u\n",
                     ~~~^
                     %lu

So, fix that with a typecast.

---
 drivers/gpu/drm/drm_vblank.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/drm_vblank.c +0 -0
index acb3c3f65b579..1a96db2dd16fa 100644

drivers/gpu/drm/drm_vblank.c static void drm_update_vblank_count(struct drm_device *dev, unsigned int pipe, · line 346

Quoted 6 lines
drivers/gpu/drm/drm_vblank.c +1 -1
@@ -342,7 +342,7 @@ static void drm_update_vblank_count(struct drm_device *dev, unsigned int pipe,
 
 	DRM_DEBUG_VBL("updating vblank count on crtc %u:"
 		      " current=%llu, diff=%u, hw=%u hw_last=%u\n",
-		      pipe, atomic64_read(&vblank->count), diff,
+		      pipe, (unsigned long long)atomic64_read(&vblank->count), diff,
 		      cur_vblank, vblank->last);

While touching this you could consider introducing drm_dbg_vbl().
An maybe as a follow-up patch replace all logging in this file with the drm_* variants.

Sam

Quoted 9 lines
drivers/gpu/drm/drm_vblank.c +0 -0
 	if (diff == 0) {
Signature · 6 lines
2.26.2

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

author
#2 lore raw
Quoted 35 lines · Sam Ravnborg
Quoted 34 lines · Lyude Paul

On some architectures like ppc64le and aarch64, compiling with -Wformat=1 will throw the following warnings:

In file included from drivers/gpu/drm/drm_vblank.c:33:
drivers/gpu/drm/drm_vblank.c: In function 'drm_update_vblank_count':
drivers/gpu/drm/drm_vblank.c:273:16: warning: format '%llu' expects argument of type 'long long unsigned int', but argument 4 has type 'long int' [-Wformat=]
DRM_DEBUG_VBL("updating vblank count on crtc %u:"
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./include/drm/drm_print.h:407:22: note: in definition of macro 'DRM_DEBUG_VBL'

    drm_dbg(DRM_UT_VBL, fmt, ##__VA_ARGS__)
                        ^~~
  drivers/gpu/drm/drm_vblank.c:274:22: note: format string is defined here
           " current=%llu, diff=%u, hw=%u hw_last=%u\n",
                     ~~~^
                     %lu

So, fix that with a typecast.

---
 drivers/gpu/drm/drm_vblank.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/drm_vblank.c +0 -0
index acb3c3f65b579..1a96db2dd16fa 100644
@@ -342,7 +342,7 @@ static void drm_update_vblank_count(struct drm_device
 *dev, unsigned int pipe,
 
Quoted 10 lines

drivers/gpu/drm/drm_vblank.c static void drm_update_vblank_count(struct drm_device *dev, unsigned int pipe, · line 346

Quoted 6 lines
drivers/gpu/drm/drm_vblank.c +1 -1
 	DRM_DEBUG_VBL("updating vblank count on crtc %u:"
 		      " current=%llu, diff=%u, hw=%u hw_last=%u\n",
-		      pipe, atomic64_read(&vblank->count), diff,
+		      pipe, (unsigned long long)atomic64_read(&vblank->count),
 diff,
 		      cur_vblank, vblank->last);

While touching this you could consider introducing drm_dbg_vbl(). An maybe as a follow-up patch replace all logging in this file with the drm_* variants.

ok - no promises when I can actually get to this though, I've got a lot on my plate ATM

Quoted 12 lines

Sam

Quoted 9 lines

if (diff == 0) {

Signature · 6 lines
2.26.2

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#3 lore raw

Hi Lyude.

Quoted 13 lines
Quoted 12 lines
Quoted 8 lines

*dev, unsigned int pipe,

drivers/gpu/drm/drm_vblank.c +1 -1
 	DRM_DEBUG_VBL("updating vblank count on crtc %u:"
 		      " current=%llu, diff=%u, hw=%u hw_last=%u\n",
-		      pipe, atomic64_read(&vblank->count), diff,
+		      pipe, (unsigned long long)atomic64_read(&vblank->count),

diff,
cur_vblank, vblank->last);

While touching this you could consider introducing drm_dbg_vbl(). An maybe as a follow-up patch replace all logging in this file with the drm_* variants.

Quoted 2 lines

ok - no promises when I can actually get to this though, I've got a lot on my plate ATM

I wnet ahead and applied this patch (after fixing a too long line), and then I updated the logging functions as suggested above. I applied the patch to drm-misc-next.

Patches with updated logging coming.

Sam

maintainer Reviewed-by on v1 1/1
#4 lore raw
In reply to Lyude Paul

Am 21.05.20 um 22:46 schrieb Lyude Paul:

Quoted 19 lines

On some architectures like ppc64le and aarch64, compiling with -Wformat=1 will throw the following warnings:

In file included from drivers/gpu/drm/drm_vblank.c:33:
drivers/gpu/drm/drm_vblank.c: In function 'drm_update_vblank_count':
drivers/gpu/drm/drm_vblank.c:273:16: warning: format '%llu' expects argument of type 'long long unsigned int', but argument 4 has type 'long int' [-Wformat=]
DRM_DEBUG_VBL("updating vblank count on crtc %u:"
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./include/drm/drm_print.h:407:22: note: in definition of macro 'DRM_DEBUG_VBL'

    drm_dbg(DRM_UT_VBL, fmt, ##__VA_ARGS__)
                        ^~~
  drivers/gpu/drm/drm_vblank.c:274:22: note: format string is defined here
           " current=%llu, diff=%u, hw=%u hw_last=%u\n",
                     ~~~^
                     %lu
Quoted 4 lines

So, fix that with a typecast.

Thanks!

Quoted 18 lines
---
 drivers/gpu/drm/drm_vblank.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/drm_vblank.c +1 -1
index acb3c3f65b579..1a96db2dd16fa 100644
@@ -342,7 +342,7 @@ static void drm_update_vblank_count(struct drm_device *dev, unsigned int pipe,
 
 	DRM_DEBUG_VBL("updating vblank count on crtc %u:"
 		      " current=%llu, diff=%u, hw=%u hw_last=%u\n",
-		      pipe, atomic64_read(&vblank->count), diff,
+		      pipe, (unsigned long long)atomic64_read(&vblank->count), diff,
 		      cur_vblank, vblank->last);
 
 	if (diff == 0) {
Signature · 6 lines
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Maxfeldstr. 5, 90409 Nürnberg, Germany
(HRB 36809, AG Nürnberg)
Geschäftsführer: Felix Imendörffer

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel