diff mbox series

[1/2] drm: Fix duplicate const warning in drm_gem_ttm_helper.c

Message ID 20190920193558.89815-1-sean@poorly.run (mailing list archive)
State New, archived
Headers show
Series [1/2] drm: Fix duplicate const warning in drm_gem_ttm_helper.c | expand

Commit Message

Sean Paul Sept. 20, 2019, 7:35 p.m. UTC
From: Sean Paul <seanpaul@chromium.org>

For the warning
../drivers/gpu/drm/drm_gem_ttm_helper.c:26:20: warning: duplicate ‘const’ declaration specifier [-Wduplicate-decl-specifier]

Reading between the lines, I think the double const is to preserve both
the values and the pointers in the array (which makes total sense). This
patch moves the second const to achieve this (and fix the warning).

Fixes: ff540b76f14a ("drm/ttm: add drm gem ttm helpers, starting with drm_gem_ttm_print_info()")
Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: Thomas Zimmermann <tzimmermann@suse.de>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: David Airlie <airlied@linux.ie>
Cc: Daniel Vetter <daniel@ffwll.ch>
Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Cc: Maxime Ripard <maxime.ripard@bootlin.com>
Cc: Sean Paul <sean@poorly.run>
Cc: dri-devel@lists.freedesktop.org
Signed-off-by: Sean Paul <seanpaul@chromium.org>
---
 drivers/gpu/drm/drm_gem_ttm_helper.c | 2 +-
 drivers/gpu/drm/drm_print.c          | 2 +-
 include/drm/drm_print.h              | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

Comments

Thomas Zimmermann Sept. 23, 2019, 6:57 a.m. UTC | #1
Hi

Am 20.09.19 um 21:35 schrieb Sean Paul:
> From: Sean Paul <seanpaul@chromium.org>
> 
> For the warning
> ../drivers/gpu/drm/drm_gem_ttm_helper.c:26:20: warning: duplicate ‘const’ declaration specifier [-Wduplicate-decl-specifier]
> 
> Reading between the lines, I think the double const is to preserve both
> the values and the pointers in the array (which makes total sense). This

Yes it is. Thanks for fixing.

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

> patch moves the second const to achieve this (and fix the warning).
> 
> Fixes: ff540b76f14a ("drm/ttm: add drm gem ttm helpers, starting with drm_gem_ttm_print_info()")
> Cc: Gerd Hoffmann <kraxel@redhat.com>
> Cc: Thomas Zimmermann <tzimmermann@suse.de>
> Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
> Cc: David Airlie <airlied@linux.ie>
> Cc: Daniel Vetter <daniel@ffwll.ch>
> Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
> Cc: Maxime Ripard <maxime.ripard@bootlin.com>
> Cc: Sean Paul <sean@poorly.run>
> Cc: dri-devel@lists.freedesktop.org
> Signed-off-by: Sean Paul <seanpaul@chromium.org>
> ---
>  drivers/gpu/drm/drm_gem_ttm_helper.c | 2 +-
>  drivers/gpu/drm/drm_print.c          | 2 +-
>  include/drm/drm_print.h              | 2 +-
>  3 files changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_gem_ttm_helper.c b/drivers/gpu/drm/drm_gem_ttm_helper.c
> index 9a4bafcf20df..ae7ba0052959 100644
> --- a/drivers/gpu/drm/drm_gem_ttm_helper.c
> +++ b/drivers/gpu/drm/drm_gem_ttm_helper.c
> @@ -23,7 +23,7 @@
>  void drm_gem_ttm_print_info(struct drm_printer *p, unsigned int indent,
>  			    const struct drm_gem_object *gem)
>  {
> -	static const char const *plname[] = {
> +	static const char * const plname[] = {
>  		[ TTM_PL_SYSTEM ] = "system",
>  		[ TTM_PL_TT     ] = "tt",
>  		[ TTM_PL_VRAM   ] = "vram",
> diff --git a/drivers/gpu/drm/drm_print.c b/drivers/gpu/drm/drm_print.c
> index dfa27367ebb8..20c49c85b7a2 100644
> --- a/drivers/gpu/drm/drm_print.c
> +++ b/drivers/gpu/drm/drm_print.c
> @@ -198,7 +198,7 @@ EXPORT_SYMBOL(drm_printf);
>   * @to: end of bit range to print (exclusive).
>   */
>  void drm_print_bits(struct drm_printer *p,
> -		    unsigned long value, const char *bits[],
> +		    unsigned long value, const char * const bits[],
>  		    unsigned int from, unsigned int to)
>  {
>  	bool first = true;
> diff --git a/include/drm/drm_print.h b/include/drm/drm_print.h
> index 12d4916254b4..1e6a4ee8a6b2 100644
> --- a/include/drm/drm_print.h
> +++ b/include/drm/drm_print.h
> @@ -90,7 +90,7 @@ void drm_printf(struct drm_printer *p, const char *f, ...);
>  void drm_puts(struct drm_printer *p, const char *str);
>  void drm_print_regset32(struct drm_printer *p, struct debugfs_regset32 *regset);
>  void drm_print_bits(struct drm_printer *p,
> -		    unsigned long value, const char *bits[],
> +		    unsigned long value, const char * const bits[],
>  		    unsigned int from, unsigned int to);
>  
>  __printf(2, 0)
>
Gerd Hoffmann Sept. 23, 2019, 6:59 a.m. UTC | #2
On Fri, Sep 20, 2019 at 03:35:51PM -0400, Sean Paul wrote:
> From: Sean Paul <seanpaul@chromium.org>
> 
> For the warning
> ../drivers/gpu/drm/drm_gem_ttm_helper.c:26:20: warning: duplicate ‘const’ declaration specifier [-Wduplicate-decl-specifier]

I have a drm_print_bits patch in flight which fixes this too (Cc'ed you
on v2).

cheers,
  Gerd
Sean Paul Sept. 23, 2019, 1:40 p.m. UTC | #3
On Mon, Sep 23, 2019 at 08:59:29AM +0200, Gerd Hoffmann wrote:
> On Fri, Sep 20, 2019 at 03:35:51PM -0400, Sean Paul wrote:
> > From: Sean Paul <seanpaul@chromium.org>
> > 
> > For the warning
> > ../drivers/gpu/drm/drm_gem_ttm_helper.c:26:20: warning: duplicate ‘const’ declaration specifier [-Wduplicate-decl-specifier]
> 
> I have a drm_print_bits patch in flight which fixes this too (Cc'ed you
> on v2).

Ah neat, thanks.

Sean

> 
> cheers,
>   Gerd
>
diff mbox series

Patch

diff --git a/drivers/gpu/drm/drm_gem_ttm_helper.c b/drivers/gpu/drm/drm_gem_ttm_helper.c
index 9a4bafcf20df..ae7ba0052959 100644
--- a/drivers/gpu/drm/drm_gem_ttm_helper.c
+++ b/drivers/gpu/drm/drm_gem_ttm_helper.c
@@ -23,7 +23,7 @@ 
 void drm_gem_ttm_print_info(struct drm_printer *p, unsigned int indent,
 			    const struct drm_gem_object *gem)
 {
-	static const char const *plname[] = {
+	static const char * const plname[] = {
 		[ TTM_PL_SYSTEM ] = "system",
 		[ TTM_PL_TT     ] = "tt",
 		[ TTM_PL_VRAM   ] = "vram",
diff --git a/drivers/gpu/drm/drm_print.c b/drivers/gpu/drm/drm_print.c
index dfa27367ebb8..20c49c85b7a2 100644
--- a/drivers/gpu/drm/drm_print.c
+++ b/drivers/gpu/drm/drm_print.c
@@ -198,7 +198,7 @@  EXPORT_SYMBOL(drm_printf);
  * @to: end of bit range to print (exclusive).
  */
 void drm_print_bits(struct drm_printer *p,
-		    unsigned long value, const char *bits[],
+		    unsigned long value, const char * const bits[],
 		    unsigned int from, unsigned int to)
 {
 	bool first = true;
diff --git a/include/drm/drm_print.h b/include/drm/drm_print.h
index 12d4916254b4..1e6a4ee8a6b2 100644
--- a/include/drm/drm_print.h
+++ b/include/drm/drm_print.h
@@ -90,7 +90,7 @@  void drm_printf(struct drm_printer *p, const char *f, ...);
 void drm_puts(struct drm_printer *p, const char *str);
 void drm_print_regset32(struct drm_printer *p, struct debugfs_regset32 *regset);
 void drm_print_bits(struct drm_printer *p,
-		    unsigned long value, const char *bits[],
+		    unsigned long value, const char * const bits[],
 		    unsigned int from, unsigned int to);
 
 __printf(2, 0)