Re: [PATCH] staging: rtl8192u/ieee80211: Fix sparse ieee80211_debug_init/_exit not declared warning

From: Jeremiah Mahler
Date: Tue Aug 12 2014 - 00:17:42 EST


On Mon, Aug 11, 2014 at 10:11:13PM -0500, Joel Pelaez Jorge wrote:
> El 11/08/14 a las 17:32, Greg Kroah-Hartman escibiÃ:
> > On Mon, Aug 11, 2014 at 03:15:54PM -0700, Jeremiah Mahler wrote:
> >> A sparse warning is generated about 'ieee80211_debug_init' and
> >> 'ieee80211_debug_exit' not being declared.
> >>
> >> drivers/staging/rtl8192u/ieee80211/ieee80211_module.c:275:12: warning:
> >> symbol 'ieee80211_debug_init' was not declared. Should it be static?
> >> drivers/staging/rtl8192u/ieee80211/ieee80211_module.c:297:13: warning:
> >> symbol 'ieee80211_debug_exit' was not declared. Should it be static?
> >>
> >> These functions are used outside of this file so using static will not
> >> work. Fix the warning by declaring the functions in the header file,
> >> ieee80211.h
> >>
> >> Signed-off-by: Jeremiah Mahler <jmmahler@xxxxxxxxx>
> >> Cc: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
> >> Cc: Teodora Baluta <teobaluta@xxxxxxxxx>
> >> Cc: Andrea Merello <andrea.merello@xxxxxxxxx>
> >> Cc: Joel Pelaez Jorge <joelpelaez@xxxxxxxxx>
> >> Cc: Bob Copeland <me@xxxxxxxxxxxxxxx>
> >> Cc: Joe Perches <joe@xxxxxxxxxxx>
> >> Cc: Arnd Bergmann <arnd@xxxxxxxx>
> >> Cc: Himangi Saraogi <himangi774@xxxxxxxxx>
> >> ---
> >> drivers/staging/rtl8192u/ieee80211/ieee80211.h | 6 ++++++
> >> 1 file changed, 6 insertions(+)
> >>
> >> diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211.h b/drivers/staging/rtl8192u/ieee80211/ieee80211.h
> >> index 1040bab..9cbda69 100644
> >> --- a/drivers/staging/rtl8192u/ieee80211/ieee80211.h
> >> +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211.h
> >> @@ -2485,6 +2485,12 @@ extern int ieee80211_wx_set_freq(struct ieee80211_device *ieee, struct iw_reques
> >> extern int ieee80211_wx_get_freq(struct ieee80211_device *ieee, struct iw_request_info *a,
> >> union iwreq_data *wrqu, char *b);
> >>
> >> +/* ieee80211_module.c */
> >> +#ifdef CONFIG_IEEE80211_DEBUG
> >> +extern int __init ieee80211_debug_init(void);
> >> +extern void __exit ieee80211_debug_exit(void);
> >> +#endif /* CONFIG_IEEE80211_DEBUG */
> >> +
> >
> > As it's a header file, why not always have them here, no need for the
> > ifdef.
> >
> > And __init and __exit don't belong in a .h function prototype.
> >
> > thanks,
> >
> > greg k-h
> >
> The symbol ieee80211_debug_init(void) and ieee80211_debug_exit(void) are declared as prototype in r8192U_core.c, this cause a double function prototype. It is only a comment, it not affect anything. Check it to next time.
>
> - Joel

Thanks for the information Joel. While my patch does fix the sparse
warning, having two duplicate function prototypes seems suboptimal as
well. I will see if I can find a better way to fix this warning.

--
Jeremiah Mahler
jmmahler@xxxxxxxxx
http://github.com/jmahler
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/