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

staging: r8712u: Switch driver to use external firmware from linux-firmware

Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

authored by

Larry Finger and committed by
Greg Kroah-Hartman
c84a7028 e3dc896b

+17 -7
-2
drivers/staging/rtl8712/TODO
··· 3 3 - switch to use LIB80211 4 4 - switch to use MAC80211 5 5 - checkpatch.pl fixes - only a few remain 6 - - switch from large inline firmware file to use the firmware interface 7 - and add the file to the linux-firmware package. 8 6 9 7 Please send any patches to Greg Kroah-Hartman <greg@kroah.com>, 10 8 Larry Finger <Larry.Finger@lwfinger.net> and
+17 -5
drivers/staging/rtl8712/hal_init.c
··· 31 31 #include "osdep_service.h" 32 32 #include "drv_types.h" 33 33 #include "rtl871x_byteorder.h" 34 - #include "farray.h" 35 34 #include "usb_osintf.h" 36 35 37 36 #define FWBUFF_ALIGN_SZ 512 ··· 39 40 static u32 rtl871x_open_fw(struct _adapter *padapter, void **pphfwfile_hdl, 40 41 const u8 **ppmappedfw) 41 42 { 42 - u32 len; 43 + int rc; 44 + const char firmware_file[] = "rtl8712u/rtl8712u.bin"; 45 + const struct firmware **praw = (const struct firmware **) 46 + (pphfwfile_hdl); 47 + struct dvobj_priv *pdvobjpriv = (struct dvobj_priv *) 48 + (&padapter->dvobjpriv); 49 + struct usb_device *pusbdev = pdvobjpriv->pusbdev; 43 50 44 - *ppmappedfw = f_array; 45 - len = sizeof(f_array); 46 - return len; 51 + printk(KERN_INFO "r8712u: Loading firmware from \"%s\"\n", 52 + firmware_file); 53 + rc = request_firmware(praw, firmware_file, &pusbdev->dev); 54 + if (rc < 0) { 55 + printk(KERN_ERR "r8712u: Unable to load firmware\n"); 56 + printk(KERN_ERR "r8712u: Install latest linux-firmware\n"); 57 + return 0; 58 + } 59 + *ppmappedfw = (u8 *)((*praw)->data); 60 + return (*praw)->size; 47 61 } 48 62 49 63 static void fill_fwpriv(struct _adapter *padapter, struct fw_priv *pfwpriv)