* [PATCH 00/10] -Wunused-const-variable warning fixes
@ 2025-04-09 12:21 Arnd Bergmann
2025-04-09 12:22 ` [PATCH 01/10] drm/imagination: avoid unused-const-variable warning Arnd Bergmann
0 siblings, 1 reply; 8+ messages in thread
From: Arnd Bergmann @ 2025-04-09 12:21 UTC (permalink / raw)
To: linux-kernel
Cc: Arnd Bergmann, Russell King, Jiri Kosina, Greg Kroah-Hartman,
Daniel Lezcano, Thomas Gleixner, Ian Abbott, H Hartley Sweeten,
Frank Binns, Matt Coster, Maarten Lankhorst, Maxime Ripard,
Thomas Zimmermann, David Airlie, Simona Vetter, Dmitry Torokhov,
Maxime Coquelin, Alexandre Torgue, Peter Rosin, Marek Szyprowski,
Robin Murphy, Peter Zijlstra, Ingo Molnar, Will Deacon,
Boqun Feng, Waiman Long, Juri Lelli, Vincent Guittot,
Dietmar Eggemann, Steven Rostedt, Ben Segall, Mel Gorman,
Valentin Schneider, Krzysztof Kozlowski, linux-arm-kernel,
dri-devel, linux-input, linux-stm32, iommu
From: Arnd Bergmann <arnd@arndb.de>
Most patches I sent during the previous kernel cycle have made it in, these
ten still remain for the moment. Please apply.
Arnd Bergmann (10):
drm/imagination: avoid unused-const-variable warning
[v2] clocksource: atmel_tcb: fix kconfig dependency
[v2] Input: stmpe-ts - use module alias instead of device table
[RESEND] mux: adg792a: remove incorrect of_match_ptr annotation
[RESEND] sched: open-code max_rt_runtime definition
[RESEND] lockdep: change 'static const' variables to enum values
[RESEND] ARM: fixmap: make __end_of_early_ioremap_region an enum value
[RESEND 2] comedi: ni_atmio: avoid warning for unused device_ids[] table
[RESEND 2] apm-emulation: hide an unused variable
[RESEND 3] dma/contiguous: avoid warning about unused size_bytes
arch/arm/include/asm/fixmap.h | 9 ++++-----
drivers/char/apm-emulation.c | 5 ++---
drivers/clocksource/Kconfig | 4 ++--
drivers/comedi/drivers/ni_atmio.c | 2 +-
drivers/gpu/drm/imagination/pvr_fw_trace.c | 8 ++++----
drivers/gpu/drm/imagination/pvr_fw_trace.h | 2 --
drivers/input/touchscreen/stmpe-ts.c | 7 +------
drivers/mux/adg792a.c | 2 +-
kernel/dma/contiguous.c | 3 +--
kernel/locking/lockdep_internals.h | 18 ++++++++++--------
kernel/sched/rt.c | 6 ++----
11 files changed, 28 insertions(+), 38 deletions(-)
--
2.39.5
Cc: Russell King <linux@armlinux.org.uk> (maintainer:ARM PORT)
Cc: Jiri Kosina <jikos@kernel.org> (maintainer:APM DRIVER)
Cc: Arnd Bergmann <arnd@arndb.de> (maintainer:CHAR and MISC DRIVERS,commit_signer:2/2=100%,authored:2/2=100%,added_lines:8/8=100%,removed_lines:10/10=100%,commit_signer:2/3=67%,authored:2/3=67%,added_lines:2/11=18%,removed_lines:2/2=100%,commit_signer:2/4=50%,blamed_fixes:1/1=100%)
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> (maintainer:CHAR and MISC DRIVERS,commit_signer:1/3=33%)
Cc: Daniel Lezcano <daniel.lezcano@linaro.org> (maintainer:CLOCKSOURCE, CLOCKEVENT DRIVERS)
Cc: Thomas Gleixner <tglx@linutronix.de> (maintainer:CLOCKSOURCE, CLOCKEVENT DRIVERS)
Cc: Ian Abbott <abbotti@mev.co.uk> (maintainer:COMEDI DRIVERS,commit_signer:1/3=33%,authored:1/3=33%,added_lines:9/11=82%)
Cc: H Hartley Sweeten <hsweeten@visionengravers.com> (maintainer:COMEDI DRIVERS)
Cc: Frank Binns <frank.binns@imgtec.com> (maintainer:IMGTEC POWERVR DRM DRIVER)
Cc: Matt Coster <matt.coster@imgtec.com> (maintainer:IMGTEC POWERVR DRM DRIVER)
Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com> (maintainer:DRM DRIVERS AND MISC GPU PATCHES)
Cc: Maxime Ripard <mripard@kernel.org> (maintainer:DRM DRIVERS AND MISC GPU PATCHES)
Cc: Thomas Zimmermann <tzimmermann@suse.de> (maintainer:DRM DRIVERS AND MISC GPU PATCHES)
Cc: David Airlie <airlied@gmail.com> (maintainer:DRM DRIVERS)
Cc: Simona Vetter <simona@ffwll.ch> (maintainer:DRM DRIVERS)
Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com> (maintainer:INPUT (KEYBOARD, MOUSE, JOYSTICK, TOUCHSCREEN)...,commit_signer:2/4=50%)
Cc: Maxime Coquelin <mcoquelin.stm32@gmail.com> (maintainer:ARM/STM32 ARCHITECTURE)
Cc: Alexandre Torgue <alexandre.torgue@foss.st.com> (maintainer:ARM/STM32 ARCHITECTURE)
Cc: Peter Rosin <peda@axentia.se> (maintainer:MULTIPLEXER SUBSYSTEM)
Cc: Marek Szyprowski <m.szyprowski@samsung.com> (maintainer:DMA MAPPING HELPERS,blamed_fixes:1/1=100%)
Cc: Robin Murphy <robin.murphy@arm.com> (reviewer:DMA MAPPING HELPERS)
Cc: Peter Zijlstra <peterz@infradead.org> (maintainer:LOCKING PRIMITIVES)
Cc: Ingo Molnar <mingo@redhat.com> (maintainer:LOCKING PRIMITIVES)
Cc: Will Deacon <will@kernel.org> (maintainer:LOCKING PRIMITIVES)
Cc: Boqun Feng <boqun.feng@gmail.com> (maintainer:LOCKING PRIMITIVES)
Cc: Waiman Long <longman@redhat.com> (reviewer:LOCKING PRIMITIVES)
Cc: Juri Lelli <juri.lelli@redhat.com> (maintainer:SCHEDULER)
Cc: Vincent Guittot <vincent.guittot@linaro.org> (maintainer:SCHEDULER)
Cc: Dietmar Eggemann <dietmar.eggemann@arm.com> (reviewer:SCHEDULER)
Cc: Steven Rostedt <rostedt@goodmis.org> (reviewer:SCHEDULER)
Cc: Ben Segall <bsegall@google.com> (reviewer:SCHEDULER)
Cc: Mel Gorman <mgorman@suse.de> (reviewer:SCHEDULER)
Cc: Valentin Schneider <vschneid@redhat.com> (reviewer:SCHEDULER)
Cc: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> (commit_signer:2/4=50%,authored:2/4=50%,added_lines:2/5=40%,removed_lines:2/5=40%)
Cc: linux-arm-kernel@lists.infradead.org (moderated list:ARM PORT)
Cc: linux-kernel@vger.kernel.org (open list)
Cc: dri-devel@lists.freedesktop.org (open list:DRM DRIVERS)
Cc: linux-input@vger.kernel.org (open list:INPUT (KEYBOARD, MOUSE, JOYSTICK, TOUCHSCREEN)...)
Cc: linux-stm32@st-md-mailman.stormreply.com (moderated list:ARM/STM32 ARCHITECTURE)
Cc: iommu@lists.linux.dev (open list:DMA MAPPING HELPERS)
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 01/10] drm/imagination: avoid unused-const-variable warning
2025-04-09 12:21 [PATCH 00/10] -Wunused-const-variable warning fixes Arnd Bergmann
@ 2025-04-09 12:22 ` Arnd Bergmann
2025-04-10 11:22 ` Matt Coster
` (2 more replies)
0 siblings, 3 replies; 8+ messages in thread
From: Arnd Bergmann @ 2025-04-09 12:22 UTC (permalink / raw)
To: Frank Binns, Matt Coster, Maarten Lankhorst, Maxime Ripard,
Thomas Zimmermann, David Airlie, Simona Vetter
Cc: Krzysztof Kozlowski, Andy Shevchenko, Arnd Bergmann,
Andrzej Hajda, Jani Nikula, Alex Deucher, Alessio Belle,
dri-devel, linux-kernel
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>
---
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 */
--
2.39.5
^ permalink raw reply related [flat|nested] 8+ messages in thread* Re: [PATCH 01/10] drm/imagination: avoid unused-const-variable warning
2025-04-09 12:22 ` [PATCH 01/10] drm/imagination: avoid unused-const-variable warning Arnd Bergmann
@ 2025-04-10 11:22 ` Matt Coster
2025-04-10 11:56 ` Jani Nikula
` (2 more replies)
2025-04-22 16:08 ` Matt Coster
2025-04-24 10:04 ` (subset) " Matt Coster
2 siblings, 3 replies; 8+ messages in thread
From: Matt Coster @ 2025-04-10 11:22 UTC (permalink / raw)
To: Arnd Bergmann
Cc: Frank Binns, Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann,
David Airlie, Simona Vetter, Krzysztof Kozlowski, Andy Shevchenko,
Arnd Bergmann, Andrzej Hajda, Jani Nikula, Alex Deucher,
Alessio Belle, dri-devel@lists.freedesktop.org,
linux-kernel@vger.kernel.org
[-- Attachment #1.1: Type: text/plain, Size: 4756 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[] = {
> | ^~~~~~~~~
Hi Arnd,
Thanks for catching this! My dev environment permanently has DEBUG_FS
enabled, we should probably look into a wider variety of testing
configs.
>
> 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.
Possibly a silly question, but wouldn't adding __maybe_unused to
stid_fmts be a simpler change here? Or is there a strong preference to
avoid #ifdef CONFIG_* and let the compiler figure out what to elide?
The contents of the pvr_rogue_fwif*.h headers is essentially normative
outside of company-internal documentation. With types, there's generally
no warnings emitted when they're not used, but I believe this is the
only instance of actual data being stored in these headers.
I suppose technically it should even be moved to an associated *.c file,
but that would (I assume) further confound the compiler's ability to
decide when it's needed in the final binary (or I guess the linker if
it's in a separate object).
>
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
> 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)
Logically, there's no reason to add the condition here. This function
was only gated behind CONFIG_DEBUG_FS because that was the only
mechanism provided to invoke update_logtype() but since we're relying on
the compiler to figure out when this function is required, we can skip
the IS_ENABLED() check.
> 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;
With the #ifdef removed, there's no reason to keep this forward
declaration down here. Can you move it up to the top of the file with
the others?
>
> @@ -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) */
Having said that, surely it makes sense to keep at least
*_debugfs_init() gated behind 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 --]
^ permalink raw reply [flat|nested] 8+ messages in thread* Re: [PATCH 01/10] drm/imagination: avoid unused-const-variable warning
2025-04-10 11:22 ` Matt Coster
@ 2025-04-10 11:56 ` Jani Nikula
2025-04-10 11:58 ` Arnd Bergmann
2025-04-14 6:51 ` Andy Shevchenko
2 siblings, 0 replies; 8+ messages in thread
From: Jani Nikula @ 2025-04-10 11:56 UTC (permalink / raw)
To: Matt Coster, Arnd Bergmann
Cc: Frank Binns, Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann,
David Airlie, Simona Vetter, Krzysztof Kozlowski, Andy Shevchenko,
Arnd Bergmann, Andrzej Hajda, Alex Deucher, Alessio Belle,
dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org
On Thu, 10 Apr 2025, Matt Coster <Matt.Coster@imgtec.com> wrote:
> Having said that, surely it makes sense to keep at least
> *_debugfs_init() gated behind CONFIG_DEBUG_FS?
If they're basically just calls to debugfs_create_{dir,file}, the
compiler pretty much turns them into nops, and you'll get better build
coverage.
BR,
Jani.
--
Jani Nikula, Intel
^ permalink raw reply [flat|nested] 8+ messages in thread* Re: [PATCH 01/10] drm/imagination: avoid unused-const-variable warning
2025-04-10 11:22 ` Matt Coster
2025-04-10 11:56 ` Jani Nikula
@ 2025-04-10 11:58 ` Arnd Bergmann
2025-04-14 6:51 ` Andy Shevchenko
2 siblings, 0 replies; 8+ messages in thread
From: Arnd Bergmann @ 2025-04-10 11:58 UTC (permalink / raw)
To: Matt Coster, Arnd Bergmann
Cc: Frank Binns, Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann,
Dave Airlie, Simona Vetter, Krzysztof Kozlowski, Andy Shevchenko,
Andrzej Hajda, Jani Nikula, Alex Deucher, Alessio Belle,
dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org
On Thu, Apr 10, 2025, at 13:22, Matt Coster wrote:
> On 09/04/2025 13:22, Arnd Bergmann wrote:
>>
>> 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.
>
> Possibly a silly question, but wouldn't adding __maybe_unused to
> stid_fmts be a simpler change here? Or is there a strong preference to
> avoid #ifdef CONFIG_* and let the compiler figure out what to elide?
All three ways work, and it's mainly a matter a preference. A lot
of developers don't like __maybe_unused, and there are enough developers
that really dislike #ifdef blocks in .c files, though a lot of
others don't really care.
I sent the version that I like best because I find that easier to
read and it gives better compile-time coverage in all configurations,
but I mainly care about having no warnings, so pick whatever approach
works for you.
> The contents of the pvr_rogue_fwif*.h headers is essentially normative
> outside of company-internal documentation. With types, there's generally
> no warnings emitted when they're not used, but I believe this is the
> only instance of actual data being stored in these headers.
>
> I suppose technically it should even be moved to an associated *.c file,
> but that would (I assume) further confound the compiler's ability to
> decide when it's needed in the final binary (or I guess the linker if
> it's in a separate object).
Moving it next to the user of that definition is geneally best
here, if the variable is only ever used in one place. If that
happens to be inside of an existing #ifdef, it just works, and
if someone later replaces the #ifdef with an IS_ENABLED() check
it keeps working.
>> -#if defined(CONFIG_DEBUG_FS)
>> /* Forward declaration from <linux/dcache.h>. */
>> struct dentry;
>
> With the #ifdef removed, there's no reason to keep this forward
> declaration down here. Can you move it up to the top of the file with
> the others?
I don't think it changes much, I usually keep these close to
the function prototype that use them as you have here.
>> @@ -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) */
>
> Having said that, surely it makes sense to keep at least
> *_debugfs_init() gated behind CONFIG_DEBUG_FS?
With the IS_ENABLED() check, it's an empty function, so the cost
of the function is very small. Leaving the #ifdef in here would
probably again cause warnings about unused functions or variable.
Ideally the entire file would just be left out of the build
here, with the function decarations in pvr_fw_trace.h
replaced with empty stubs for !CONFIG_DEBUG_FS. I don't
know if that's possible, or if you still need to initialize
the fw trace if there is no debugfs interface for it, so
I did not try this myself.
Can you try to come up with a fix for the warning that you
like best and treat my email as "Reported-by: Arnd Bergmann
<arnd@arndb.de>"?
Arnd
^ permalink raw reply [flat|nested] 8+ messages in thread* Re: [PATCH 01/10] drm/imagination: avoid unused-const-variable warning
2025-04-10 11:22 ` Matt Coster
2025-04-10 11:56 ` Jani Nikula
2025-04-10 11:58 ` Arnd Bergmann
@ 2025-04-14 6:51 ` Andy Shevchenko
2 siblings, 0 replies; 8+ messages in thread
From: Andy Shevchenko @ 2025-04-14 6:51 UTC (permalink / raw)
To: Matt Coster
Cc: Arnd Bergmann, Frank Binns, Maarten Lankhorst, Maxime Ripard,
Thomas Zimmermann, David Airlie, Simona Vetter,
Krzysztof Kozlowski, Arnd Bergmann, Andrzej Hajda, Jani Nikula,
Alex Deucher, Alessio Belle, dri-devel@lists.freedesktop.org,
linux-kernel@vger.kernel.org
On Thu, Apr 10, 2025 at 11:22:05AM +0000, Matt Coster wrote:
> On 09/04/2025 13:22, Arnd Bergmann wrote:
...
> > 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.
>
> Possibly a silly question, but wouldn't adding __maybe_unused to
> stid_fmts be a simpler change here?
I'm not Arnd (and I just have read his answer), but I would like to add that
__maybe_unused should be the last resort as it has more cons than more invasive
solutions. In particular, it makes build time increase with a lot of work to
be made at link time, and also it might hide the real bugs when somebody simply
forgot to use it (depending on the configuration options) or so.
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 01/10] drm/imagination: avoid unused-const-variable warning
2025-04-09 12:22 ` [PATCH 01/10] drm/imagination: avoid unused-const-variable warning Arnd Bergmann
2025-04-10 11:22 ` Matt Coster
@ 2025-04-22 16:08 ` Matt Coster
2025-04-24 10:04 ` (subset) " Matt Coster
2 siblings, 0 replies; 8+ messages in thread
From: Matt Coster @ 2025-04-22 16:08 UTC (permalink / raw)
To: Arnd Bergmann
Cc: Frank Binns, Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann,
David Airlie, Simona Vetter, Krzysztof Kozlowski, Andy Shevchenko,
Arnd Bergmann, Andrzej Hajda, Jani Nikula, Alex Deucher,
Alessio Belle, dri-devel@lists.freedesktop.org,
linux-kernel@vger.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 --]
^ permalink raw reply [flat|nested] 8+ messages in thread* Re: (subset) [PATCH 01/10] drm/imagination: avoid unused-const-variable warning
2025-04-09 12:22 ` [PATCH 01/10] drm/imagination: avoid unused-const-variable warning Arnd Bergmann
2025-04-10 11:22 ` Matt Coster
2025-04-22 16:08 ` Matt Coster
@ 2025-04-24 10:04 ` Matt Coster
2 siblings, 0 replies; 8+ messages in thread
From: Matt Coster @ 2025-04-24 10:04 UTC (permalink / raw)
To: Frank Binns, Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann,
David Airlie, Simona Vetter, Arnd Bergmann
Cc: Krzysztof Kozlowski, Andy Shevchenko, Arnd Bergmann,
Andrzej Hajda, Jani Nikula, Alex Deucher, Alessio Belle,
dri-devel, linux-kernel
On Wed, 09 Apr 2025 14:22:53 +0200, Arnd Bergmann wrote:
> 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[] = {
> | ^~~~~~~~~
>
> [...]
Applied, thanks!
[01/10] drm/imagination: avoid unused-const-variable warning
commit: 3206a96675342badb0254558ba4b4c8764aa3ae7
Best regards,
--
Matt Coster <matt.coster@imgtec.com>
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2025-04-24 10:05 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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-10 11:22 ` 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
2025-04-24 10:04 ` (subset) " Matt Coster
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox