diff options
Diffstat (limited to 'drivers/net/wireless/spectrum_cs.c')
-rw-r--r-- | drivers/net/wireless/spectrum_cs.c | 40 |
1 files changed, 17 insertions, 23 deletions
diff --git a/drivers/net/wireless/spectrum_cs.c b/drivers/net/wireless/spectrum_cs.c index 7f9aa139c347..bcc7038130f6 100644 --- a/drivers/net/wireless/spectrum_cs.c +++ b/drivers/net/wireless/spectrum_cs.c | |||
@@ -21,7 +21,6 @@ | |||
21 | #define DRIVER_NAME "spectrum_cs" | 21 | #define DRIVER_NAME "spectrum_cs" |
22 | #define PFX DRIVER_NAME ": " | 22 | #define PFX DRIVER_NAME ": " |
23 | 23 | ||
24 | #include <linux/config.h> | ||
25 | #include <linux/module.h> | 24 | #include <linux/module.h> |
26 | #include <linux/kernel.h> | 25 | #include <linux/kernel.h> |
27 | #include <linux/init.h> | 26 | #include <linux/init.h> |
@@ -35,8 +34,6 @@ | |||
35 | 34 | ||
36 | #include "orinoco.h" | 35 | #include "orinoco.h" |
37 | 36 | ||
38 | static unsigned char *primsym; | ||
39 | static unsigned char *secsym; | ||
40 | static const char primary_fw_name[] = "symbol_sp24t_prim_fw"; | 37 | static const char primary_fw_name[] = "symbol_sp24t_prim_fw"; |
41 | static const char secondary_fw_name[] = "symbol_sp24t_sec_fw"; | 38 | static const char secondary_fw_name[] = "symbol_sp24t_sec_fw"; |
42 | 39 | ||
@@ -245,7 +242,7 @@ spectrum_reset(struct pcmcia_device *link, int idle) | |||
245 | u_int save_cor; | 242 | u_int save_cor; |
246 | 243 | ||
247 | /* Doing it if hardware is gone is guaranteed crash */ | 244 | /* Doing it if hardware is gone is guaranteed crash */ |
248 | if (pcmcia_dev_present(link)) | 245 | if (!pcmcia_dev_present(link)) |
249 | return -ENODEV; | 246 | return -ENODEV; |
250 | 247 | ||
251 | /* Save original COR value */ | 248 | /* Save original COR value */ |
@@ -441,7 +438,7 @@ spectrum_load_blocks(hermes_t *hw, const struct dblock *first_block) | |||
441 | */ | 438 | */ |
442 | static int | 439 | static int |
443 | spectrum_dl_image(hermes_t *hw, struct pcmcia_device *link, | 440 | spectrum_dl_image(hermes_t *hw, struct pcmcia_device *link, |
444 | const unsigned char *image) | 441 | const unsigned char *image, int secondary) |
445 | { | 442 | { |
446 | int ret; | 443 | int ret; |
447 | const unsigned char *ptr; | 444 | const unsigned char *ptr; |
@@ -456,7 +453,7 @@ spectrum_dl_image(hermes_t *hw, struct pcmcia_device *link, | |||
456 | first_block = (const struct dblock *) ptr; | 453 | first_block = (const struct dblock *) ptr; |
457 | 454 | ||
458 | /* Read the PDA */ | 455 | /* Read the PDA */ |
459 | if (image != primsym) { | 456 | if (secondary) { |
460 | ret = spectrum_read_pda(hw, pda, sizeof(pda)); | 457 | ret = spectrum_read_pda(hw, pda, sizeof(pda)); |
461 | if (ret) | 458 | if (ret) |
462 | return ret; | 459 | return ret; |
@@ -473,7 +470,7 @@ spectrum_dl_image(hermes_t *hw, struct pcmcia_device *link, | |||
473 | return ret; | 470 | return ret; |
474 | 471 | ||
475 | /* Write the PDA to the adapter */ | 472 | /* Write the PDA to the adapter */ |
476 | if (image != primsym) { | 473 | if (secondary) { |
477 | ret = spectrum_apply_pda(hw, first_block, pda); | 474 | ret = spectrum_apply_pda(hw, first_block, pda); |
478 | if (ret) | 475 | if (ret) |
479 | return ret; | 476 | return ret; |
@@ -488,7 +485,7 @@ spectrum_dl_image(hermes_t *hw, struct pcmcia_device *link, | |||
488 | ret = hermes_init(hw); | 485 | ret = hermes_init(hw); |
489 | 486 | ||
490 | /* hermes_reset() should return 0 with the secondary firmware */ | 487 | /* hermes_reset() should return 0 with the secondary firmware */ |
491 | if (image != primsym && ret != 0) | 488 | if (secondary && ret != 0) |
492 | return -ENODEV; | 489 | return -ENODEV; |
493 | 490 | ||
494 | /* And this should work with any firmware */ | 491 | /* And this should work with any firmware */ |
@@ -510,33 +507,30 @@ spectrum_dl_firmware(hermes_t *hw, struct pcmcia_device *link) | |||
510 | const struct firmware *fw_entry; | 507 | const struct firmware *fw_entry; |
511 | 508 | ||
512 | if (request_firmware(&fw_entry, primary_fw_name, | 509 | if (request_firmware(&fw_entry, primary_fw_name, |
513 | &handle_to_dev(link)) == 0) { | 510 | &handle_to_dev(link)) != 0) { |
514 | primsym = fw_entry->data; | ||
515 | } else { | ||
516 | printk(KERN_ERR PFX "Cannot find firmware: %s\n", | 511 | printk(KERN_ERR PFX "Cannot find firmware: %s\n", |
517 | primary_fw_name); | 512 | primary_fw_name); |
518 | return -ENOENT; | 513 | return -ENOENT; |
519 | } | 514 | } |
520 | 515 | ||
521 | if (request_firmware(&fw_entry, secondary_fw_name, | ||
522 | &handle_to_dev(link)) == 0) { | ||
523 | secsym = fw_entry->data; | ||
524 | } else { | ||
525 | printk(KERN_ERR PFX "Cannot find firmware: %s\n", | ||
526 | secondary_fw_name); | ||
527 | return -ENOENT; | ||
528 | } | ||
529 | |||
530 | /* Load primary firmware */ | 516 | /* Load primary firmware */ |
531 | ret = spectrum_dl_image(hw, link, primsym); | 517 | ret = spectrum_dl_image(hw, link, fw_entry->data, 0); |
518 | release_firmware(fw_entry); | ||
532 | if (ret) { | 519 | if (ret) { |
533 | printk(KERN_ERR PFX "Primary firmware download failed\n"); | 520 | printk(KERN_ERR PFX "Primary firmware download failed\n"); |
534 | return ret; | 521 | return ret; |
535 | } | 522 | } |
536 | 523 | ||
537 | /* Load secondary firmware */ | 524 | if (request_firmware(&fw_entry, secondary_fw_name, |
538 | ret = spectrum_dl_image(hw, link, secsym); | 525 | &handle_to_dev(link)) != 0) { |
526 | printk(KERN_ERR PFX "Cannot find firmware: %s\n", | ||
527 | secondary_fw_name); | ||
528 | return -ENOENT; | ||
529 | } | ||
539 | 530 | ||
531 | /* Load secondary firmware */ | ||
532 | ret = spectrum_dl_image(hw, link, fw_entry->data, 1); | ||
533 | release_firmware(fw_entry); | ||
540 | if (ret) { | 534 | if (ret) { |
541 | printk(KERN_ERR PFX "Secondary firmware download failed\n"); | 535 | printk(KERN_ERR PFX "Secondary firmware download failed\n"); |
542 | } | 536 | } |