Commit 84fcb4b3 authored by Ben Hutchings's avatar Ben Hutchings Committed by Greg Kroah-Hartman

Staging: rtl8192e: Remove built-in firmware images

The driver can already use request_firmware() to load firmware, and
always does so.  There is code in init_firmware() to use the static
firmware images, but it's unreachable!  Remove the data and simplify
init_firmware() accordingly.
Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 430fb250
...@@ -5,4 +5,5 @@ config RTL8192E ...@@ -5,4 +5,5 @@ config RTL8192E
select WIRELESS_EXT select WIRELESS_EXT
select WEXT_PRIV select WEXT_PRIV
select CRYPTO select CRYPTO
select FW_LOADER
---help--- ---help---
...@@ -228,13 +228,6 @@ bool init_firmware(struct net_device *dev) ...@@ -228,13 +228,6 @@ bool init_firmware(struct net_device *dev)
struct r8192_priv *priv = rtllib_priv(dev); struct r8192_priv *priv = rtllib_priv(dev);
bool rt_status = true; bool rt_status = true;
u8 *firmware_img_buf[3] = { &Rtl8192PciEFwBootArray[0],
&Rtl8192PciEFwMainArray[0],
&Rtl8192PciEFwDataArray[0]};
u32 firmware_img_len[3] = { sizeof(Rtl8192PciEFwBootArray),
sizeof(Rtl8192PciEFwMainArray),
sizeof(Rtl8192PciEFwDataArray)};
u32 file_length = 0; u32 file_length = 0;
u8 *mapped_file = NULL; u8 *mapped_file = NULL;
u8 init_step = 0; u8 init_step = 0;
...@@ -257,77 +250,55 @@ bool init_firmware(struct net_device *dev) ...@@ -257,77 +250,55 @@ bool init_firmware(struct net_device *dev)
" firmware state\n"); " firmware state\n");
} }
priv->firmware_source = FW_SOURCE_IMG_FILE;
for (init_step = starting_state; init_step <= FW_INIT_STEP2_DATA; for (init_step = starting_state; init_step <= FW_INIT_STEP2_DATA;
init_step++) { init_step++) {
if (rst_opt == OPT_SYSTEM_RESET) { if (rst_opt == OPT_SYSTEM_RESET) {
switch (priv->firmware_source) { if (pfirmware->firmware_buf_size[init_step] == 0) {
case FW_SOURCE_IMG_FILE: const char *fw_name[3] = {
{ RTL8192E_BOOT_IMG_FW,
if (pfirmware->firmware_buf_size[init_step] == 0) { RTL8192E_MAIN_IMG_FW,
const char *fw_name[3] = { RTL8192E_DATA_IMG_FW
RTL8192E_BOOT_IMG_FW, };
RTL8192E_MAIN_IMG_FW, const struct firmware *fw_entry;
RTL8192E_DATA_IMG_FW int rc;
}; rc = request_firmware(&fw_entry,
const struct firmware *fw_entry; fw_name[init_step],
int rc; &priv->pdev->dev);
rc = request_firmware(&fw_entry, if (rc < 0) {
fw_name[init_step], &priv->pdev->dev); RT_TRACE(COMP_FIRMWARE, "request firmware fail!\n");
if (rc < 0) { goto download_firmware_fail;
RT_TRACE(COMP_FIRMWARE, "request firm" }
"ware fail!\n"); if (fw_entry->size >
goto download_firmware_fail;
}
if (fw_entry->size >
sizeof(pfirmware->firmware_buf[init_step])) { sizeof(pfirmware->firmware_buf[init_step])) {
RT_TRACE(COMP_FIRMWARE, "img file size " RT_TRACE(COMP_FIRMWARE, "img file size "
"exceed the container struct " "exceed the container struct "
"buffer fail!\n"); "buffer fail!\n");
goto download_firmware_fail; goto download_firmware_fail;
} }
if (init_step != FW_INIT_STEP1_MAIN) { if (init_step != FW_INIT_STEP1_MAIN) {
memcpy(pfirmware->firmware_buf[init_step], memcpy(pfirmware->firmware_buf[init_step],
fw_entry->data, fw_entry->size); fw_entry->data, fw_entry->size);
pfirmware->firmware_buf_size[init_step] = pfirmware->firmware_buf_size[init_step] =
fw_entry->size; fw_entry->size;
} else { } else {
memset(pfirmware->firmware_buf[init_step], memset(pfirmware->firmware_buf[init_step],
0, 128); 0, 128);
memcpy(&pfirmware->firmware_buf[init_step][128], memcpy(&pfirmware->firmware_buf[init_step][128],
fw_entry->data, fw_entry->size); fw_entry->data, fw_entry->size);
pfirmware->firmware_buf_size[init_step] = pfirmware->firmware_buf_size[init_step] =
fw_entry->size + 128; fw_entry->size + 128;
}
if (rst_opt == OPT_SYSTEM_RESET)
release_firmware(fw_entry);
} }
mapped_file = pfirmware->firmware_buf[init_step];
file_length = pfirmware->firmware_buf_size[init_step];
break;
}
case FW_SOURCE_HEADER_FILE:
mapped_file = firmware_img_buf[init_step];
file_length = firmware_img_len[init_step];
if (init_step == FW_INIT_STEP2_DATA) {
memcpy(pfirmware->firmware_buf[init_step], mapped_file, file_length);
pfirmware->firmware_buf_size[init_step] = file_length;
}
break;
default: if (rst_opt == OPT_SYSTEM_RESET)
break; release_firmware(fw_entry);
} }
} else if (rst_opt == OPT_FIRMWARE_RESET) {
mapped_file = pfirmware->firmware_buf[init_step];
file_length = pfirmware->firmware_buf_size[init_step];
} }
mapped_file = pfirmware->firmware_buf[init_step];
file_length = pfirmware->firmware_buf_size[init_step];
rt_status = fw_download_code(dev, mapped_file, file_length); rt_status = fw_download_code(dev, mapped_file, file_length);
if (!rt_status) { if (!rt_status) {
goto download_firmware_fail; goto download_firmware_fail;
......
...@@ -43,11 +43,6 @@ enum desc_packet_type { ...@@ -43,11 +43,6 @@ enum desc_packet_type {
DESC_PACKET_TYPE_NORMAL = 1, DESC_PACKET_TYPE_NORMAL = 1,
}; };
enum firmware_source {
FW_SOURCE_IMG_FILE = 0,
FW_SOURCE_HEADER_FILE = 1,
};
enum firmware_status { enum firmware_status {
FW_STATUS_0_INIT = 0, FW_STATUS_0_INIT = 0,
FW_STATUS_1_MOVE_BOOT_CODE = 1, FW_STATUS_1_MOVE_BOOT_CODE = 1,
......
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -582,7 +582,6 @@ struct r8192_priv { ...@@ -582,7 +582,6 @@ struct r8192_priv {
struct rt_firmware *pFirmware; struct rt_firmware *pFirmware;
enum rtl819x_loopback LoopbackMode; enum rtl819x_loopback LoopbackMode;
enum firmware_source firmware_source;
struct timer_list watch_dog_timer; struct timer_list watch_dog_timer;
struct timer_list fsync_timer; struct timer_list fsync_timer;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment