linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Philipp Hortmann <philipp.g.hortmann@gmail.com>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org
Subject: [PATCH 1/6] staging: rtl8192e: Combine three loops to one to init tx_pwr_level_...
Date: Fri, 20 Jan 2023 21:17:50 +0100	[thread overview]
Message-ID: <c268ccf158997c65756b7b092ae79cc2b69bd47f.1674244819.git.philipp.g.hortmann@gmail.com> (raw)
In-Reply-To: <cover.1674244819.git.philipp.g.hortmann@gmail.com>

The arrays EEPROMRfACCKChnl1TxPwLevel, EEPROMRfAOfdmChnlTxPwLevel,
EEPROMRfCCCKChnl1TxPwLevel, EEPROMRfCOfdmChnlTxPwLevel are initialized to
zero and never changed. The three loops contain the same code. Only the
index of the upper named arrays go from 0 to 2. Therefore the three loops
can be combined to one loop from 0 to 13 which removes useless code.

Signed-off-by: Philipp Hortmann <philipp.g.hortmann@gmail.com>
---
 .../staging/rtl8192e/rtl8192e/r8192E_dev.c    | 22 +------------------
 1 file changed, 1 insertion(+), 21 deletions(-)

diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c
index 227c13d552fc..7187ee4c75f6 100644
--- a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c
+++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c
@@ -426,7 +426,7 @@ static void _rtl92e_read_eeprom_info(struct net_device *dev)
 						     0xf0) >> 4;
 		} else if (priv->epromtype == EEPROM_93C56) {
 
-			for (i = 0; i < 3; i++) {
+			for (i = 0; i < 14; i++) {
 				priv->tx_pwr_level_cck_a[i] =
 					 priv->EEPROMRfACCKChnl1TxPwLevel[0];
 				priv->tx_pwr_level_ofdm_24g_a[i] =
@@ -436,26 +436,6 @@ static void _rtl92e_read_eeprom_info(struct net_device *dev)
 				priv->tx_pwr_level_ofdm_24g_c[i] =
 					 priv->EEPROMRfCOfdmChnlTxPwLevel[0];
 			}
-			for (i = 3; i < 9; i++) {
-				priv->tx_pwr_level_cck_a[i]  =
-					 priv->EEPROMRfACCKChnl1TxPwLevel[1];
-				priv->tx_pwr_level_ofdm_24g_a[i] =
-					 priv->EEPROMRfAOfdmChnlTxPwLevel[1];
-				priv->tx_pwr_level_cck_c[i] =
-					 priv->EEPROMRfCCCKChnl1TxPwLevel[1];
-				priv->tx_pwr_level_ofdm_24g_c[i] =
-					 priv->EEPROMRfCOfdmChnlTxPwLevel[1];
-			}
-			for (i = 9; i < 14; i++) {
-				priv->tx_pwr_level_cck_a[i]  =
-					 priv->EEPROMRfACCKChnl1TxPwLevel[2];
-				priv->tx_pwr_level_ofdm_24g_a[i] =
-					 priv->EEPROMRfAOfdmChnlTxPwLevel[2];
-				priv->tx_pwr_level_cck_c[i] =
-					 priv->EEPROMRfCCCKChnl1TxPwLevel[2];
-				priv->tx_pwr_level_ofdm_24g_c[i] =
-					 priv->EEPROMRfCOfdmChnlTxPwLevel[2];
-			}
 			priv->legacy_ht_tx_pwr_diff =
 				 priv->eeprom_legacy_ht_tx_pwr_diff;
 			priv->antenna_tx_pwr_diff[0] = 0;
-- 
2.39.0


  reply	other threads:[~2023-01-20 20:17 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-20 20:17 [PATCH 0/6] Remove several variables that are zero from struct r8192_priv Philipp Hortmann
2023-01-20 20:17 ` Philipp Hortmann [this message]
2023-01-20 20:18 ` [PATCH 2/6] staging: rtl8192e: Init tx_pwr_level_cck_a and friends directly Philipp Hortmann
2023-01-20 20:18 ` [PATCH 3/6] staging: rtl8192e: Remove zeroed arrays tx_pwr_level_cck_a and friends Philipp Hortmann
2023-01-20 20:18 ` [PATCH 4/6] staging: rtl8192e: Remove ant_pwr_diff which is always zero Philipp Hortmann
2023-01-20 20:18 ` [PATCH 5/6] staging: rtl8192e: Remove u4RegValue " Philipp Hortmann
2023-01-20 20:18 ` [PATCH 6/6] staging: rtl8192e: Remove repeated set to zero of powerlevel and friend Philipp Hortmann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=c268ccf158997c65756b7b092ae79cc2b69bd47f.1674244819.git.philipp.g.hortmann@gmail.com \
    --to=philipp.g.hortmann@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-staging@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).