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

brcmfmac: remove firmware list from USB driver

The USB driver was using a list for firmware info that was
used in suspend/resume scenario. Now that brcmfmac is using
the asynchronous firmware request this is no longer needed.

Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
Reviewed-by: Daniel (Deognyoun) Kim <dekim@broadcom.com>
Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>

authored by

Arend van Spriel and committed by
John W. Linville
52f98a57 c40edfc0

-76
-76
drivers/net/wireless/brcm80211/brcmfmac/usb.c
··· 62 62 u8 *image; 63 63 int image_len; 64 64 }; 65 - static struct list_head fw_image_list; 66 65 67 66 struct brcmf_usbdev_info { 68 67 struct brcmf_usbdev bus_pub; /* MUST BE FIRST */ ··· 1032 1033 return NULL; 1033 1034 } 1034 1035 } 1035 - static __used int brcmf_usb_get_fw(struct brcmf_usbdev_info *devinfo) 1036 - { 1037 - s8 *fwname; 1038 - const struct firmware *fw; 1039 - struct brcmf_usb_image *fw_image; 1040 - int err; 1041 - 1042 - brcmf_dbg(USB, "Enter\n"); 1043 - switch (devinfo->bus_pub.devid) { 1044 - case 43143: 1045 - fwname = BRCMF_USB_43143_FW_NAME; 1046 - break; 1047 - case 43235: 1048 - case 43236: 1049 - case 43238: 1050 - fwname = BRCMF_USB_43236_FW_NAME; 1051 - break; 1052 - case 43242: 1053 - fwname = BRCMF_USB_43242_FW_NAME; 1054 - break; 1055 - default: 1056 - return -EINVAL; 1057 - break; 1058 - } 1059 - brcmf_dbg(USB, "Loading FW %s\n", fwname); 1060 - list_for_each_entry(fw_image, &fw_image_list, list) { 1061 - if (fw_image->fwname == fwname) { 1062 - devinfo->image = fw_image->image; 1063 - devinfo->image_len = fw_image->image_len; 1064 - return 0; 1065 - } 1066 - } 1067 - /* fw image not yet loaded. Load it now and add to list */ 1068 - err = request_firmware(&fw, fwname, devinfo->dev); 1069 - if (!fw) { 1070 - brcmf_err("fail to request firmware %s\n", fwname); 1071 - return err; 1072 - } 1073 - if (check_file(fw->data) < 0) { 1074 - brcmf_err("invalid firmware %s\n", fwname); 1075 - return -EINVAL; 1076 - } 1077 - 1078 - fw_image = kzalloc(sizeof(*fw_image), GFP_ATOMIC); 1079 - if (!fw_image) 1080 - return -ENOMEM; 1081 - INIT_LIST_HEAD(&fw_image->list); 1082 - list_add_tail(&fw_image->list, &fw_image_list); 1083 - fw_image->fwname = fwname; 1084 - fw_image->image = vmalloc(fw->size); 1085 - if (!fw_image->image) 1086 - return -ENOMEM; 1087 - 1088 - memcpy(fw_image->image, fw->data, fw->size); 1089 - fw_image->image_len = fw->size; 1090 - 1091 - release_firmware(fw); 1092 - 1093 - devinfo->image = fw_image->image; 1094 - devinfo->image_len = fw_image->image_len; 1095 - 1096 - return 0; 1097 - } 1098 1036 1099 1037 1100 1038 static ··· 1420 1484 .disable_hub_initiated_lpm = 1, 1421 1485 }; 1422 1486 1423 - static void brcmf_release_fw(struct list_head *q) 1424 - { 1425 - struct brcmf_usb_image *fw_image, *next; 1426 - 1427 - list_for_each_entry_safe(fw_image, next, q, list) { 1428 - vfree(fw_image->image); 1429 - list_del_init(&fw_image->list); 1430 - } 1431 - } 1432 - 1433 1487 static int brcmf_usb_reset_device(struct device *dev, void *notused) 1434 1488 { 1435 1489 /* device past is the usb interface so we ··· 1438 1512 ret = driver_for_each_device(drv, NULL, NULL, 1439 1513 brcmf_usb_reset_device); 1440 1514 usb_deregister(&brcmf_usbdrvr); 1441 - brcmf_release_fw(&fw_image_list); 1442 1515 } 1443 1516 1444 1517 void brcmf_usb_register(void) 1445 1518 { 1446 1519 brcmf_dbg(USB, "Enter\n"); 1447 - INIT_LIST_HEAD(&fw_image_list); 1448 1520 usb_register(&brcmf_usbdrvr); 1449 1521 }