[PATCH 4/4] staging: rtl8712: Simplify the usage of an expression in process_link_qual()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Date: Thu, 20 Apr 2023 11:44:01 +0200

An expression was used at three source code places.
Thus use its value by a corresponding variable.

Signed-off-by: Markus Elfring <elfring@xxxxxxxxxxxxxxxxxxxxx>
---
 drivers/staging/rtl8712/rtl8712_recv.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/rtl8712/rtl8712_recv.c b/drivers/staging/rtl8712/rtl8712_recv.c
index 9135c92906ac..3d0c48918510 100644
--- a/drivers/staging/rtl8712/rtl8712_recv.c
+++ b/drivers/staging/rtl8712/rtl8712_recv.c
@@ -862,10 +862,9 @@ static void query_rx_phy_status(struct _adapter *padapter,
 static void process_link_qual(struct _adapter *padapter,
 			      union recv_frame *prframe)
 {
-	struct rx_pkt_attrib *pattrib;
+	u8 signal_qual = prframe->u.hdr.attrib.signal_qual;

-	pattrib = &prframe->u.hdr.attrib;
-	if (pattrib->signal_qual != 0) {
+	if (signal_qual) {
 		struct smooth_rssi_data *sqd = &padapter->recvpriv.signal_qual_data;

 		/*
@@ -875,8 +874,10 @@ static void process_link_qual(struct _adapter *padapter,
 			sqd->total_num = PHY_LINKQUALITY_SLID_WIN_MAX;
 			sqd->total_val -= sqd->elements[sqd->index];
 		}
-		sqd->total_val += pattrib->signal_qual;
-		sqd->elements[sqd->index++] = pattrib->signal_qual;
+
+		sqd->total_val += signal_qual;
+		sqd->elements[sqd->index++] = signal_qual;
+
 		if (sqd->index >= PHY_LINKQUALITY_SLID_WIN_MAX)
 			sqd->index = 0;

--
2.40.0






[Index of Archives]     [Linux Driver Development]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux