diff options
author | Brett Rudley <brudley@broadcom.com> | 2010-09-28 14:34:44 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2010-09-30 07:39:26 -0400 |
commit | 683b505b934b677e5dc61d8363625d3ca67f48bd (patch) | |
tree | 68e35cba391ff7851fa85d4e8b7cab300b3b18b8 | |
parent | a200adb1c73e9ef24c6415b08fd4fd54e3ba1488 (diff) |
staging: brcm80211: handle missing firmware better
Handle non-extistent firmware more gracefully.
Signed-off-by: Brett Rudley <brudley@broadcom.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r-- | drivers/staging/brcm80211/sys/wl_mac80211.c | 43 |
1 files changed, 25 insertions, 18 deletions
diff --git a/drivers/staging/brcm80211/sys/wl_mac80211.c b/drivers/staging/brcm80211/sys/wl_mac80211.c index 5400360e985..084e2f83d32 100644 --- a/drivers/staging/brcm80211/sys/wl_mac80211.c +++ b/drivers/staging/brcm80211/sys/wl_mac80211.c | |||
@@ -187,6 +187,7 @@ static struct pci_device_id wl_id_table[] = { | |||
187 | }; | 187 | }; |
188 | 188 | ||
189 | MODULE_DEVICE_TABLE(pci, wl_id_table); | 189 | MODULE_DEVICE_TABLE(pci, wl_id_table); |
190 | static void __devexit wl_remove(struct pci_dev *pdev); | ||
190 | #endif /* !BCMSDIO */ | 191 | #endif /* !BCMSDIO */ |
191 | 192 | ||
192 | #ifdef BCMSDIO | 193 | #ifdef BCMSDIO |
@@ -902,9 +903,11 @@ static wl_info_t *wl_attach(uint16 vendor, uint16 device, ulong regs, | |||
902 | #ifndef WLC_HIGH_ONLY | 903 | #ifndef WLC_HIGH_ONLY |
903 | /* prepare ucode */ | 904 | /* prepare ucode */ |
904 | if (wl_request_fw(wl, (struct pci_dev *)btparam)) { | 905 | if (wl_request_fw(wl, (struct pci_dev *)btparam)) { |
905 | printf("%s: %s driver failed\n", KBUILD_MODNAME, | 906 | printf("%s: Failed to find firmware usually in %s\n", |
906 | EPI_VERSION_STR); | 907 | KBUILD_MODNAME, "/lib/firmware/brcm"); |
907 | goto fail; | 908 | wl_release_fw(wl); |
909 | wl_remove((struct pci_dev *)btparam); | ||
910 | goto fail1; | ||
908 | } | 911 | } |
909 | #endif | 912 | #endif |
910 | 913 | ||
@@ -915,8 +918,8 @@ static wl_info_t *wl_attach(uint16 vendor, uint16 device, ulong regs, | |||
915 | wl_release_fw(wl); | 918 | wl_release_fw(wl); |
916 | #endif | 919 | #endif |
917 | if (!wl->wlc) { | 920 | if (!wl->wlc) { |
918 | printf("%s: %s driver failed with code %d\n", KBUILD_MODNAME, | 921 | printf("%s: %s wlc_attach() failed with code %d\n", |
919 | EPI_VERSION_STR, err); | 922 | KBUILD_MODNAME, EPI_VERSION_STR, err); |
920 | goto fail; | 923 | goto fail; |
921 | } | 924 | } |
922 | wl->pub = wlc_pub(wl->wlc); | 925 | wl->pub = wlc_pub(wl->wlc); |
@@ -1018,6 +1021,7 @@ static wl_info_t *wl_attach(uint16 vendor, uint16 device, ulong regs, | |||
1018 | 1021 | ||
1019 | fail: | 1022 | fail: |
1020 | wl_free(wl); | 1023 | wl_free(wl); |
1024 | fail1: | ||
1021 | return NULL; | 1025 | return NULL; |
1022 | } | 1026 | } |
1023 | 1027 | ||
@@ -1189,9 +1193,6 @@ static void wl_dbus_disconnect_cb(void *arg) | |||
1189 | } | 1193 | } |
1190 | #endif /* WLC_HIGH_ONLY */ | 1194 | #endif /* WLC_HIGH_ONLY */ |
1191 | 1195 | ||
1192 | #ifndef BCMSDIO | ||
1193 | static void __devexit wl_remove(struct pci_dev *pdev); | ||
1194 | #endif | ||
1195 | 1196 | ||
1196 | #define CHAN2GHZ(channel, freqency, chflags) { \ | 1197 | #define CHAN2GHZ(channel, freqency, chflags) { \ |
1197 | .band = IEEE80211_BAND_2GHZ, \ | 1198 | .band = IEEE80211_BAND_2GHZ, \ |
@@ -1510,6 +1511,11 @@ wl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
1510 | wl = wl_attach(pdev->vendor, pdev->device, pci_resource_start(pdev, 0), | 1511 | wl = wl_attach(pdev->vendor, pdev->device, pci_resource_start(pdev, 0), |
1511 | PCI_BUS, pdev, pdev->irq); | 1512 | PCI_BUS, pdev, pdev->irq); |
1512 | 1513 | ||
1514 | if (!wl) { | ||
1515 | WL_ERROR(("%s: %s: wl_attach failed!\n", | ||
1516 | KBUILD_MODNAME, __func__)); | ||
1517 | return -ENODEV; | ||
1518 | } | ||
1513 | return 0; | 1519 | return 0; |
1514 | err_1: | 1520 | err_1: |
1515 | WL_ERROR(("%s: err_1: Major hoarkage\n", __func__)); | 1521 | WL_ERROR(("%s: err_1: Major hoarkage\n", __func__)); |
@@ -1594,14 +1600,13 @@ static void __devexit wl_remove(struct pci_dev *pdev) | |||
1594 | WL_ERROR(("wl: wl_remove: wlc_chipmatch failed\n")); | 1600 | WL_ERROR(("wl: wl_remove: wlc_chipmatch failed\n")); |
1595 | return; | 1601 | return; |
1596 | } | 1602 | } |
1597 | 1603 | if (wl->wlc) { | |
1598 | ieee80211_unregister_hw(hw); | 1604 | ieee80211_unregister_hw(hw); |
1599 | 1605 | WL_LOCK(wl); | |
1600 | WL_LOCK(wl); | 1606 | wl_down(wl); |
1601 | wl_down(wl); | 1607 | WL_UNLOCK(wl); |
1602 | WL_UNLOCK(wl); | 1608 | WL_NONE(("%s: Down\n", __func__)); |
1603 | WL_NONE(("%s: Down\n", __func__)); | 1609 | } |
1604 | |||
1605 | pci_disable_device(pdev); | 1610 | pci_disable_device(pdev); |
1606 | 1611 | ||
1607 | wl_free(wl); | 1612 | wl_free(wl); |
@@ -2511,7 +2516,8 @@ static int wl_request_fw(wl_info_t *wl, struct pci_dev *pdev) | |||
2511 | WL_NONE(("request fw %s\n", fw_name)); | 2516 | WL_NONE(("request fw %s\n", fw_name)); |
2512 | status = request_firmware(&wl->fw.fw_bin[i], fw_name, device); | 2517 | status = request_firmware(&wl->fw.fw_bin[i], fw_name, device); |
2513 | if (status) { | 2518 | if (status) { |
2514 | printf("fail to request firmware %s\n", fw_name); | 2519 | printf("%s: fail to load firmware %s\n", |
2520 | KBUILD_MODNAME, fw_name); | ||
2515 | wl_release_fw(wl); | 2521 | wl_release_fw(wl); |
2516 | return status; | 2522 | return status; |
2517 | } | 2523 | } |
@@ -2520,7 +2526,8 @@ static int wl_request_fw(wl_info_t *wl, struct pci_dev *pdev) | |||
2520 | UCODE_LOADER_API_VER); | 2526 | UCODE_LOADER_API_VER); |
2521 | status = request_firmware(&wl->fw.fw_hdr[i], fw_name, device); | 2527 | status = request_firmware(&wl->fw.fw_hdr[i], fw_name, device); |
2522 | if (status) { | 2528 | if (status) { |
2523 | printf("fail to request firmware %s\n", fw_name); | 2529 | printf("%s: fail to load firmware %s\n", |
2530 | KBUILD_MODNAME, fw_name); | ||
2524 | wl_release_fw(wl); | 2531 | wl_release_fw(wl); |
2525 | return status; | 2532 | return status; |
2526 | } | 2533 | } |