mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Matt Coster <Matt.Coster@imgtec.com>
To: Arnd Bergmann <arnd@kernel.org>
Cc: Frank Binns <Frank.Binns@imgtec.com>,
	Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
	Maxime Ripard <mripard@kernel.org>,
	Thomas Zimmermann <tzimmermann@suse.de>,
	David Airlie <airlied@gmail.com>, Simona Vetter <simona@ffwll.ch>,
	Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>,
	Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
	Arnd Bergmann <arnd@arndb.de>,
	Andrzej Hajda <andrzej.hajda@intel.com>,
	Jani Nikula <jani.nikula@intel.com>,
	Alex Deucher <alexander.deucher@amd.com>,
	Alessio Belle <Alessio.Belle@imgtec.com>,
	"dri-devel@lists.freedesktop.org"
	<dri-devel@lists.freedesktop.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 01/10] drm/imagination: avoid unused-const-variable warning
Date: Tue, 22 Apr 2025 16:08:19 +0000	[thread overview]
Message-ID: <04e72a15-627a-4ca0-824b-a40add7cd4de@imgtec.com> (raw)
In-Reply-To: <20250409122314.2848028-1-arnd@kernel.org>


[-- Attachment #1.1: Type: text/plain, Size: 3730 bytes --]

On 09/04/2025 13:22, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@arndb.de>
> 
> When CONFIG_DEBUG_FS is disabled, the stid_fmts[] array is not referenced
> anywhere, causing a W=1 warning with gcc:
> 
> In file included from drivers/gpu/drm/imagination/pvr_fw_trace.c:7:
> drivers/gpu/drm/imagination/pvr_rogue_fwif_sf.h:75:39: error: 'stid_fmts' defined but not used [-Werror=unused-const-variable=]
>    75 | static const struct rogue_km_stid_fmt stid_fmts[] = {
>       |                                       ^~~~~~~~~
> 
> Rather than adding more #ifdef blocks, address this by changing the
> existing #ifdef into equivalent IS_ENABLED() checks so gcc can see
> where the symbol is used but still eliminate it from the object file.
> 
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>

Hi Arnd,

After sleeping revisiting this after being on holiday, it seems like
enough of my concerns were due solely to my ignorance that I'd rather
just take this patch as-is than spend time reworking it. (Thanks to Jani
and Andi for filling gaps in my knowledge too!)

To that end,

Reviewed-by: Matt Coster <matt.coster@imgtec.com>

And I'll take this through drm-misc-next tomorrow if there are no
objections.

Cheers,
Matt

> ---
>  drivers/gpu/drm/imagination/pvr_fw_trace.c | 8 ++++----
>  drivers/gpu/drm/imagination/pvr_fw_trace.h | 2 --
>  2 files changed, 4 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/gpu/drm/imagination/pvr_fw_trace.c b/drivers/gpu/drm/imagination/pvr_fw_trace.c
> index 5dbb636d7d4f..93269299d6a4 100644
> --- a/drivers/gpu/drm/imagination/pvr_fw_trace.c
> +++ b/drivers/gpu/drm/imagination/pvr_fw_trace.c
> @@ -122,8 +122,6 @@ void pvr_fw_trace_fini(struct pvr_device *pvr_dev)
>  	pvr_fw_object_unmap_and_destroy(fw_trace->tracebuf_ctrl_obj);
>  }
>  
> -#if defined(CONFIG_DEBUG_FS)
> -
>  /**
>   * update_logtype() - Send KCCB command to trigger FW to update logtype
>   * @pvr_dev: Target PowerVR device
> @@ -447,7 +445,7 @@ static const struct file_operations pvr_fw_trace_fops = {
>  void
>  pvr_fw_trace_mask_update(struct pvr_device *pvr_dev, u32 old_mask, u32 new_mask)
>  {
> -	if (old_mask != new_mask)
> +	if (IS_ENABLED(CONFIG_DEBUG_FS) && old_mask != new_mask)
>  		update_logtype(pvr_dev, new_mask);
>  }
>  
> @@ -457,6 +455,9 @@ pvr_fw_trace_debugfs_init(struct pvr_device *pvr_dev, struct dentry *dir)
>  	struct pvr_fw_trace *fw_trace = &pvr_dev->fw_dev.fw_trace;
>  	u32 thread_nr;
>  
> +	if (!IS_ENABLED(CONFIG_DEBUG_FS))
> +		return;
> +
>  	static_assert(ARRAY_SIZE(fw_trace->buffers) <= 10,
>  		      "The filename buffer is only large enough for a single-digit thread count");
>  
> @@ -469,4 +470,3 @@ pvr_fw_trace_debugfs_init(struct pvr_device *pvr_dev, struct dentry *dir)
>  				    &pvr_fw_trace_fops);
>  	}
>  }
> -#endif
> diff --git a/drivers/gpu/drm/imagination/pvr_fw_trace.h b/drivers/gpu/drm/imagination/pvr_fw_trace.h
> index 0074d2b18da0..1d0ef937427a 100644
> --- a/drivers/gpu/drm/imagination/pvr_fw_trace.h
> +++ b/drivers/gpu/drm/imagination/pvr_fw_trace.h
> @@ -65,7 +65,6 @@ struct pvr_fw_trace {
>  int pvr_fw_trace_init(struct pvr_device *pvr_dev);
>  void pvr_fw_trace_fini(struct pvr_device *pvr_dev);
>  
> -#if defined(CONFIG_DEBUG_FS)
>  /* Forward declaration from <linux/dcache.h>. */
>  struct dentry;
>  
> @@ -73,6 +72,5 @@ void pvr_fw_trace_mask_update(struct pvr_device *pvr_dev, u32 old_mask,
>  			      u32 new_mask);
>  
>  void pvr_fw_trace_debugfs_init(struct pvr_device *pvr_dev, struct dentry *dir);
> -#endif /* defined(CONFIG_DEBUG_FS) */
>  
>  #endif /* PVR_FW_TRACE_H */


-- 
Matt Coster
E: matt.coster@imgtec.com

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

  parent reply	other threads:[~2025-04-22 16:08 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-09 12:21 [PATCH 00/10] -Wunused-const-variable warning fixes Arnd Bergmann
2025-04-09 12:22 ` [PATCH 01/10] drm/imagination: avoid unused-const-variable warning Arnd Bergmann
2025-04-09 12:22   ` [PATCH 02/10] [v2] clocksource: atmel_tcb: fix kconfig dependency Arnd Bergmann
2025-04-09 12:47     ` Alexandre Belloni
2025-04-09 15:30     ` Andy Shevchenko
2025-04-09 15:53       ` Arnd Bergmann
2025-04-09 12:22   ` [PATCH 03/10] [v2] Input: stmpe-ts - use module alias instead of device table Arnd Bergmann
2025-04-09 15:33     ` Andy Shevchenko
2025-04-09 15:49       ` Krzysztof Kozlowski
2025-04-09 12:22   ` [PATCH 04/10] [RESEND] mux: adg792a: remove incorrect of_match_ptr annotation Arnd Bergmann
2025-04-09 15:34     ` Andy Shevchenko
2025-05-01 17:56     ` (subset) " Krzysztof Kozlowski
2025-04-09 12:22   ` [PATCH 05/10] [RESEND] sched: open-code max_rt_runtime definition Arnd Bergmann
2025-04-09 12:22   ` [PATCH 06/10] [RESEND] lockdep: change 'static const' variables to enum values Arnd Bergmann
2025-05-02 14:02     ` Andy Shevchenko
2025-07-11 22:13       ` Boqun Feng
2025-07-19 17:40     ` [tip: locking/core] locking/lockdep: Change " tip-bot2 for Arnd Bergmann
2025-04-09 12:22   ` [PATCH 07/10] [RESEND] ARM: fixmap: make __end_of_early_ioremap_region an enum value Arnd Bergmann
2025-04-09 16:54     ` Andy Shevchenko
2025-04-09 12:23   ` [PATCH 08/10] [RESEND 2] comedi: ni_atmio: avoid warning for unused device_ids[] table Arnd Bergmann
2025-04-09 12:23   ` [PATCH 09/10] [RESEND 2] apm-emulation: hide an unused variable Arnd Bergmann
2025-04-10 11:22   ` [PATCH 01/10] drm/imagination: avoid unused-const-variable warning Matt Coster
2025-04-10 11:56     ` Jani Nikula
2025-04-10 11:58     ` Arnd Bergmann
2025-04-14  6:51     ` Andy Shevchenko
2025-04-22 16:08   ` Matt Coster [this message]
2025-04-24 10:04   ` (subset) " Matt Coster
2025-04-09 12:24 ` [PATCH 10/10] [RESEND 3] dma/contiguous: avoid warning about unused size_bytes Arnd Bergmann
2025-04-09 14:35   ` Marek Szyprowski
2025-04-09 14:43     ` Andy Shevchenko
2025-04-09 14:51       ` Arnd Bergmann
2025-04-09 14:57         ` Marek Szyprowski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=04e72a15-627a-4ca0-824b-a40add7cd4de@imgtec.com \
    --to=matt.coster@imgtec.com \
    --cc=Alessio.Belle@imgtec.com \
    --cc=Frank.Binns@imgtec.com \
    --cc=airlied@gmail.com \
    --cc=alexander.deucher@amd.com \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=andrzej.hajda@intel.com \
    --cc=arnd@arndb.de \
    --cc=arnd@kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=jani.nikula@intel.com \
    --cc=krzysztof.kozlowski@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=mripard@kernel.org \
    --cc=simona@ffwll.ch \
    --cc=tzimmermann@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®