linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Martin Kaiser <martin@kaiser.cx>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: linux-staging@lists.linux.dev, kernel-janitors@vger.kernel.org,
	linux-kernel@vger.kernel.org, Martin Kaiser <martin@kaiser.cx>
Subject: [PATCH 04/18] staging: rtl8188eu: simplify Hal_EfuseParseMACAddr_8188EU
Date: Sun, 25 Jul 2021 17:58:48 +0200	[thread overview]
Message-ID: <20210725155902.32433-4-martin@kaiser.cx> (raw)
In-Reply-To: <20210725155902.32433-1-martin@kaiser.cx>

The hwinfo and AutoLoadFail parameters can be obtained from
struct adapter, there's no need to pass them as separate
function parameters.

Use memcpy instead of bytewise copy if we have to fall back to the
hard-coded mac address.

Signed-off-by: Martin Kaiser <martin@kaiser.cx>
---
 drivers/staging/rtl8188eu/hal/usb_halinit.c | 17 +++++++----------
 1 file changed, 7 insertions(+), 10 deletions(-)

diff --git a/drivers/staging/rtl8188eu/hal/usb_halinit.c b/drivers/staging/rtl8188eu/hal/usb_halinit.c
index 79e86ed8798e..6af411e0c28e 100644
--- a/drivers/staging/rtl8188eu/hal/usb_halinit.c
+++ b/drivers/staging/rtl8188eu/hal/usb_halinit.c
@@ -952,19 +952,16 @@ static void Hal_EfuseParsePIDVID_8188EU(struct adapter *adapt, u8 *hwinfo, bool
 	}
 }
 
-static void Hal_EfuseParseMACAddr_8188EU(struct adapter *adapt, u8 *hwinfo, bool AutoLoadFail)
+static void Hal_EfuseParseMACAddr_8188EU(struct adapter *adapt)
 {
-	u16 i;
-	u8 sMacAddr[6] = {0x00, 0xE0, 0x4C, 0x81, 0x88, 0x02};
+	u8 sMacAddr[] = {0x00, 0xE0, 0x4C, 0x81, 0x88, 0x02};
 	struct eeprom_priv *eeprom = GET_EEPROM_EFUSE_PRIV(adapt);
+	u8 *hwinfo = eeprom->efuse_eeprom_data;
 
-	if (AutoLoadFail) {
-		for (i = 0; i < 6; i++)
-			eeprom->mac_addr[i] = sMacAddr[i];
-	} else {
-		/* Read Permanent MAC address */
+	if (eeprom->bautoload_fail_flag)
+		memcpy(eeprom->mac_addr, sMacAddr, sizeof(sMacAddr));
+	else
 		memcpy(eeprom->mac_addr, &hwinfo[EEPROM_MAC_ADDR_88EU], ETH_ALEN);
-	}
 }
 
 static void readAdapterInfo_8188EU(struct adapter *adapt)
@@ -974,7 +971,7 @@ static void readAdapterInfo_8188EU(struct adapter *adapt)
 	/* parse the eeprom/efuse content */
 	Hal_EfuseParseIDCode88E(adapt, eeprom->efuse_eeprom_data);
 	Hal_EfuseParsePIDVID_8188EU(adapt, eeprom->efuse_eeprom_data, eeprom->bautoload_fail_flag);
-	Hal_EfuseParseMACAddr_8188EU(adapt, eeprom->efuse_eeprom_data, eeprom->bautoload_fail_flag);
+	Hal_EfuseParseMACAddr_8188EU(adapt);
 
 	Hal_ReadPowerSavingMode88E(adapt, eeprom->efuse_eeprom_data, eeprom->bautoload_fail_flag);
 	Hal_ReadTxPowerInfo88E(adapt, eeprom->efuse_eeprom_data, eeprom->bautoload_fail_flag);
-- 
2.20.1


  parent reply	other threads:[~2021-07-25 16:00 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-25 15:58 [PATCH 01/18] staging: rtl8188eu: remove unused defines Martin Kaiser
2021-07-25 15:58 ` [PATCH 02/18] staging: rtl8188eu: remove HW_VAR_MEDIA_STATUS1 Martin Kaiser
2021-07-25 15:58 ` [PATCH 03/18] staging: rtl8188eu: remove HW_VAR_TXPAUSE Martin Kaiser
2021-07-25 15:58 ` Martin Kaiser [this message]
2021-07-25 15:58 ` [PATCH 05/18] staging: rtl8188eu: remove an unused enum Martin Kaiser
2021-07-25 15:58 ` [PATCH 06/18] staging: rtl8188eu: remove another " Martin Kaiser
2021-07-25 15:58 ` [PATCH 07/18] staging: rtl8188eu: remove a bunch of unused defines Martin Kaiser
2021-07-25 15:58 ` [PATCH 08/18] staging: rtl8188eu: remove yet another unused enum Martin Kaiser
2021-07-25 15:58 ` [PATCH 09/18] staging: rtl8188eu: remove unused _HAL_INTF_C_ define Martin Kaiser
2021-07-25 16:32   ` Christophe JAILLET
2021-07-25 16:38     ` Greg Kroah-Hartman
2021-07-25 16:45       ` Christophe JAILLET
2021-07-25 15:58 ` [PATCH 10/18] staging: rtl8188eu: remove write-only power struct component Martin Kaiser
2021-07-25 15:58 ` [PATCH 11/18] staging: rtl8188eu: remove two write-only hal components Martin Kaiser
2021-07-25 15:58 ` [PATCH 12/18] staging: rtl8188eu: remove unused IntrMask Martin Kaiser
2021-07-25 15:58 ` [PATCH 13/18] staging: rtl8188eu: remove write-only HwRxPageSize Martin Kaiser
2021-07-25 15:58 ` [PATCH 14/18] staging: rtl8188eu: simplify rtl88eu_phy_iq_calibrate Martin Kaiser
2021-07-25 18:47   ` kernel test robot
2021-07-25 21:03   ` kernel test robot
2021-07-26 19:53   ` [PATCH v2 " Martin Kaiser
2021-07-25 15:58 ` [PATCH 15/18] staging: rtl8188eu: simplify phy_iq_calibrate Martin Kaiser
2021-07-25 15:59 ` [PATCH 16/18] staging: rtl8188eu: simplify path_adda_on Martin Kaiser
2021-07-25 15:59 ` [PATCH 17/18] staging: rtl8188eu: simplify phy_lc_calibrate Martin Kaiser
2021-07-25 15:59 ` [PATCH 18/18] staging: rtl8188eu: remove unused IQKMatrixRegSetting array Martin Kaiser

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=20210725155902.32433-4-martin@kaiser.cx \
    --to=martin@kaiser.cx \
    --cc=gregkh@linuxfoundation.org \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-staging@lists.linux.dev \
    --subject='Re: [PATCH 04/18] staging: rtl8188eu: simplify Hal_EfuseParseMACAddr_8188EU' \
    /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

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