From 3e04209f341052b4a885d20dd1c81f409bcf82b6 Mon Sep 17 00:00:00 2001 From: Martin Kaiser Date: Sun, 25 Jul 2021 17:58:48 +0200 Subject: [PATCH] staging: rtl8188eu: simplify Hal_EfuseParseMACAddr_8188EU 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 Link: https://lore.kernel.org/r/20210725155902.32433-4-martin@kaiser.cx Signed-off-by: Greg Kroah-Hartman --- 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 bc5dcef..61b9f39 100644 --- a/drivers/staging/rtl8188eu/hal/usb_halinit.c +++ b/drivers/staging/rtl8188eu/hal/usb_halinit.c @@ -950,19 +950,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) @@ -972,7 +969,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.7.4