From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756790AbbJAR6G (ORCPT ); Thu, 1 Oct 2015 13:58:06 -0400 Received: from mail-lb0-f180.google.com ([209.85.217.180]:36613 "EHLO mail-lb0-f180.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753865AbbJAR6E (ORCPT ); Thu, 1 Oct 2015 13:58:04 -0400 Subject: Re: [PATCH] staging: rtl8192e: rtl_wx: fix negative noise value To: Luis de Bethencourt , linux-kernel@vger.kernel.org References: <1443615131-18867-1-git-send-email-luisbg@osg.samsung.com> Cc: gregkh@linuxfoundation.org, cristina.opriceana@gmail.com, devel@driverdev.osuosl.org From: Mateusz Kulikowski X-Enigmail-Draft-Status: N1110 Message-ID: <560D7429.30401@gmail.com> Date: Thu, 1 Oct 2015 19:58:01 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.2.0 MIME-Version: 1.0 In-Reply-To: <1443615131-18867-1-git-send-email-luisbg@osg.samsung.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 > --- > 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 Although I still don't understand why someone wanted to have unsigned noise (historical reasons perhaps?) Mateusz