2015-11-08 06:59:24

by Ivan Safonov

[permalink] [raw]
Subject: [PATCH 04/13] staging: rtl8188eu: remove unused hal_data_8188e members

u8 *pfirmware and u32 fwsize of hal_data_8188e structure not used.

The pfwdata variable used to store a pointer to the buffer
and the pfwbody variable points to the firmware body (firmware without
header).

Signed-off-by: Ivan Safonov <[email protected]>
---
drivers/staging/rtl8188eu/hal/fw.c | 16 ++++++++--------
drivers/staging/rtl8188eu/include/rtl8188e_hal.h | 2 --
drivers/staging/rtl8188eu/os_dep/os_intfs.c | 4 ----
3 files changed, 8 insertions(+), 14 deletions(-)

diff --git a/drivers/staging/rtl8188eu/hal/fw.c b/drivers/staging/rtl8188eu/hal/fw.c
index 3e354eb..1d8930a 100644
--- a/drivers/staging/rtl8188eu/hal/fw.c
+++ b/drivers/staging/rtl8188eu/hal/fw.c
@@ -170,13 +170,12 @@ exit:

int rtl88eu_download_fw(struct adapter *adapt)
{
- struct hal_data_8188e *rtlhal = GET_HAL_DATA(adapt);
struct dvobj_priv *dvobj = adapter_to_dvobj(adapt);
struct device *device = dvobj_to_dev(dvobj);
const struct firmware *fw;
const char fw_name[] = "rtlwifi/rtl8188eufw.bin";
struct rtl92c_firmware_header *pfwheader = NULL;
- u8 *pfwdata;
+ u8 *pfwdata, *pfwbody;
u32 fwsize;

if (request_firmware(&fw, fw_name, device)) {
@@ -194,17 +193,17 @@ int rtl88eu_download_fw(struct adapter *adapt)
if (!pfwdata)
return -ENOMEM;

- rtlhal->pfirmware = pfwdata;
- memcpy(rtlhal->pfirmware, fw->data, fw->size);
- rtlhal->fwsize = fw->size;
+ memcpy(pfwdata, fw->data, fw->size);
+ fwsize = fw->size;
release_firmware(fw);

- fwsize = rtlhal->fwsize;
pfwheader = (struct rtl92c_firmware_header *)pfwdata;

if (IS_FW_HEADER_EXIST(pfwheader)) {
- pfwdata = pfwdata + 32;
+ pfwbody = pfwdata + 32;
fwsize = fwsize - 32;
+ } else {
+ pfwbody = pfwdata;
}

if (usb_read8(adapt, REG_MCUFWDL) & RAM_DL_SEL) {
@@ -213,8 +212,9 @@ int rtl88eu_download_fw(struct adapter *adapt)
}
_rtl88e_enable_fw_download(adapt, true);
usb_write8(adapt, REG_MCUFWDL, usb_read8(adapt, REG_MCUFWDL) | FWDL_ChkSum_rpt);
- _rtl88e_write_fw(adapt, pfwdata, fwsize);
+ _rtl88e_write_fw(adapt, pfwbody, fwsize);
_rtl88e_enable_fw_download(adapt, false);

+ kfree(pfwdata);
return _rtl88e_fw_free_to_go(adapt);
}
diff --git a/drivers/staging/rtl8188eu/include/rtl8188e_hal.h b/drivers/staging/rtl8188eu/include/rtl8188e_hal.h
index cbad364..9f5050e 100644
--- a/drivers/staging/rtl8188eu/include/rtl8188e_hal.h
+++ b/drivers/staging/rtl8188eu/include/rtl8188e_hal.h
@@ -191,8 +191,6 @@ struct txpowerinfo24g {
struct hal_data_8188e {
struct HAL_VERSION VersionID;
u16 CustomerID;
- u8 *pfirmware;
- u32 fwsize;
u16 FirmwareVersion;
u16 FirmwareVersionRev;
u16 FirmwareSubVersion;
diff --git a/drivers/staging/rtl8188eu/os_dep/os_intfs.c b/drivers/staging/rtl8188eu/os_dep/os_intfs.c
index 9201b94..2cca5d2 100644
--- a/drivers/staging/rtl8188eu/os_dep/os_intfs.c
+++ b/drivers/staging/rtl8188eu/os_dep/os_intfs.c
@@ -1157,7 +1157,6 @@ int pm_netdev_open(struct net_device *pnetdev, u8 bnormal)
static int netdev_close(struct net_device *pnetdev)
{
struct adapter *padapter = (struct adapter *)rtw_netdev_priv(pnetdev);
- struct hal_data_8188e *rtlhal = GET_HAL_DATA(padapter);

RT_TRACE(_module_os_intfs_c_, _drv_info_, ("+88eu_drv - drv_close\n"));

@@ -1190,9 +1189,6 @@ static int netdev_close(struct net_device *pnetdev)
rtw_led_control(padapter, LED_CTL_POWER_OFF);
}

- kfree(rtlhal->pfirmware);
- rtlhal->pfirmware = NULL;
-
RT_TRACE(_module_os_intfs_c_, _drv_info_, ("-88eu_drv - drv_close\n"));
DBG_88E("-88eu_drv - drv_close, bup =%d\n", padapter->bup);
return 0;
--
2.4.10