outreachy.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
* [PATCH v4] staging: rtl8712: rename tmpVal to pct_val
@ 2024-03-13  8:10 Ayush Tiwari
  2024-03-13  8:18 ` Julia Lawall
  0 siblings, 1 reply; 3+ messages in thread
From: Ayush Tiwari @ 2024-03-13  8:10 UTC (permalink / raw)
  To: Larry.Finger, florian.c.schilhabel, gregkh, linux-kernel, linux-staging
  Cc: outreachy

Rename local variable tmpVal to pct_val in function process_link_qual
to give intuitive meaning to variable and match the common kernel
coding style.

Signed-off-by: Ayush Tiwari <ayushtiw0110@gmail.com>
---
Changes in v3: changed variable name avg_val to pct_val
Changes in v3: changed variable name tmpVal to avg_val
Changes in v2: added a period in message

 drivers/staging/rtl8712/rtl8712_recv.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/rtl8712/rtl8712_recv.c b/drivers/staging/rtl8712/rtl8712_recv.c
index 1fabc5137a4c..0b13d0a04304 100644
--- a/drivers/staging/rtl8712/rtl8712_recv.c
+++ b/drivers/staging/rtl8712/rtl8712_recv.c
@@ -861,7 +861,7 @@ static void query_rx_phy_status(struct _adapter *padapter,
 static void process_link_qual(struct _adapter *padapter,
 			      union recv_frame *prframe)
 {
-	u32	last_evm = 0, avg_val;
+	u32	last_evm = 0, pct_val;
 	struct rx_pkt_attrib *pattrib;
 	struct smooth_rssi_data *sqd = &padapter->recvpriv.signal_qual_data;
 
@@ -883,8 +883,8 @@ static void process_link_qual(struct _adapter *padapter,
 			sqd->index = 0;
 
 		/* <1> Showed on UI for user, in percentage. */
-		avg_val = sqd->total_val / sqd->total_num;
-		padapter->recvpriv.signal = (u8)avg_val;
+		pct_val = sqd->total_val / sqd->total_num;
+		padapter->recvpriv.signal = (u8)pct_val;
 	}
 }
 
-- 
2.40.1


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

* Re: [PATCH v4] staging: rtl8712: rename tmpVal to pct_val
  2024-03-13  8:10 [PATCH v4] staging: rtl8712: rename tmpVal to pct_val Ayush Tiwari
@ 2024-03-13  8:18 ` Julia Lawall
  2024-03-13  8:36   ` Dan Carpenter
  0 siblings, 1 reply; 3+ messages in thread
From: Julia Lawall @ 2024-03-13  8:18 UTC (permalink / raw)
  To: Ayush Tiwari
  Cc: Larry.Finger, florian.c.schilhabel, gregkh, linux-kernel,
	linux-staging, outreachy



On Wed, 13 Mar 2024, Ayush Tiwari wrote:

> Rename local variable tmpVal to pct_val in function process_link_qual
> to give intuitive meaning to variable and match the common kernel
> coding style.

I don't think that the patch with the name avg_val was accepted, so this
patch has to replace tmpVal by pct_val, as you say in the subject line.

Also, the comment says:

/* <1> Showed on UI for user, in percentage. */

I still have the impression that the value calculated here is an average.
Total num is just incremented:

if (sqd->total_num++ >= PHY_LINKQUALITY_SLID_WIN_MAX)

while total_val is updated with a new value.

julia


>
> Signed-off-by: Ayush Tiwari <ayushtiw0110@gmail.com>
> ---
> Changes in v3: changed variable name avg_val to pct_val
> Changes in v3: changed variable name tmpVal to avg_val
> Changes in v2: added a period in message
>
>  drivers/staging/rtl8712/rtl8712_recv.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/staging/rtl8712/rtl8712_recv.c b/drivers/staging/rtl8712/rtl8712_recv.c
> index 1fabc5137a4c..0b13d0a04304 100644
> --- a/drivers/staging/rtl8712/rtl8712_recv.c
> +++ b/drivers/staging/rtl8712/rtl8712_recv.c
> @@ -861,7 +861,7 @@ static void query_rx_phy_status(struct _adapter *padapter,
>  static void process_link_qual(struct _adapter *padapter,
>  			      union recv_frame *prframe)
>  {
> -	u32	last_evm = 0, avg_val;
> +	u32	last_evm = 0, pct_val;
>  	struct rx_pkt_attrib *pattrib;
>  	struct smooth_rssi_data *sqd = &padapter->recvpriv.signal_qual_data;
>
> @@ -883,8 +883,8 @@ static void process_link_qual(struct _adapter *padapter,
>  			sqd->index = 0;
>
>  		/* <1> Showed on UI for user, in percentage. */
> -		avg_val = sqd->total_val / sqd->total_num;
> -		padapter->recvpriv.signal = (u8)avg_val;
> +		pct_val = sqd->total_val / sqd->total_num;
> +		padapter->recvpriv.signal = (u8)pct_val;
>  	}
>  }
>
> --
> 2.40.1
>
>
>

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

* Re: [PATCH v4] staging: rtl8712: rename tmpVal to pct_val
  2024-03-13  8:18 ` Julia Lawall
@ 2024-03-13  8:36   ` Dan Carpenter
  0 siblings, 0 replies; 3+ messages in thread
From: Dan Carpenter @ 2024-03-13  8:36 UTC (permalink / raw)
  To: Julia Lawall
  Cc: Ayush Tiwari, Larry.Finger, florian.c.schilhabel, gregkh,
	linux-kernel, linux-staging, outreachy

On Wed, Mar 13, 2024 at 09:18:08AM +0100, Julia Lawall wrote:
> 
> 
> On Wed, 13 Mar 2024, Ayush Tiwari wrote:
> 
> > Rename local variable tmpVal to pct_val in function process_link_qual
> > to give intuitive meaning to variable and match the common kernel
> > coding style.
> 
> I don't think that the patch with the name avg_val was accepted, so this
> patch has to replace tmpVal by pct_val, as you say in the subject line.
> 
> Also, the comment says:
> 
> /* <1> Showed on UI for user, in percentage. */
> 
> I still have the impression that the value calculated here is an average.
> Total num is just incremented:
> 
> if (sqd->total_num++ >= PHY_LINKQUALITY_SLID_WIN_MAX)
> 
> while total_val is updated with a new value.

Oh, yeah.  My bad.  I misunderstood the comment.  The original value is
in percent.  prframe->u.hdr.attrib.signal_qual.  It's set in
query_rx_phy_status().

Sorry about that.

regards,
dan carpenter


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

end of thread, other threads:[~2024-03-13  8:36 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-03-13  8:10 [PATCH v4] staging: rtl8712: rename tmpVal to pct_val Ayush Tiwari
2024-03-13  8:18 ` Julia Lawall
2024-03-13  8:36   ` Dan Carpenter

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