Re: [PATCH] hostap: hide unused procfs helpers

From: Arend van Spriel
Date: Fri Jul 13 2018 - 03:27:04 EST


+ Randy

On 7/13/2018 9:03 AM, YueHaibing wrote:
When CONFIG_PROC_FS isn't set, gcc warning this:

drivers/net/wireless/intersil/hostap/hostap_hw.c:2901:12: warning: âprism2_registers_proc_showâ defined but not used [-Wunused-function]
static int prism2_registers_proc_show(struct seq_file *m, void *v)

drivers/net/wireless/intersil/hostap/hostap_proc.c:16:12: warning: âprism2_debug_proc_showâ defined but not used [-Wunused-function]
static int prism2_debug_proc_show(struct seq_file *m, void *v)
^
drivers/net/wireless/intersil/hostap/hostap_proc.c:49:12: warning: âprism2_stats_proc_showâ defined but not used [-Wunused-function]
static int prism2_stats_proc_show(struct seq_file *m, void *v)
^
drivers/net/wireless/intersil/hostap/hostap_proc.c:177:12: warning: âprism2_crypt_proc_showâ defined but not used [-Wunused-function]
static int prism2_crypt_proc_show(struct seq_file *m, void *v)
^

fix this by adding #ifdef around them.
hfa384x_read_reg is only used by prism2_registers_proc_show,so move it
into #ifdef.

There was already a fix for this posted by Randy Dunlap taking a different approach, ie. use __maybe_unused classifier. To be honest I prefer the ifdef approach as it is more explicit and does not feel like a cheat.

Actually some of the functions are between a flag already PRISM2_NO_PROCFS_DEBUG which is in a private header file hostap_config.h. Seems like this would be better placed in Kconfig and depend on CONFIG_PROCFS. Anyway, this driver is old cruft. Maybe some people are still running it, but it is probably not worth the effort so fine with either fix.

Regards,
Arend