linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] staging: rtl8192e: rtl_wx: fix negative noise value
@ 2015-09-30 12:12 Luis de Bethencourt
  2015-10-01 17:58 ` Mateusz Kulikowski
  0 siblings, 1 reply; 2+ messages in thread
From: Luis de Bethencourt @ 2015-09-30 12:12 UTC (permalink / raw)
  To: linux-kernel
  Cc: gregkh, mateusz.kulikowski, cristina.opriceana, devel,
	Luis de Bethencourt

wstats->qual.noise is of type uint8, so it shouldn't be assigned a
negative number. Assigning it 0x100 - 100, which is the equivalent
to -100 dBm when IW_QUAL_DBM is set.

Signed-off-by: Luis de Bethencourt <luisbg@osg.samsung.com>
---
 drivers/staging/rtl8192e/rtl8192e/rtl_wx.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_wx.c b/drivers/staging/rtl8192e/rtl8192e/rtl_wx.c
index 984cb9a..70df6a1 100644
--- a/drivers/staging/rtl8192e/rtl8192e/rtl_wx.c
+++ b/drivers/staging/rtl8192e/rtl8192e/rtl_wx.c
@@ -1225,7 +1225,7 @@ static struct iw_statistics *_rtl92e_get_wireless_stats(struct net_device *dev)
 	if (ieee->state < RTLLIB_LINKED) {
 		wstats->qual.qual = 10;
 		wstats->qual.level = 0;
-		wstats->qual.noise = -100;
+		wstats->qual.noise = 0x100 - 100;	/* -100 dBm */
 		wstats->qual.updated = IW_QUAL_ALL_UPDATED | IW_QUAL_DBM;
 		return wstats;
 	}
-- 
2.5.1


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

* Re: [PATCH] staging: rtl8192e: rtl_wx: fix negative noise value
  2015-09-30 12:12 [PATCH] staging: rtl8192e: rtl_wx: fix negative noise value Luis de Bethencourt
@ 2015-10-01 17:58 ` Mateusz Kulikowski
  0 siblings, 0 replies; 2+ messages in thread
From: Mateusz Kulikowski @ 2015-10-01 17:58 UTC (permalink / raw)
  To: Luis de Bethencourt, linux-kernel; +Cc: gregkh, cristina.opriceana, devel

On 30.09.2015 14:12, Luis de Bethencourt wrote:
> wstats->qual.noise is of type uint8, so it shouldn't be assigned a
> negative number. Assigning it 0x100 - 100, which is the equivalent
> to -100 dBm when IW_QUAL_DBM is set.
> 
> Signed-off-by: Luis de Bethencourt <luisbg@osg.samsung.com>
> ---
>  drivers/staging/rtl8192e/rtl8192e/rtl_wx.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_wx.c b/drivers/staging/rtl8192e/rtl8192e/rtl_wx.c
> index 984cb9a..70df6a1 100644
> --- a/drivers/staging/rtl8192e/rtl8192e/rtl_wx.c
> +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_wx.c
> @@ -1225,7 +1225,7 @@ static struct iw_statistics *_rtl92e_get_wireless_stats(struct net_device *dev)
>  	if (ieee->state < RTLLIB_LINKED) {
>  		wstats->qual.qual = 10;
>  		wstats->qual.level = 0;
> -		wstats->qual.noise = -100;
> +		wstats->qual.noise = 0x100 - 100;	/* -100 dBm */
>  		wstats->qual.updated = IW_QUAL_ALL_UPDATED | IW_QUAL_DBM;
>  		return wstats;
>  	}
> 


Tested-by: Mateusz Kulikowski <mateusz.kulikowski@gmail.com>

Although I still don't understand why someone wanted to have unsigned noise
(historical reasons perhaps?)


Mateusz

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

end of thread, other threads:[~2015-10-01 17:58 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-09-30 12:12 [PATCH] staging: rtl8192e: rtl_wx: fix negative noise value Luis de Bethencourt
2015-10-01 17:58 ` Mateusz Kulikowski

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