All of lore.kernel.org
 help / color / mirror / Atom feed
* [ath9k-devel] ath9k_htc: Support for AR9271 chipset.
@ 2015-08-11 21:43 Dan Carpenter
  2015-08-13 18:21   ` Oleksij Rempel
  0 siblings, 1 reply; 7+ messages in thread
From: Dan Carpenter @ 2015-08-11 21:43 UTC (permalink / raw)
  To: ath9k-devel

Hello Sujith,

The patch fb9987d0f748: "ath9k_htc: Support for AR9271 chipset." from
Mar 17, 2010, leads to the following static checker warning:

	drivers/net/wireless/ath/ath9k/htc_drv_main.c:850 ath9k_htc_ani_work()
	warn: 'common->ani.caldone' can be either negative or positive

drivers/net/wireless/ath/ath9k/htc_drv_main.c
   830                  /* Perform calibration if necessary */
   831                  if (longcal || shortcal)
   832                          common->ani.caldone =
   833                                  ath9k_hw_calibrate(ah, ah->curchan,
   834                                                     ah->rxchainmask, longcal);

ath9k_hw_calibrate() returns true/false/-ETIMEOUT.


   835  
   836                  ath9k_htc_ps_restore(priv);
   837          }
   838  
   839  set_timer:
   840          /*
   841          * Set timer interval based on previous results.
   842          * The interval must be the shortest necessary to satisfy ANI,
   843          * short calibration and long calibration.
   844          */
   845          cal_interval = ATH_LONG_CALINTERVAL;
   846          cal_interval = min(cal_interval, (u32)ATH_ANI_POLLINTERVAL);
   847          if (!common->ani.caldone)

But we don't test for negative here.

   848                  cal_interval = min(cal_interval, (u32)short_cal_interval);
   849  
   850          ieee80211_queue_delayed_work(common->hw, &priv->ani_work,
   851                                       msecs_to_jiffies(cal_interval));
   852  }

regards,
dan carpenter

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

* [ath9k-devel] [PATCH] ath9k_htc: do ani shortcalibratio if we got -ETIMEDOUT
  2015-08-11 21:43 [ath9k-devel] ath9k_htc: Support for AR9271 chipset Dan Carpenter
@ 2015-08-13 18:21   ` Oleksij Rempel
  0 siblings, 0 replies; 7+ messages in thread
From: Oleksij Rempel @ 2015-08-13 18:21 UTC (permalink / raw)
  To: ath9k-devel

From: Oleksij Rempel <external.Oleksij.Rempel@de.bosch.com>

current code will handle -ETIMEDOUT as success which is probalbly wrong.

According to this comment I assume it is safe to handle -ETIMEDOUT as false:
drivers/net/wireless/ath/ath9k/calib.c
290         /*
291          * We timed out waiting for the noisefloor to load, probably due to an
292          * in-progress rx. Simply return here and allow the load plenty of time
293          * to complete before the next calibration interval.  We need to avoid
294          * trying to load -50 (which happens below) while the previous load is
295          * still in progress as this can cause rx deafness. Instead by returning
296          * here, the baseband nf cal will just be capped by our present
297          * noisefloor until the next calibration timer.
298          */

Since no other error wariants are present, this patch is checking only
for (ret <= 0).

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Oleksij Rempel <external.Oleksij.Rempel@de.bosch.com>
---
 drivers/net/wireless/ath/ath9k/htc_drv_main.c | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_main.c b/drivers/net/wireless/ath/ath9k/htc_drv_main.c
index dab1323..172a9ff 100644
--- a/drivers/net/wireless/ath/ath9k/htc_drv_main.c
+++ b/drivers/net/wireless/ath/ath9k/htc_drv_main.c
@@ -794,8 +794,11 @@ void ath9k_htc_ani_work(struct work_struct *work)
 		common->ani.longcal_timer = timestamp;
 	}
 
-	/* Short calibration applies only while caldone is false */
-	if (!common->ani.caldone) {
+	/*
+	 * Short calibration applies only while caldone
+	 * is false or -ETIMEDOUT
+	 */
+	if (common->ani.caldone <= 0) {
 		if ((timestamp - common->ani.shortcal_timer) >=
 		    short_cal_interval) {
 			shortcal = true;
@@ -844,7 +847,11 @@ set_timer:
 	*/
 	cal_interval = ATH_LONG_CALINTERVAL;
 	cal_interval = min(cal_interval, (u32)ATH_ANI_POLLINTERVAL);
-	if (!common->ani.caldone)
+	/*
+	 * Short calibration applies only while caldone
+	 * is false or -ETIMEDOUT
+	 */
+	if (common->ani.caldone <= 0)
 		cal_interval = min(cal_interval, (u32)short_cal_interval);
 
 	ieee80211_queue_delayed_work(common->hw, &priv->ani_work,
-- 
2.1.4

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

* [PATCH] ath9k_htc: do ani shortcalibratio if we got -ETIMEDOUT
@ 2015-08-13 18:21   ` Oleksij Rempel
  0 siblings, 0 replies; 7+ messages in thread
From: Oleksij Rempel @ 2015-08-13 18:21 UTC (permalink / raw)
  To: ath9k-devel, dan.carpenter, Sujith.Manoharan, kvalo,
	linux-wireless
  Cc: Oleksij Rempel

From: Oleksij Rempel <external.Oleksij.Rempel@de.bosch.com>

current code will handle -ETIMEDOUT as success which is probalbly wrong.

According to this comment I assume it is safe to handle -ETIMEDOUT as false:
drivers/net/wireless/ath/ath9k/calib.c
290         /*
291          * We timed out waiting for the noisefloor to load, probably due to an
292          * in-progress rx. Simply return here and allow the load plenty of time
293          * to complete before the next calibration interval.  We need to avoid
294          * trying to load -50 (which happens below) while the previous load is
295          * still in progress as this can cause rx deafness. Instead by returning
296          * here, the baseband nf cal will just be capped by our present
297          * noisefloor until the next calibration timer.
298          */

Since no other error wariants are present, this patch is checking only
for (ret <= 0).

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Oleksij Rempel <external.Oleksij.Rempel@de.bosch.com>
---
 drivers/net/wireless/ath/ath9k/htc_drv_main.c | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_main.c b/drivers/net/wireless/ath/ath9k/htc_drv_main.c
index dab1323..172a9ff 100644
--- a/drivers/net/wireless/ath/ath9k/htc_drv_main.c
+++ b/drivers/net/wireless/ath/ath9k/htc_drv_main.c
@@ -794,8 +794,11 @@ void ath9k_htc_ani_work(struct work_struct *work)
 		common->ani.longcal_timer = timestamp;
 	}
 
-	/* Short calibration applies only while caldone is false */
-	if (!common->ani.caldone) {
+	/*
+	 * Short calibration applies only while caldone
+	 * is false or -ETIMEDOUT
+	 */
+	if (common->ani.caldone <= 0) {
 		if ((timestamp - common->ani.shortcal_timer) >=
 		    short_cal_interval) {
 			shortcal = true;
@@ -844,7 +847,11 @@ set_timer:
 	*/
 	cal_interval = ATH_LONG_CALINTERVAL;
 	cal_interval = min(cal_interval, (u32)ATH_ANI_POLLINTERVAL);
-	if (!common->ani.caldone)
+	/*
+	 * Short calibration applies only while caldone
+	 * is false or -ETIMEDOUT
+	 */
+	if (common->ani.caldone <= 0)
 		cal_interval = min(cal_interval, (u32)short_cal_interval);
 
 	ieee80211_queue_delayed_work(common->hw, &priv->ani_work,
-- 
2.1.4


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

* [ath9k-devel] [PATCH] ath9k_htc: do ani shortcalibratio if we got -ETIMEDOUT
  2015-08-13 18:21   ` Oleksij Rempel
@ 2015-08-14  5:10     ` Oleksij Rempel
  -1 siblings, 0 replies; 7+ messages in thread
From: Oleksij Rempel @ 2015-08-14  5:10 UTC (permalink / raw)
  To: ath9k-devel

Opps wrong email address. I'll resend the patch

Am 13.08.2015 um 20:21 schrieb Oleksij Rempel:
> From: Oleksij Rempel <external.Oleksij.Rempel@de.bosch.com>
> 
> current code will handle -ETIMEDOUT as success which is probalbly wrong.
> 
> According to this comment I assume it is safe to handle -ETIMEDOUT as false:
> drivers/net/wireless/ath/ath9k/calib.c
> 290         /*
> 291          * We timed out waiting for the noisefloor to load, probably due to an
> 292          * in-progress rx. Simply return here and allow the load plenty of time
> 293          * to complete before the next calibration interval.  We need to avoid
> 294          * trying to load -50 (which happens below) while the previous load is
> 295          * still in progress as this can cause rx deafness. Instead by returning
> 296          * here, the baseband nf cal will just be capped by our present
> 297          * noisefloor until the next calibration timer.
> 298          */
> 
> Since no other error wariants are present, this patch is checking only
> for (ret <= 0).
> 
> Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
> Signed-off-by: Oleksij Rempel <external.Oleksij.Rempel@de.bosch.com>
> ---
>  drivers/net/wireless/ath/ath9k/htc_drv_main.c | 13 ++++++++++---
>  1 file changed, 10 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_main.c b/drivers/net/wireless/ath/ath9k/htc_drv_main.c
> index dab1323..172a9ff 100644
> --- a/drivers/net/wireless/ath/ath9k/htc_drv_main.c
> +++ b/drivers/net/wireless/ath/ath9k/htc_drv_main.c
> @@ -794,8 +794,11 @@ void ath9k_htc_ani_work(struct work_struct *work)
>  		common->ani.longcal_timer = timestamp;
>  	}
>  
> -	/* Short calibration applies only while caldone is false */
> -	if (!common->ani.caldone) {
> +	/*
> +	 * Short calibration applies only while caldone
> +	 * is false or -ETIMEDOUT
> +	 */
> +	if (common->ani.caldone <= 0) {
>  		if ((timestamp - common->ani.shortcal_timer) >=
>  		    short_cal_interval) {
>  			shortcal = true;
> @@ -844,7 +847,11 @@ set_timer:
>  	*/
>  	cal_interval = ATH_LONG_CALINTERVAL;
>  	cal_interval = min(cal_interval, (u32)ATH_ANI_POLLINTERVAL);
> -	if (!common->ani.caldone)
> +	/*
> +	 * Short calibration applies only while caldone
> +	 * is false or -ETIMEDOUT
> +	 */
> +	if (common->ani.caldone <= 0)
>  		cal_interval = min(cal_interval, (u32)short_cal_interval);
>  
>  	ieee80211_queue_delayed_work(common->hw, &priv->ani_work,
> 


-- 
Regards,
Oleksij

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 213 bytes
Desc: OpenPGP digital signature
Url : http://lists.ath9k.org/pipermail/ath9k-devel/attachments/20150814/44f71548/attachment.pgp 

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

* Re: [ath9k-devel] [PATCH] ath9k_htc: do ani shortcalibratio if we got -ETIMEDOUT
@ 2015-08-14  5:10     ` Oleksij Rempel
  0 siblings, 0 replies; 7+ messages in thread
From: Oleksij Rempel @ 2015-08-14  5:10 UTC (permalink / raw)
  To: ath9k-devel, dan.carpenter, Sujith.Manoharan, kvalo,
	linux-wireless
  Cc: Oleksij Rempel

[-- Attachment #1: Type: text/plain, Size: 2558 bytes --]

Opps wrong email address. I'll resend the patch

Am 13.08.2015 um 20:21 schrieb Oleksij Rempel:
> From: Oleksij Rempel <external.Oleksij.Rempel@de.bosch.com>
> 
> current code will handle -ETIMEDOUT as success which is probalbly wrong.
> 
> According to this comment I assume it is safe to handle -ETIMEDOUT as false:
> drivers/net/wireless/ath/ath9k/calib.c
> 290         /*
> 291          * We timed out waiting for the noisefloor to load, probably due to an
> 292          * in-progress rx. Simply return here and allow the load plenty of time
> 293          * to complete before the next calibration interval.  We need to avoid
> 294          * trying to load -50 (which happens below) while the previous load is
> 295          * still in progress as this can cause rx deafness. Instead by returning
> 296          * here, the baseband nf cal will just be capped by our present
> 297          * noisefloor until the next calibration timer.
> 298          */
> 
> Since no other error wariants are present, this patch is checking only
> for (ret <= 0).
> 
> Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
> Signed-off-by: Oleksij Rempel <external.Oleksij.Rempel@de.bosch.com>
> ---
>  drivers/net/wireless/ath/ath9k/htc_drv_main.c | 13 ++++++++++---
>  1 file changed, 10 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_main.c b/drivers/net/wireless/ath/ath9k/htc_drv_main.c
> index dab1323..172a9ff 100644
> --- a/drivers/net/wireless/ath/ath9k/htc_drv_main.c
> +++ b/drivers/net/wireless/ath/ath9k/htc_drv_main.c
> @@ -794,8 +794,11 @@ void ath9k_htc_ani_work(struct work_struct *work)
>  		common->ani.longcal_timer = timestamp;
>  	}
>  
> -	/* Short calibration applies only while caldone is false */
> -	if (!common->ani.caldone) {
> +	/*
> +	 * Short calibration applies only while caldone
> +	 * is false or -ETIMEDOUT
> +	 */
> +	if (common->ani.caldone <= 0) {
>  		if ((timestamp - common->ani.shortcal_timer) >=
>  		    short_cal_interval) {
>  			shortcal = true;
> @@ -844,7 +847,11 @@ set_timer:
>  	*/
>  	cal_interval = ATH_LONG_CALINTERVAL;
>  	cal_interval = min(cal_interval, (u32)ATH_ANI_POLLINTERVAL);
> -	if (!common->ani.caldone)
> +	/*
> +	 * Short calibration applies only while caldone
> +	 * is false or -ETIMEDOUT
> +	 */
> +	if (common->ani.caldone <= 0)
>  		cal_interval = min(cal_interval, (u32)short_cal_interval);
>  
>  	ieee80211_queue_delayed_work(common->hw, &priv->ani_work,
> 


-- 
Regards,
Oleksij


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 213 bytes --]

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

* [PATCH v2] ath9k_htc: do ani shortcalibratio if we got -ETIMEDOUT
  2015-08-14  5:10     ` Oleksij Rempel
  (?)
@ 2015-08-14  5:16     ` Oleksij Rempel
  2015-08-25 12:10       ` [v2] " Kalle Valo
  -1 siblings, 1 reply; 7+ messages in thread
From: Oleksij Rempel @ 2015-08-14  5:16 UTC (permalink / raw)
  To: ath9k-devel, kvalo, linux-wireless; +Cc: Oleksij Rempel

current code will handle -ETIMEDOUT as success which is probalbly wrong.

According to this comment I assume it is safe to handle -ETIMEDOUT as false:
drivers/net/wireless/ath/ath9k/calib.c
290         /*
291          * We timed out waiting for the noisefloor to load, probably due to an
292          * in-progress rx. Simply return here and allow the load plenty of time
293          * to complete before the next calibration interval.  We need to avoid
294          * trying to load -50 (which happens below) while the previous load is
295          * still in progress as this can cause rx deafness. Instead by returning
296          * here, the baseband nf cal will just be capped by our present
297          * noisefloor until the next calibration timer.
298          */

Since no other error wariants are present, this patch is checking only
for (ret <= 0).

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Oleksij Rempel <linux@rempel-privat.de>
---
 drivers/net/wireless/ath/ath9k/htc_drv_main.c | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_main.c b/drivers/net/wireless/ath/ath9k/htc_drv_main.c
index dab1323..172a9ff 100644
--- a/drivers/net/wireless/ath/ath9k/htc_drv_main.c
+++ b/drivers/net/wireless/ath/ath9k/htc_drv_main.c
@@ -794,8 +794,11 @@ void ath9k_htc_ani_work(struct work_struct *work)
 		common->ani.longcal_timer = timestamp;
 	}
 
-	/* Short calibration applies only while caldone is false */
-	if (!common->ani.caldone) {
+	/*
+	 * Short calibration applies only while caldone
+	 * is false or -ETIMEDOUT
+	 */
+	if (common->ani.caldone <= 0) {
 		if ((timestamp - common->ani.shortcal_timer) >=
 		    short_cal_interval) {
 			shortcal = true;
@@ -844,7 +847,11 @@ set_timer:
 	*/
 	cal_interval = ATH_LONG_CALINTERVAL;
 	cal_interval = min(cal_interval, (u32)ATH_ANI_POLLINTERVAL);
-	if (!common->ani.caldone)
+	/*
+	 * Short calibration applies only while caldone
+	 * is false or -ETIMEDOUT
+	 */
+	if (common->ani.caldone <= 0)
 		cal_interval = min(cal_interval, (u32)short_cal_interval);
 
 	ieee80211_queue_delayed_work(common->hw, &priv->ani_work,
-- 
2.1.4


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

* Re: [v2] ath9k_htc: do ani shortcalibratio if we got -ETIMEDOUT
  2015-08-14  5:16     ` [PATCH v2] " Oleksij Rempel
@ 2015-08-25 12:10       ` Kalle Valo
  0 siblings, 0 replies; 7+ messages in thread
From: Kalle Valo @ 2015-08-25 12:10 UTC (permalink / raw)
  To: Oleksij Rempel; +Cc: ath9k-devel, linux-wireless, Oleksij Rempel


> current code will handle -ETIMEDOUT as success which is probalbly wrong.
> 
> According to this comment I assume it is safe to handle -ETIMEDOUT as false:
> drivers/net/wireless/ath/ath9k/calib.c
> 290         /*
> 291          * We timed out waiting for the noisefloor to load, probably due to an
> 292          * in-progress rx. Simply return here and allow the load plenty of time
> 293          * to complete before the next calibration interval.  We need to avoid
> 294          * trying to load -50 (which happens below) while the previous load is
> 295          * still in progress as this can cause rx deafness. Instead by returning
> 296          * here, the baseband nf cal will just be capped by our present
> 297          * noisefloor until the next calibration timer.
> 298          */
> 
> Since no other error wariants are present, this patch is checking only
> for (ret <= 0).
> 
> Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
> Signed-off-by: Oleksij Rempel <linux@rempel-privat.de>

Thanks, applied to wireless-drivers-next.git.

Kalle Valo

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

end of thread, other threads:[~2015-08-25 12:10 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-08-11 21:43 [ath9k-devel] ath9k_htc: Support for AR9271 chipset Dan Carpenter
2015-08-13 18:21 ` [ath9k-devel] [PATCH] ath9k_htc: do ani shortcalibratio if we got -ETIMEDOUT Oleksij Rempel
2015-08-13 18:21   ` Oleksij Rempel
2015-08-14  5:10   ` [ath9k-devel] " Oleksij Rempel
2015-08-14  5:10     ` Oleksij Rempel
2015-08-14  5:16     ` [PATCH v2] " Oleksij Rempel
2015-08-25 12:10       ` [v2] " Kalle Valo

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.