linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] rtlwifi: rtl_pci: Fix errors when CONFIG_RTLWIFI_DEBUG is not set
@ 2019-09-20  2:25 Larry Finger
  2019-09-20  6:17 ` Kalle Valo
  2019-09-21  7:44 ` Kalle Valo
  0 siblings, 2 replies; 3+ messages in thread
From: Larry Finger @ 2019-09-20  2:25 UTC (permalink / raw)
  To: kvalo; +Cc: linux-wireless, pkshih, Larry Finger

When rtlwifi debugging is disabled, missing globals occur due to the
attempt execution of code that is never generated.

Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
---
 drivers/net/wireless/realtek/rtlwifi/pci.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/net/wireless/realtek/rtlwifi/pci.c b/drivers/net/wireless/realtek/rtlwifi/pci.c
index 6087ec7a90a6..2f8aad28f1c0 100644
--- a/drivers/net/wireless/realtek/rtlwifi/pci.c
+++ b/drivers/net/wireless/realtek/rtlwifi/pci.c
@@ -2298,8 +2298,10 @@ int rtl_pci_probe(struct pci_dev *pdev,
 	}
 	rtlpriv->mac80211.mac80211_registered = 1;
 
+#ifdef CONFIG_RTLWIFI_DEBUG
 	/* add for debug */
 	rtl_debug_add_one(hw);
+#endif
 
 	/*init rfkill */
 	rtl_init_rfkill(hw);	/* Init PCI sw */
@@ -2349,8 +2351,10 @@ void rtl_pci_disconnect(struct pci_dev *pdev)
 	wait_for_completion(&rtlpriv->firmware_loading_complete);
 	clear_bit(RTL_STATUS_INTERFACE_START, &rtlpriv->status);
 
+#ifdef CONFIG_RTLWIFI_DEBUG
 	/* remove form debug */
 	rtl_debug_remove_one(hw);
+#endif
 
 	/*ieee80211_unregister_hw will call ops_stop */
 	if (rtlmac->mac80211_registered == 1) {
-- 
2.23.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] rtlwifi: rtl_pci: Fix errors when CONFIG_RTLWIFI_DEBUG is not set
  2019-09-20  2:25 [PATCH] rtlwifi: rtl_pci: Fix errors when CONFIG_RTLWIFI_DEBUG is not set Larry Finger
@ 2019-09-20  6:17 ` Kalle Valo
  2019-09-21  7:44 ` Kalle Valo
  1 sibling, 0 replies; 3+ messages in thread
From: Kalle Valo @ 2019-09-20  6:17 UTC (permalink / raw)
  To: Larry Finger; +Cc: linux-wireless, pkshih

Larry Finger <Larry.Finger@lwfinger.net> writes:

> When rtlwifi debugging is disabled, missing globals occur due to the
> attempt execution of code that is never generated.
>
> Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>

Is this is a new regression or an old problem?

-- 
Kalle Valo

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] rtlwifi: rtl_pci: Fix errors when CONFIG_RTLWIFI_DEBUG is not set
  2019-09-20  2:25 [PATCH] rtlwifi: rtl_pci: Fix errors when CONFIG_RTLWIFI_DEBUG is not set Larry Finger
  2019-09-20  6:17 ` Kalle Valo
@ 2019-09-21  7:44 ` Kalle Valo
  1 sibling, 0 replies; 3+ messages in thread
From: Kalle Valo @ 2019-09-21  7:44 UTC (permalink / raw)
  To: Larry Finger; +Cc: linux-wireless, pkshih

Larry Finger <Larry.Finger@lwfinger.net> writes:

> When rtlwifi debugging is disabled, missing globals occur due to the
> attempt execution of code that is never generated.

Do you have the exact error message? I don't know why this is failing.

> Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
> ---
>  drivers/net/wireless/realtek/rtlwifi/pci.c | 4 ++++
>  1 file changed, 4 insertions(+)
>
> diff --git a/drivers/net/wireless/realtek/rtlwifi/pci.c b/drivers/net/wireless/realtek/rtlwifi/pci.c
> index 6087ec7a90a6..2f8aad28f1c0 100644
> --- a/drivers/net/wireless/realtek/rtlwifi/pci.c
> +++ b/drivers/net/wireless/realtek/rtlwifi/pci.c
> @@ -2298,8 +2298,10 @@ int rtl_pci_probe(struct pci_dev *pdev,
>  	}
>  	rtlpriv->mac80211.mac80211_registered = 1;
>  
> +#ifdef CONFIG_RTLWIFI_DEBUG
>  	/* add for debug */
>  	rtl_debug_add_one(hw);
> +#endif
>  
>  	/*init rfkill */
>  	rtl_init_rfkill(hw);	/* Init PCI sw */
> @@ -2349,8 +2351,10 @@ void rtl_pci_disconnect(struct pci_dev *pdev)
>  	wait_for_completion(&rtlpriv->firmware_loading_complete);
>  	clear_bit(RTL_STATUS_INTERFACE_START, &rtlpriv->status);
>  
> +#ifdef CONFIG_RTLWIFI_DEBUG
>  	/* remove form debug */
>  	rtl_debug_remove_one(hw);
> +#endif

Then I checked debug.h I see that it's supposed to be handled already:

#ifdef CONFIG_RTLWIFI_DEBUG
void rtl_debug_add_one(struct ieee80211_hw *hw);
void rtl_debug_remove_one(struct ieee80211_hw *hw);
void rtl_debugfs_add_topdir(void);
void rtl_debugfs_remove_topdir(void);
#else
#define rtl_debug_add_one(hw)
#define rtl_debug_remove_one(hw)
#define rtl_debugfs_add_topdir()
#define rtl_debugfs_remove_topdir()
#endif

But the else part looks weird, I'm used to using inline functions
instead of defines:

static inline void rtl_debug_add_one(struct ieee80211_hw *hw) {}
static inline void rtl_debug_remove_one(struct ieee80211_hw *hw) {}
static inline void rtl_debugfs_add_topdir(void) {}
static inline void rtl_debugfs_remove_topdir(void) {}

Inline functions also make it possible for the compiler to check the
types are correct.

-- 
Kalle Valo

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-09-21  7:44 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-20  2:25 [PATCH] rtlwifi: rtl_pci: Fix errors when CONFIG_RTLWIFI_DEBUG is not set Larry Finger
2019-09-20  6:17 ` Kalle Valo
2019-09-21  7:44 ` Kalle Valo

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).