| Date | Wed, 3 Apr 2024 12:33:54 +0300 | From | Andy Shevchenko <> | Subject | Re: [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
|