lkml.org 
[lkml]   [2024]   [Apr]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 21/34] iwlegacy: don't warn for unused variables with DEBUG_FS=n
On Wed, Apr 03, 2024 at 10:06:39AM +0200, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@arndb.de>
>
> The reference to il_rate_mcs is inside of an #ifdef, causing a W=1 warning:
>
> drivers/net/wireless/intel/iwlegacy/4965-rs.c:189:38: error: unused variable 'il_rate_mcs' [-Werror,-Wunused-const-variable]
> static const struct il_rate_mcs_info il_rate_mcs[RATE_COUNT] = {
>
> Replace the #ifdef with a PTR_IF() for better compile time analysis.
> The dead code will still get eliminated, but the warning goes away.

..

> + .add_sta_debugfs = PTR_IF(IS_ENABLED(CONFIG_DEBUG_FS),
> + il4965_rs_add_debugfs),

I believe it's not the first and not the last driver that wants this kind of
thing. Maybe
- split out PTR_IF() from kernel.h
- add debugfs_ptr()
- use it?

--
With Best Regards,
Andy Shevchenko



\
 
 \ /
  Last update: 2024-05-27 16:20    [W:0.548 / U:0.060 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site