]> git.karo-electronics.de Git - linux-beck.git/commitdiff
staging: rtl8192e: Add rt_fw_blob
authorMateusz Kulikowski <mateusz.kulikowski@gmail.com>
Mon, 19 Oct 2015 20:00:22 +0000 (22:00 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 25 Oct 2015 02:23:13 +0000 (19:23 -0700)
rt_fw_blob contains single firmware blob and its size.
Update firmware loading code accordingly.

Signed-off-by: Mateusz Kulikowski <mateusz.kulikowski@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/rtl8192e/rtl8192e/r8192E_firmware.c
drivers/staging/rtl8192e/rtl8192e/r8192E_firmware.h

index f88e112847a13b72ba8b8bbb12401912fe11870b..eb1f1bb46ca21bfbc5cb09b58a7b98de655648f7 100644 (file)
@@ -233,7 +233,7 @@ bool rtl92e_init_fw(struct net_device *dev)
 
        for (i = starting_state; i <= FW_INIT_STEP2_DATA; i++) {
                if (rst_opt == OPT_SYSTEM_RESET) {
-                       if (pfirmware->firmware_buf_size[i] == 0) {
+                       if (pfirmware->blobs[i].size == 0) {
                                const char *fw_name[3] = {
                                        RTL8192E_BOOT_IMG_FW,
                                        RTL8192E_MAIN_IMG_FW,
@@ -250,8 +250,7 @@ bool rtl92e_init_fw(struct net_device *dev)
                                                 "request firmware fail!\n");
                                        goto download_firmware_fail;
                                }
-                               if (fw_entry->size >
-                                   sizeof(pfirmware->firmware_buf[i])) {
+                               if (fw_entry->size > MAX_FW_SIZE) {
                                        RT_TRACE(COMP_FIRMWARE,
                                                 "img file size exceed the container struct buffer fail!\n");
                                        release_firmware(fw_entry);
@@ -259,17 +258,17 @@ bool rtl92e_init_fw(struct net_device *dev)
                                }
 
                                if (i != FW_INIT_STEP1_MAIN) {
-                                       memcpy(pfirmware->firmware_buf[i],
+                                       memcpy(pfirmware->blobs[i].data,
                                               fw_entry->data, fw_entry->size);
-                                       pfirmware->firmware_buf_size[i] =
+                                       pfirmware->blobs[i].size =
                                                fw_entry->size;
 
                                } else {
-                                       memset(pfirmware->firmware_buf[i],
+                                       memset(pfirmware->blobs[i].data,
                                               0, 128);
-                                       memcpy(&pfirmware->firmware_buf[i][128],
+                                       memcpy(&pfirmware->blobs[i].data[128],
                                               fw_entry->data, fw_entry->size);
-                                       pfirmware->firmware_buf_size[i] =
+                                       pfirmware->blobs[i].size =
                                                fw_entry->size + 128;
                                }
 
@@ -278,8 +277,8 @@ bool rtl92e_init_fw(struct net_device *dev)
                        }
                }
 
-               mapped_file = pfirmware->firmware_buf[i];
-               file_length = pfirmware->firmware_buf_size[i];
+               mapped_file = pfirmware->blobs[i].data;
+               file_length = pfirmware->blobs[i].size;
 
                rt_status = _rtl92e_fw_download_code(dev, mapped_file,
                                                     file_length);
index 186c65d6f6d32a11e2efb1fa4aaede1a7c3e0287..4dde93eda4de5fdae24b11e4a1a044c431f6c8f0 100644 (file)
@@ -44,12 +44,16 @@ enum firmware_status {
        FW_STATUS_5_READY = 5,
 };
 
+#define MAX_FW_SIZE 64000
+struct rt_fw_blob {
+       u16 size;
+       u8 data[MAX_FW_SIZE];
+};
+
+#define FW_BLOBS 3
 struct rt_firmware {
        enum firmware_status firmware_status;
-#define RTL8190_MAX_FIRMWARE_CODE_SIZE 64000
-#define MAX_FW_INIT_STEP               3
-       u8 firmware_buf[MAX_FW_INIT_STEP][RTL8190_MAX_FIRMWARE_CODE_SIZE];
-       u16               firmware_buf_size[MAX_FW_INIT_STEP];
+       struct rt_fw_blob blobs[FW_BLOBS];
 };
 
 bool rtl92e_init_fw(struct net_device *dev);