Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

staging: ks7010: remove custom firmware loader

FW_LOADER works fine, no need for a open coded fallback.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Wolfram Sang and committed by
Greg Kroah-Hartman
c3fe667f 021873f6

+1 -123
+1
drivers/staging/ks7010/Kconfig
··· 3 3 depends on MMC && WIRELESS 4 4 select WIRELESS_EXT 5 5 select WEXT_PRIV 6 + select FW_LOADER 6 7 help 7 8 This is a driver for KeyStream KS7010 based SDIO WIFI cards. It is 8 9 found on at least later Spectec SDW-821 (FCC-ID "S2Y-WLAN-11G-K" only,
-62
drivers/staging/ks7010/ks7010_config.c
··· 169 169 return rc; 170 170 } 171 171 172 - #ifndef NO_FIRMWARE_CLASS 173 172 #include <linux/firmware.h> 174 - #else 175 - #define MAX_CONFIG_FILE_SIZE (1024*10) 176 - #endif 177 173 int ks_wlan_read_config_file(ks_wlan_private *priv) 178 174 { 179 175 struct { ··· 202 206 {0,"",""}, 203 207 }; 204 208 205 - #ifndef NO_FIRMWARE_CLASS 206 209 const struct firmware *fw_entry; 207 210 struct device *dev = NULL; 208 211 int retval; 209 - #else 210 - struct file *srcf; 211 - int nr_read ; 212 - int retval; 213 - char *cfg_buf=NULL; 214 - int orgfsuid, orgfsgid; 215 - mm_segment_t orgfs; 216 - #endif 217 212 char cfg_file[]=CFG_FILE; 218 213 char *cur_p, *end_p; 219 214 char wk_buff[256], *wk_p; ··· 254 267 priv->reg.tx_rate = TX_RATE_FULL_AUTO; 255 268 priv->reg.rate_set.size = 12; 256 269 257 - #ifndef NO_FIRMWARE_CLASS 258 270 dev = &priv->ks_wlan_hw.sdio_card->func->dev; 259 271 if((retval = request_firmware(&fw_entry, cfg_file, dev)) !=0 ){ 260 272 DPRINTK(1, "error request_firmware() file=%s ret=%d\n", cfg_file, retval); ··· 263 277 DPRINTK(4, "success request_firmware() file=%s size=%d\n", cfg_file, fw_entry->size); 264 278 cur_p = fw_entry->data; 265 279 end_p = cur_p + fw_entry->size; 266 - #else 267 - orgfsuid=current->fsuid; 268 - orgfsgid=current->fsgid; 269 - orgfs=get_fs(); 270 - set_fs(KERNEL_DS); 271 - 272 - srcf = filp_open(cfg_file, O_RDONLY, 0); 273 - if (IS_ERR(srcf)) { 274 - printk(KERN_ERR "error %ld opening %s\n", -PTR_ERR(srcf),cfg_file); 275 - goto no_config_file; 276 - } 277 - 278 - if (!(srcf->f_op && srcf->f_op->read)) { 279 - printk(KERN_ERR "%s does not have a read method\n", cfg_file); 280 - goto no_config_file; 281 - } 282 - 283 - cfg_buf = (char *)kzalloc(MAX_CONFIG_FILE_SIZE, GFP_ATOMIC); 284 - if (!cfg_buf) { 285 - printk(KERN_ERR "%s does not read : out of memory \n", cfg_file); 286 - goto no_config_file; 287 - } 288 - 289 - nr_read = srcf->f_op->read(srcf, (unsigned char *)cfg_buf, MAX_CONFIG_FILE_SIZE, &srcf->f_pos); 290 - 291 - DPRINTK(1, "read retval=%d file=%s\n", nr_read, priv->reg.cfg_file); 292 - retval=filp_close(srcf ,NULL); 293 - if (retval) 294 - DPRINTK(1, "error %d closing %s\n", -retval,priv->reg.cfg_file); 295 - 296 - if (nr_read < 1) { 297 - printk(KERN_ERR "%s does not read : file is empty num=%d\n", cfg_file, nr_read); 298 - goto no_config_file; 299 - }else if(nr_read > MAX_CONFIG_FILE_SIZE){ 300 - printk(KERN_ERR "%s does not read : file is too big \n", cfg_file); 301 - goto no_config_file; 302 - } 303 - cur_p = cfg_buf; 304 - end_p = cur_p + nr_read; 305 - #endif 306 280 *end_p = '\0'; 307 281 308 282 while (cur_p < end_p) { ··· 470 524 } 471 525 472 526 } 473 - #ifndef NO_FIRMWARE_CLASS 474 527 release_firmware(fw_entry); 475 - #else 476 - no_config_file: 477 - kfree(cfg_buf); 478 - set_fs(orgfs); 479 - current->fsuid=orgfsuid; 480 - current->fsgid=orgfsgid; 481 - #endif 482 528 483 529 DPRINTK(3,"\n operation_mode = %d\n channel = %d\n ssid = %s\n tx_rate = %d\n \ 484 530 preamble = %d\n powermgt = %d\n scan_type = %d\n beacon_lost_count = %d\n rts = %d\n \
-56
drivers/staging/ks7010/ks7010_sdio.c
··· 56 56 unsigned char *buffer, int length ); 57 57 static int ks7010_sdio_write( ks_wlan_private *priv, unsigned int address, 58 58 unsigned char *buffer, int length ); 59 - #ifdef NO_FIRMWARE_CLASS 60 - static char *romfile = ROM_FILE; 61 - module_param(romfile, charp, S_IRUGO); 62 - #endif 63 59 /* macro */ 64 60 65 61 #define inc_txqhead(priv) \ ··· 719 723 if(read_buf) kfree(read_buf); 720 724 return rc; 721 725 } 722 - #ifndef NO_FIRMWARE_CLASS 723 726 #include <linux/firmware.h> 724 - #endif 725 727 static int ks79xx_upload_firmware(ks_wlan_private *priv, struct ks_sdio_card *card) 726 728 { 727 729 unsigned int size, offset, n = 0; 728 730 unsigned char *rom_buf; 729 731 unsigned char rw_data =0; 730 732 int retval, rc=0; 731 - #ifndef NO_FIRMWARE_CLASS 732 733 int length; 733 734 const struct firmware *fw_entry = NULL; 734 - #else 735 - int orgfsuid, orgfsgid; 736 - struct file *srcf; 737 - mm_segment_t orgfs; 738 - #endif 739 735 740 736 rom_buf = NULL; 741 737 ··· 746 758 goto error_out0; 747 759 } 748 760 749 - #ifndef NO_FIRMWARE_CLASS 750 761 if(request_firmware(&fw_entry, priv->reg.rom_file, &priv->ks_wlan_hw.sdio_card->func->dev)!=0){ 751 762 DPRINTK(1,"error request_firmware() file=%s\n", priv->reg.rom_file); 752 763 return 1; 753 764 } 754 765 DPRINTK(4,"success request_firmware() file=%s size=%d\n", priv->reg.rom_file, fw_entry->size); 755 766 length = fw_entry->size; 756 - #else 757 - orgfsuid=current->fsuid; 758 - orgfsgid=current->fsgid; 759 - current->fsuid=current->fsgid=0; 760 - orgfs=get_fs(); 761 - set_fs(KERNEL_DS); 762 - 763 - srcf = filp_open(romfile, O_RDONLY, 0); 764 - if (IS_ERR(srcf)) { 765 - DPRINTK(1, "error %ld opening %s\n", -PTR_ERR(srcf),romfile); 766 - rc = 1; 767 - goto error_out1; 768 - } 769 - 770 - if (!(srcf->f_op && srcf->f_op->read)) { 771 - DPRINTK(1, "%s does not have a read method\n", romfile); 772 - rc = 2; 773 - goto error_out2; 774 - } 775 - #endif 776 767 777 768 /* Load Program */ 778 769 n = 0; 779 770 do { 780 - #ifndef NO_FIRMWARE_CLASS 781 771 if(length >= ROM_BUFF_SIZE){ 782 772 size = ROM_BUFF_SIZE; 783 773 length = length - ROM_BUFF_SIZE; ··· 767 801 DPRINTK(4, "size = %d\n",size); 768 802 if(size == 0) break; 769 803 memcpy(rom_buf,fw_entry->data+n,size); 770 - #else 771 - /* The object must have a read method */ 772 - size = srcf->f_op->read(srcf, rom_buf, ROM_BUFF_SIZE, &srcf->f_pos); 773 - if (size < 0) { 774 - DPRINTK(1, "Read %s error %d\n", priv->reg.rom_file, -retval); 775 - rc = 5; 776 - goto error_out2; 777 - } 778 - else if (size == 0) break; 779 - #endif 780 804 /* Update write index */ 781 805 offset = n; 782 806 retval = ks7010_sdio_update_index(priv, KS7010_IRAM_ADDRESS+offset); ··· 808 852 809 853 rc = 0; 810 854 811 - #ifdef NO_FIRMWARE_CLASS 812 - error_out2: 813 - retval=filp_close(srcf ,NULL); 814 - if (retval) 815 - DPRINTK(1, "error %d closing %s\n", -retval,priv->reg.rom_file); 816 - 817 - error_out1: 818 - set_fs(orgfs); 819 - current->fsuid=orgfsuid; 820 - current->fsgid=orgfsgid; 821 - #else 822 855 error_out1: 823 856 release_firmware(fw_entry); 824 - #endif 825 857 error_out0: 826 858 sdio_release_host(card->func); 827 859 if(rom_buf)
-5
drivers/staging/ks7010/ks7010_sdio.h
··· 153 153 unsigned int qtail; /* rx buffer queue last pointer */ 154 154 spinlock_t rx_dev_lock; 155 155 }; 156 - #ifndef NO_FIRMWARE_CLASS 157 156 #define ROM_FILE "ks7010sd.rom" 158 157 #define CFG_FILE "ks79xx.cfg" 159 - #else 160 - #define ROM_FILE "/lib/firmware/ks7010sd.rom" 161 - #define CFG_FILE "/lib/firmware/ks79xx.cfg" 162 - #endif 163 158 #define KS_WLAN_DRIVER_VERSION_INFO "ks7010 sdio linux 007" 164 159 165 160 #endif /* _KS7010_SDIO_H */