* [PATCH] staging: rtl8723bs: define wowlan_stub only when CONFIG_PM is enabled
@ 2021-09-13 14:10 Bryan Brattlof
2021-09-13 16:25 ` Greg Kroah-Hartman
0 siblings, 1 reply; 5+ messages in thread
From: Bryan Brattlof @ 2021-09-13 14:10 UTC (permalink / raw)
To: Greg Kroah-Hartman; +Cc: linux-staging, linux-kernel, Bryan Brattlof
The wake-on-lan stub is needed only when the device power management
functionality is enabled in the kernel. Conditionally define
wowlan_stub to avoid potential unused object warnings.
Signed-off-by: Bryan Brattlof <hello@bryanbrattlof.com>
---
drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c b/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c
index 34da8a569709..f4a9b4b7c97e 100644
--- a/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c
+++ b/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c
@@ -47,6 +47,7 @@ static const u32 rtw_cipher_suites[] = {
* Moreover wowlan has to be enabled via a the nl80211_set_wowlan callback.
* (from user space, e.g. iw phy0 wowlan enable)
*/
+#if defined(CONFIG_PM)
static const struct wiphy_wowlan_support wowlan_stub = {
.flags = WIPHY_WOWLAN_ANY,
.n_patterns = 0,
@@ -54,6 +55,7 @@ static const struct wiphy_wowlan_support wowlan_stub = {
.pattern_min_len = 0,
.max_pkt_offset = 0,
};
+#endif
static struct ieee80211_rate rtw_rates[] = {
RATETAB_ENT(10, 0x1, 0),
--
2.30.2
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] staging: rtl8723bs: define wowlan_stub only when CONFIG_PM is enabled
2021-09-13 14:10 [PATCH] staging: rtl8723bs: define wowlan_stub only when CONFIG_PM is enabled Bryan Brattlof
@ 2021-09-13 16:25 ` Greg Kroah-Hartman
2021-09-13 23:42 ` Bryan Brattlof
0 siblings, 1 reply; 5+ messages in thread
From: Greg Kroah-Hartman @ 2021-09-13 16:25 UTC (permalink / raw)
To: Bryan Brattlof; +Cc: linux-staging, linux-kernel
On Mon, Sep 13, 2021 at 02:10:12PM +0000, Bryan Brattlof wrote:
> The wake-on-lan stub is needed only when the device power management
> functionality is enabled in the kernel. Conditionally define
> wowlan_stub to avoid potential unused object warnings.
>
> Signed-off-by: Bryan Brattlof <hello@bryanbrattlof.com>
> ---
> drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c b/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c
> index 34da8a569709..f4a9b4b7c97e 100644
> --- a/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c
> +++ b/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c
> @@ -47,6 +47,7 @@ static const u32 rtw_cipher_suites[] = {
> * Moreover wowlan has to be enabled via a the nl80211_set_wowlan callback.
> * (from user space, e.g. iw phy0 wowlan enable)
> */
> +#if defined(CONFIG_PM)
> static const struct wiphy_wowlan_support wowlan_stub = {
> .flags = WIPHY_WOWLAN_ANY,
> .n_patterns = 0,
> @@ -54,6 +55,7 @@ static const struct wiphy_wowlan_support wowlan_stub = {
> .pattern_min_len = 0,
> .max_pkt_offset = 0,
> };
> +#endif
>
> static struct ieee80211_rate rtw_rates[] = {
> RATETAB_ENT(10, 0x1, 0),
> --
> 2.30.2
>
>
Do you get a build warning with the code as-is?
Having #if in .c files is generally a bad idea, are you sure there is no
other way to solve this?
thanks,
greg k-h
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] staging: rtl8723bs: define wowlan_stub only when CONFIG_PM is enabled
2021-09-13 16:25 ` Greg Kroah-Hartman
@ 2021-09-13 23:42 ` Bryan Brattlof
2021-09-14 8:52 ` Dan Carpenter
0 siblings, 1 reply; 5+ messages in thread
From: Bryan Brattlof @ 2021-09-13 23:42 UTC (permalink / raw)
To: Greg Kroah-Hartman; +Cc: linux-staging, linux-kernel
On this day, September 13, 2021, thus sayeth Greg Kroah-Hartman:
> On Mon, Sep 13, 2021 at 02:10:12PM +0000, Bryan Brattlof wrote:
> > The wake-on-lan stub is needed only when the device power management
> > functionality is enabled in the kernel. Conditionally define
> > wowlan_stub to avoid potential unused object warnings.
> >
> > Signed-off-by: Bryan Brattlof <hello@bryanbrattlof.com>
> > ---
> > drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c | 2 ++
> > 1 file changed, 2 insertions(+)
> >
> > diff --git a/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c b/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c
> > index 34da8a569709..f4a9b4b7c97e 100644
> > --- a/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c
> > +++ b/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c
> > @@ -47,6 +47,7 @@ static const u32 rtw_cipher_suites[] = {
> > * Moreover wowlan has to be enabled via a the nl80211_set_wowlan callback.
> > * (from user space, e.g. iw phy0 wowlan enable)
> > */
> > +#if defined(CONFIG_PM)
> > static const struct wiphy_wowlan_support wowlan_stub = {
> > .flags = WIPHY_WOWLAN_ANY,
> > .n_patterns = 0,
> > @@ -54,6 +55,7 @@ static const struct wiphy_wowlan_support wowlan_stub = {
> > .pattern_min_len = 0,
> > .max_pkt_offset = 0,
> > };
> > +#endif
> >
> > static struct ieee80211_rate rtw_rates[] = {
> > RATETAB_ENT(10, 0x1, 0),
> > --
> > 2.30.2
> >
> >
>
> Do you get a build warning with the code as-is?
>
> Having #if in .c files is generally a bad idea, are you sure there is no
> other way to solve this?
>
Hi Greg,
Turns out I should have played with the CONFIG_PM setting more before I
sent you this patch. All of this can be ripped out. :)
This is the warning I get with staging-next being where it is now:
CC [M] drivers/staging/rtl8723bs/os_dep/xmit_linux.o
drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c:50:42: warning: ‘wowlan_stub’ defined but not used [-Wunused-const-variable=]
50 | static const struct wiphy_wowlan_support wowlan_stub = {
| ^~~~~~~~~~~
I'm using tinyconfig plus the rtl8723bs driver and it's dependencies to
build a microscopic buildroot image for an Intel Compute Stick I managed
to get my hands on recently.
I assumed disabling the power management parts of the kernel produced it
and didn't think twice. :/
I'll be back with a v2 that rips all of this out.
Thanks again Greg,
~Bryan
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] staging: rtl8723bs: define wowlan_stub only when CONFIG_PM is enabled
2021-09-13 23:42 ` Bryan Brattlof
@ 2021-09-14 8:52 ` Dan Carpenter
2021-09-14 22:45 ` Bryan Brattlof
0 siblings, 1 reply; 5+ messages in thread
From: Dan Carpenter @ 2021-09-14 8:52 UTC (permalink / raw)
To: Bryan Brattlof; +Cc: Greg Kroah-Hartman, linux-staging, linux-kernel
On Mon, Sep 13, 2021 at 11:42:55PM +0000, Bryan Brattlof wrote:
> I'll be back with a v2 that rips all of this out.
Or use the __maybe_unused annotation:
static __maybe_unused const struct wiphy_wowlan_support wowlan_stub = {
regards,
dan carpenter
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] staging: rtl8723bs: define wowlan_stub only when CONFIG_PM is enabled
2021-09-14 8:52 ` Dan Carpenter
@ 2021-09-14 22:45 ` Bryan Brattlof
0 siblings, 0 replies; 5+ messages in thread
From: Bryan Brattlof @ 2021-09-14 22:45 UTC (permalink / raw)
To: Dan Carpenter; +Cc: Greg Kroah-Hartman, linux-staging, linux-kernel
On this day, September 14, 2021, thus sayeth Dan Carpenter:
> On Mon, Sep 13, 2021 at 11:42:55PM +0000, Bryan Brattlof wrote:
> > I'll be back with a v2 that rips all of this out.
>
> Or use the __maybe_unused annotation:
>
> static __maybe_unused const struct wiphy_wowlan_support wowlan_stub = {
>
Thanks for the suggestion Dan; I like this much better. :)
I've been poking around with my config today and noticed I can still
produce this warning with CONFIG_PM enabled, which means something else
is going on that I don't fully understand yet.
I may hold off on sending v2 until I make sure I understand what's going
on and double check that I didn't bork my config.
Thanks from jumping in
~Bryan
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2021-09-14 22:45 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-13 14:10 [PATCH] staging: rtl8723bs: define wowlan_stub only when CONFIG_PM is enabled Bryan Brattlof
2021-09-13 16:25 ` Greg Kroah-Hartman
2021-09-13 23:42 ` Bryan Brattlof
2021-09-14 8:52 ` Dan Carpenter
2021-09-14 22:45 ` Bryan Brattlof
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).