Historical ath9k-devel archives
 help / color / mirror / Atom feed
* [ath9k-devel] [PATCH] Make ath9k debug mask setting modifiable via /sys/module.
@ 2014-05-14  3:03 David Held
  2014-05-19 19:03 ` David Held
  0 siblings, 1 reply; 3+ messages in thread
From: David Held @ 2014-05-14  3:03 UTC (permalink / raw)
  To: ath9k-devel

Updating /sys/module/ath9k/parameters/debug will update the debug mask
used if debugging is enabled and can be read to see the current mask.

Signed-off-by: David Held <drheld@gmail.com>
---
Ideally there'd be a nicer way to do this. Definitely open to suggestions.

It seems ugly to pull the int out of the struct, but that (and the spinlock to
avoid destruction races) was the best idea I had.

 drivers/net/wireless/ath/ath9k/init.c |   27 +++++++++++++++++++++++++--
 1 file changed, 25 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/ath/ath9k/init.c b/drivers/net/wireless/ath/ath9k/init.c
index 8894e96..5b99fe2 100644
--- a/drivers/net/wireless/ath/ath9k/init.c
+++ b/drivers/net/wireless/ath/ath9k/init.c
@@ -21,6 +21,7 @@
 #include <linux/ath9k_platform.h>
 #include <linux/module.h>
 #include <linux/relay.h>
+#include <linux/spinlock.h>
 #include <net/ieee80211_radiotap.h>
 
 #include "ath9k.h"
@@ -37,8 +38,23 @@ MODULE_DESCRIPTION("Support for Atheros 802.11n wireless LAN cards.");
 MODULE_SUPPORTED_DEVICE("Atheros 802.11n WLAN cards");
 MODULE_LICENSE("Dual BSD/GPL");
 
+static DEFINE_SPINLOCK(debug_lock);
 static unsigned int ath9k_debug = ATH_DBG_DEFAULT;
-module_param_named(debug, ath9k_debug, uint, 0);
+static int *ath_common_debug = NULL;
+static int ath9k_update_debug(const char *val, const struct kernel_param *kp) {
+	int ret = param_set_uint(val, kp);
+	if (ret < 0) return ret;
+
+	spin_lock(&debug_lock);
+	if (ath_common_debug) *ath_common_debug = ath9k_debug;
+	spin_unlock(&debug_lock);
+	return 0;
+}
+static const struct kernel_param_ops ath9k_debug_param_ops = {
+	.set = ath9k_update_debug,
+	.get = param_get_uint,
+};
+module_param_cb(debug, &ath9k_debug_param_ops, &ath9k_debug, 0644);
 MODULE_PARM_DESC(debug, "Debugging mask");
 
 int ath9k_modparam_nohwcrypt;
@@ -525,10 +541,14 @@ static int ath9k_init_softc(u16 devid, struct ath_softc *sc,
 	common->ah = ah;
 	common->hw = sc->hw;
 	common->priv = sc;
-	common->debug_mask = ath9k_debug;
 	common->btcoex_enabled = ath9k_btcoex_enable == 1;
 	common->disable_ani = false;
 
+	spin_lock(&debug_lock);
+	ath_common_debug = &common->debug_mask;
+	spin_unlock(&debug_lock);
+	common->debug_mask = ath9k_debug;
+
 	/*
 	 * Platform quirks.
 	 */
@@ -875,6 +895,9 @@ static void ath9k_deinit_softc(struct ath_softc *sc)
 void ath9k_deinit_device(struct ath_softc *sc)
 {
 	struct ieee80211_hw *hw = sc->hw;
+	spin_lock(&debug_lock);
+	ath_common_debug = NULL;
+	spin_unlock(&debug_lock);
 
 	ath9k_ps_wakeup(sc);
 
-- 
1.7.10

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

* [ath9k-devel] [PATCH] Make ath9k debug mask setting modifiable via /sys/module.
  2014-05-14  3:03 [ath9k-devel] [PATCH] Make ath9k debug mask setting modifiable via /sys/module David Held
@ 2014-05-19 19:03 ` David Held
  2014-06-16 22:27   ` David Held
  0 siblings, 1 reply; 3+ messages in thread
From: David Held @ 2014-05-19 19:03 UTC (permalink / raw)
  To: ath9k-devel

Any thoughts on this?

It's rather handy to be able to update the debug mask on the fly rather
than having to remove and reinsert the module (especially if you only want
to turn on debugging after something has happened).

Thanks!


On Tue, May 13, 2014 at 11:03 PM, David Held <drheld@gmail.com> wrote:

> Updating /sys/module/ath9k/parameters/debug will update the debug mask
> used if debugging is enabled and can be read to see the current mask.
>
> Signed-off-by: David Held <drheld@gmail.com>
> ---
> Ideally there'd be a nicer way to do this. Definitely open to suggestions.
>
> It seems ugly to pull the int out of the struct, but that (and the
> spinlock to
> avoid destruction races) was the best idea I had.
>
>  drivers/net/wireless/ath/ath9k/init.c |   27 +++++++++++++++++++++++++--
>  1 file changed, 25 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/net/wireless/ath/ath9k/init.c
> b/drivers/net/wireless/ath/ath9k/init.c
> index 8894e96..5b99fe2 100644
> --- a/drivers/net/wireless/ath/ath9k/init.c
> +++ b/drivers/net/wireless/ath/ath9k/init.c
> @@ -21,6 +21,7 @@
>  #include <linux/ath9k_platform.h>
>  #include <linux/module.h>
>  #include <linux/relay.h>
> +#include <linux/spinlock.h>
>  #include <net/ieee80211_radiotap.h>
>
>  #include "ath9k.h"
> @@ -37,8 +38,23 @@ MODULE_DESCRIPTION("Support for Atheros 802.11n
> wireless LAN cards.");
>  MODULE_SUPPORTED_DEVICE("Atheros 802.11n WLAN cards");
>  MODULE_LICENSE("Dual BSD/GPL");
>
> +static DEFINE_SPINLOCK(debug_lock);
>  static unsigned int ath9k_debug = ATH_DBG_DEFAULT;
> -module_param_named(debug, ath9k_debug, uint, 0);
> +static int *ath_common_debug = NULL;
> +static int ath9k_update_debug(const char *val, const struct kernel_param
> *kp) {
> +       int ret = param_set_uint(val, kp);
> +       if (ret < 0) return ret;
> +
> +       spin_lock(&debug_lock);
> +       if (ath_common_debug) *ath_common_debug = ath9k_debug;
> +       spin_unlock(&debug_lock);
> +       return 0;
> +}
> +static const struct kernel_param_ops ath9k_debug_param_ops = {
> +       .set = ath9k_update_debug,
> +       .get = param_get_uint,
> +};
> +module_param_cb(debug, &ath9k_debug_param_ops, &ath9k_debug, 0644);
>  MODULE_PARM_DESC(debug, "Debugging mask");
>
>  int ath9k_modparam_nohwcrypt;
> @@ -525,10 +541,14 @@ static int ath9k_init_softc(u16 devid, struct
> ath_softc *sc,
>         common->ah = ah;
>         common->hw = sc->hw;
>         common->priv = sc;
> -       common->debug_mask = ath9k_debug;
>         common->btcoex_enabled = ath9k_btcoex_enable == 1;
>         common->disable_ani = false;
>
> +       spin_lock(&debug_lock);
> +       ath_common_debug = &common->debug_mask;
> +       spin_unlock(&debug_lock);
> +       common->debug_mask = ath9k_debug;
> +
>         /*
>          * Platform quirks.
>          */
> @@ -875,6 +895,9 @@ static void ath9k_deinit_softc(struct ath_softc *sc)
>  void ath9k_deinit_device(struct ath_softc *sc)
>  {
>         struct ieee80211_hw *hw = sc->hw;
> +       spin_lock(&debug_lock);
> +       ath_common_debug = NULL;
> +       spin_unlock(&debug_lock);
>
>         ath9k_ps_wakeup(sc);
>
> --
> 1.7.10
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ath9k.org/pipermail/ath9k-devel/attachments/20140519/cb185b97/attachment.htm 

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

* [ath9k-devel] [PATCH] Make ath9k debug mask setting modifiable via /sys/module.
  2014-05-19 19:03 ` David Held
@ 2014-06-16 22:27   ` David Held
  0 siblings, 0 replies; 3+ messages in thread
From: David Held @ 2014-06-16 22:27 UTC (permalink / raw)
  To: ath9k-devel

[+Kalle Valo]

The ath10k driver supports setting this live, so hoping to bring similar
support to ath9k.


On Mon, May 19, 2014 at 3:03 PM, David Held <drheld@gmail.com> wrote:

> Any thoughts on this?
>
> It's rather handy to be able to update the debug mask on the fly rather
> than having to remove and reinsert the module (especially if you only want
> to turn on debugging after something has happened).
>
> Thanks!
>
>
> On Tue, May 13, 2014 at 11:03 PM, David Held <drheld@gmail.com> wrote:
>
>> Updating /sys/module/ath9k/parameters/debug will update the debug mask
>> used if debugging is enabled and can be read to see the current mask.
>>
>> Signed-off-by: David Held <drheld@gmail.com>
>> ---
>> Ideally there'd be a nicer way to do this. Definitely open to suggestions.
>>
>> It seems ugly to pull the int out of the struct, but that (and the
>> spinlock to
>> avoid destruction races) was the best idea I had.
>>
>>  drivers/net/wireless/ath/ath9k/init.c |   27 +++++++++++++++++++++++++--
>>  1 file changed, 25 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/net/wireless/ath/ath9k/init.c
>> b/drivers/net/wireless/ath/ath9k/init.c
>> index 8894e96..5b99fe2 100644
>> --- a/drivers/net/wireless/ath/ath9k/init.c
>> +++ b/drivers/net/wireless/ath/ath9k/init.c
>> @@ -21,6 +21,7 @@
>>  #include <linux/ath9k_platform.h>
>>  #include <linux/module.h>
>>  #include <linux/relay.h>
>> +#include <linux/spinlock.h>
>>  #include <net/ieee80211_radiotap.h>
>>
>>  #include "ath9k.h"
>> @@ -37,8 +38,23 @@ MODULE_DESCRIPTION("Support for Atheros 802.11n
>> wireless LAN cards.");
>>  MODULE_SUPPORTED_DEVICE("Atheros 802.11n WLAN cards");
>>  MODULE_LICENSE("Dual BSD/GPL");
>>
>> +static DEFINE_SPINLOCK(debug_lock);
>>  static unsigned int ath9k_debug = ATH_DBG_DEFAULT;
>> -module_param_named(debug, ath9k_debug, uint, 0);
>> +static int *ath_common_debug = NULL;
>> +static int ath9k_update_debug(const char *val, const struct kernel_param
>> *kp) {
>> +       int ret = param_set_uint(val, kp);
>> +       if (ret < 0) return ret;
>> +
>> +       spin_lock(&debug_lock);
>> +       if (ath_common_debug) *ath_common_debug = ath9k_debug;
>> +       spin_unlock(&debug_lock);
>> +       return 0;
>> +}
>> +static const struct kernel_param_ops ath9k_debug_param_ops = {
>> +       .set = ath9k_update_debug,
>> +       .get = param_get_uint,
>> +};
>> +module_param_cb(debug, &ath9k_debug_param_ops, &ath9k_debug, 0644);
>>  MODULE_PARM_DESC(debug, "Debugging mask");
>>
>>  int ath9k_modparam_nohwcrypt;
>> @@ -525,10 +541,14 @@ static int ath9k_init_softc(u16 devid, struct
>> ath_softc *sc,
>>         common->ah = ah;
>>         common->hw = sc->hw;
>>         common->priv = sc;
>> -       common->debug_mask = ath9k_debug;
>>         common->btcoex_enabled = ath9k_btcoex_enable == 1;
>>         common->disable_ani = false;
>>
>> +       spin_lock(&debug_lock);
>> +       ath_common_debug = &common->debug_mask;
>> +       spin_unlock(&debug_lock);
>> +       common->debug_mask = ath9k_debug;
>> +
>>         /*
>>          * Platform quirks.
>>          */
>> @@ -875,6 +895,9 @@ static void ath9k_deinit_softc(struct ath_softc *sc)
>>  void ath9k_deinit_device(struct ath_softc *sc)
>>  {
>>         struct ieee80211_hw *hw = sc->hw;
>> +       spin_lock(&debug_lock);
>> +       ath_common_debug = NULL;
>> +       spin_unlock(&debug_lock);
>>
>>         ath9k_ps_wakeup(sc);
>>
>> --
>> 1.7.10
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ath9k.org/pipermail/ath9k-devel/attachments/20140616/1a49fe8b/attachment.htm 

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

end of thread, other threads:[~2014-06-16 22:27 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-05-14  3:03 [ath9k-devel] [PATCH] Make ath9k debug mask setting modifiable via /sys/module David Held
2014-05-19 19:03 ` David Held
2014-06-16 22:27   ` David Held

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox