dri-devel Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH] drm/vblank: Fix -Wformat compile warnings on some arches
@ 2020-05-21 20:46 Lyude Paul
  2020-05-21 21:09 ` Sam Ravnborg
  2020-05-22  6:30 ` Thomas Zimmermann
  0 siblings, 2 replies; 5+ messages in thread
From: Lyude Paul @ 2020-05-21 20:46 UTC (permalink / raw)
  To: dri-devel; +Cc: Thomas Zimmermann, David Airlie, linux-kernel, Dave Airlie

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.

Signed-off-by: Lyude Paul <lyude@redhat.com>
Co-developed-by: Dave Airlie <airlied@redhat.com>
---
 drivers/gpu/drm/drm_vblank.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/drm_vblank.c b/drivers/gpu/drm/drm_vblank.c
index acb3c3f65b579..1a96db2dd16fa 100644
--- a/drivers/gpu/drm/drm_vblank.c
+++ b/drivers/gpu/drm/drm_vblank.c
@@ -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) {
-- 
2.26.2

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] drm/vblank: Fix -Wformat compile warnings on some arches
  2020-05-21 20:46 [PATCH] drm/vblank: Fix -Wformat compile warnings on some arches Lyude Paul
@ 2020-05-21 21:09 ` Sam Ravnborg
  2020-05-22 18:18   ` Lyude Paul
  2020-05-22  6:30 ` Thomas Zimmermann
  1 sibling, 1 reply; 5+ messages in thread
From: Sam Ravnborg @ 2020-05-21 21:09 UTC (permalink / raw)
  To: Lyude Paul
  Cc: David Airlie, Dave Airlie, Thomas Zimmermann, dri-devel, linux-kernel

On Thu, May 21, 2020 at 04:46:47PM -0400, Lyude Paul wrote:
> 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.
> 
> Signed-off-by: Lyude Paul <lyude@redhat.com>
> Co-developed-by: Dave Airlie <airlied@redhat.com>
> ---
>  drivers/gpu/drm/drm_vblank.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/drm_vblank.c b/drivers/gpu/drm/drm_vblank.c
> index acb3c3f65b579..1a96db2dd16fa 100644
> --- a/drivers/gpu/drm/drm_vblank.c
> +++ b/drivers/gpu/drm/drm_vblank.c
> @@ -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

>  
>  	if (diff == 0) {
> -- 
> 2.26.2
> 
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] drm/vblank: Fix -Wformat compile warnings on some arches
  2020-05-21 20:46 [PATCH] drm/vblank: Fix -Wformat compile warnings on some arches Lyude Paul
  2020-05-21 21:09 ` Sam Ravnborg
@ 2020-05-22  6:30 ` Thomas Zimmermann
  1 sibling, 0 replies; 5+ messages in thread
From: Thomas Zimmermann @ 2020-05-22  6:30 UTC (permalink / raw)
  To: Lyude Paul, dri-devel; +Cc: David Airlie, linux-kernel, Dave Airlie

[-- Attachment #1.1.1: Type: text/plain, Size: 2077 bytes --]



Am 21.05.20 um 22:46 schrieb 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.
> 
> Signed-off-by: Lyude Paul <lyude@redhat.com>
> Co-developed-by: Dave Airlie <airlied@redhat.com>

Reviewed-by: Thomas Zimmermann <tzimmermann@suse.de>

Thanks!

> ---
>  drivers/gpu/drm/drm_vblank.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/drm_vblank.c b/drivers/gpu/drm/drm_vblank.c
> index acb3c3f65b579..1a96db2dd16fa 100644
> --- a/drivers/gpu/drm/drm_vblank.c
> +++ b/drivers/gpu/drm/drm_vblank.c
> @@ -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) {
> 

-- 
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


[-- Attachment #1.2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

[-- Attachment #2: Type: text/plain, Size: 160 bytes --]

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] drm/vblank: Fix -Wformat compile warnings on some arches
  2020-05-21 21:09 ` Sam Ravnborg
@ 2020-05-22 18:18   ` Lyude Paul
  2020-05-23  6:54     ` Sam Ravnborg
  0 siblings, 1 reply; 5+ messages in thread
From: Lyude Paul @ 2020-05-22 18:18 UTC (permalink / raw)
  To: Sam Ravnborg
  Cc: David Airlie, Dave Airlie, Thomas Zimmermann, dri-devel, linux-kernel

On Thu, 2020-05-21 at 23:09 +0200, Sam Ravnborg wrote:
> On Thu, May 21, 2020 at 04:46:47PM -0400, Lyude Paul wrote:
> > 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.
> > 
> > Signed-off-by: Lyude Paul <lyude@redhat.com>
> > Co-developed-by: Dave Airlie <airlied@redhat.com>
> > ---
> >  drivers/gpu/drm/drm_vblank.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/drivers/gpu/drm/drm_vblank.c b/drivers/gpu/drm/drm_vblank.c
> > index acb3c3f65b579..1a96db2dd16fa 100644
> > --- a/drivers/gpu/drm/drm_vblank.c
> > +++ b/drivers/gpu/drm/drm_vblank.c
> > @@ -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.

ok - no promises when I can actually get to this though, I've got a lot on my
plate ATM
> 
> 	Sam
> 
> >  
> >  	if (diff == 0) {
> > -- 
> > 2.26.2
> > 
> > _______________________________________________
> > dri-devel mailing list
> > dri-devel@lists.freedesktop.org
> > https://lists.freedesktop.org/mailman/listinfo/dri-devel

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] drm/vblank: Fix -Wformat compile warnings on some arches
  2020-05-22 18:18   ` Lyude Paul
@ 2020-05-23  6:54     ` Sam Ravnborg
  0 siblings, 0 replies; 5+ messages in thread
From: Sam Ravnborg @ 2020-05-23  6:54 UTC (permalink / raw)
  To: Lyude Paul
  Cc: David Airlie, Dave Airlie, Thomas Zimmermann, dri-devel, linux-kernel

Hi Lyude.

> > > *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.
> 
> 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
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, back to index

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-21 20:46 [PATCH] drm/vblank: Fix -Wformat compile warnings on some arches Lyude Paul
2020-05-21 21:09 ` Sam Ravnborg
2020-05-22 18:18   ` Lyude Paul
2020-05-23  6:54     ` Sam Ravnborg
2020-05-22  6:30 ` Thomas Zimmermann

dri-devel Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/dri-devel/0 dri-devel/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 dri-devel dri-devel/ https://lore.kernel.org/dri-devel \
		dri-devel@lists.freedesktop.org
	public-inbox-index dri-devel

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.freedesktop.lists.dri-devel


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git