aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/rt2x00/rt2x00firmware.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/wireless/rt2x00/rt2x00firmware.c')
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00firmware.c34
1 files changed, 1 insertions, 33 deletions
diff --git a/drivers/net/wireless/rt2x00/rt2x00firmware.c b/drivers/net/wireless/rt2x00/rt2x00firmware.c
index 4f9fe56f4f2e..b971bc6e7ee2 100644
--- a/drivers/net/wireless/rt2x00/rt2x00firmware.c
+++ b/drivers/net/wireless/rt2x00/rt2x00firmware.c
@@ -23,8 +23,6 @@
23 Abstract: rt2x00 firmware loading routines. 23 Abstract: rt2x00 firmware loading routines.
24 */ 24 */
25 25
26#include <linux/crc-ccitt.h>
27#include <linux/crc-itu-t.h>
28#include <linux/kernel.h> 26#include <linux/kernel.h>
29#include <linux/module.h> 27#include <linux/module.h>
30 28
@@ -63,36 +61,7 @@ static int rt2x00lib_request_firmware(struct rt2x00_dev *rt2x00dev)
63 return -ENOENT; 61 return -ENOENT;
64 } 62 }
65 63
66 /* 64 crc = rt2x00dev->ops->lib->get_firmware_crc(fw->data, fw->size);
67 * Perform crc validation on the firmware.
68 * The last 2 bytes in the firmware array are the crc checksum itself,
69 * this means that we should never pass those 2 bytes to the crc
70 * algorithm.
71 */
72 if (test_bit(DRIVER_REQUIRE_FIRMWARE_CRC_ITU_T, &rt2x00dev->flags)) {
73 /*
74 * Use the crc itu-t algorithm.
75 * Use 0 for the last 2 bytes to complete the checksum.
76 */
77 crc = crc_itu_t(0, fw->data, fw->size - 2);
78 crc = crc_itu_t_byte(crc, 0);
79 crc = crc_itu_t_byte(crc, 0);
80 } else if (test_bit(DRIVER_REQUIRE_FIRMWARE_CCITT, &rt2x00dev->flags)) {
81 /*
82 * Use the crc ccitt algorithm.
83 * This will return the same value as the legacy driver which
84 * used bit ordering reversion on the both the firmware bytes
85 * before input input as well as on the final output.
86 * Obviously using crc ccitt directly is much more efficient.
87 */
88 crc = crc_ccitt(~0, fw->data, fw->size - 2);
89 } else {
90 ERROR(rt2x00dev, "No checksum algorithm selected "
91 "for firmware validation.\n");
92 retval = -ENOENT;
93 goto exit;
94 }
95
96 if (crc != (fw->data[fw->size - 2] << 8 | fw->data[fw->size - 1])) { 65 if (crc != (fw->data[fw->size - 2] << 8 | fw->data[fw->size - 1])) {
97 ERROR(rt2x00dev, "Firmware checksum error.\n"); 66 ERROR(rt2x00dev, "Firmware checksum error.\n");
98 retval = -ENOENT; 67 retval = -ENOENT;
@@ -139,4 +108,3 @@ void rt2x00lib_free_firmware(struct rt2x00_dev *rt2x00dev)
139 release_firmware(rt2x00dev->fw); 108 release_firmware(rt2x00dev->fw);
140 rt2x00dev->fw = NULL; 109 rt2x00dev->fw = NULL;
141} 110}
142