diff options
author | David Kilroy <kilroyd@googlemail.com> | 2008-11-22 05:37:26 -0500 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2008-11-26 09:47:46 -0500 |
commit | 2cea7b261942009e90befbe41d998e2931547026 (patch) | |
tree | f1fe4d36aea899af7d0cdcb9aa56b65c83e25616 /drivers/net | |
parent | 7473431297761fa644a128a497b91e299676f501 (diff) |
orinoco: Cache Symbol firmware
Signed-off by: David Kilroy <kilroyd@googlemail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net')
-rw-r--r-- | drivers/net/wireless/orinoco/orinoco.c | 46 | ||||
-rw-r--r-- | drivers/net/wireless/orinoco/orinoco.h | 3 |
2 files changed, 34 insertions, 15 deletions
diff --git a/drivers/net/wireless/orinoco/orinoco.c b/drivers/net/wireless/orinoco/orinoco.c index 492f419d18f4..09eec7f620bc 100644 --- a/drivers/net/wireless/orinoco/orinoco.c +++ b/drivers/net/wireless/orinoco/orinoco.c | |||
@@ -645,34 +645,41 @@ symbol_dl_firmware(struct orinoco_private *priv, | |||
645 | int ret; | 645 | int ret; |
646 | const struct firmware *fw_entry; | 646 | const struct firmware *fw_entry; |
647 | 647 | ||
648 | if (request_firmware(&fw_entry, fw->pri_fw, | 648 | if (!priv->cached_pri_fw) { |
649 | priv->dev) != 0) { | 649 | if (request_firmware(&fw_entry, fw->pri_fw, priv->dev) != 0) { |
650 | printk(KERN_ERR "%s: Cannot find firmware: %s\n", | 650 | printk(KERN_ERR "%s: Cannot find firmware: %s\n", |
651 | dev->name, fw->pri_fw); | 651 | dev->name, fw->pri_fw); |
652 | return -ENOENT; | 652 | return -ENOENT; |
653 | } | 653 | } |
654 | } else | ||
655 | fw_entry = priv->cached_pri_fw; | ||
654 | 656 | ||
655 | /* Load primary firmware */ | 657 | /* Load primary firmware */ |
656 | ret = symbol_dl_image(priv, fw, fw_entry->data, | 658 | ret = symbol_dl_image(priv, fw, fw_entry->data, |
657 | fw_entry->data + fw_entry->size, 0); | 659 | fw_entry->data + fw_entry->size, 0); |
658 | release_firmware(fw_entry); | 660 | |
661 | if (!priv->cached_pri_fw) | ||
662 | release_firmware(fw_entry); | ||
659 | if (ret) { | 663 | if (ret) { |
660 | printk(KERN_ERR "%s: Primary firmware download failed\n", | 664 | printk(KERN_ERR "%s: Primary firmware download failed\n", |
661 | dev->name); | 665 | dev->name); |
662 | return ret; | 666 | return ret; |
663 | } | 667 | } |
664 | 668 | ||
665 | if (request_firmware(&fw_entry, fw->sta_fw, | 669 | if (!priv->cached_fw) { |
666 | priv->dev) != 0) { | 670 | if (request_firmware(&fw_entry, fw->sta_fw, priv->dev) != 0) { |
667 | printk(KERN_ERR "%s: Cannot find firmware: %s\n", | 671 | printk(KERN_ERR "%s: Cannot find firmware: %s\n", |
668 | dev->name, fw->sta_fw); | 672 | dev->name, fw->sta_fw); |
669 | return -ENOENT; | 673 | return -ENOENT; |
670 | } | 674 | } |
675 | } else | ||
676 | fw_entry = priv->cached_fw; | ||
671 | 677 | ||
672 | /* Load secondary firmware */ | 678 | /* Load secondary firmware */ |
673 | ret = symbol_dl_image(priv, fw, fw_entry->data, | 679 | ret = symbol_dl_image(priv, fw, fw_entry->data, |
674 | fw_entry->data + fw_entry->size, 1); | 680 | fw_entry->data + fw_entry->size, 1); |
675 | release_firmware(fw_entry); | 681 | if (!priv->cached_fw) |
682 | release_firmware(fw_entry); | ||
676 | if (ret) { | 683 | if (ret) { |
677 | printk(KERN_ERR "%s: Secondary firmware download failed\n", | 684 | printk(KERN_ERR "%s: Secondary firmware download failed\n", |
678 | dev->name); | 685 | dev->name); |
@@ -708,13 +715,20 @@ static int orinoco_download(struct orinoco_private *priv) | |||
708 | static void orinoco_cache_fw(struct orinoco_private *priv, int ap) | 715 | static void orinoco_cache_fw(struct orinoco_private *priv, int ap) |
709 | { | 716 | { |
710 | const struct firmware *fw_entry = NULL; | 717 | const struct firmware *fw_entry = NULL; |
718 | const char *pri_fw; | ||
711 | const char *fw; | 719 | const char *fw; |
712 | 720 | ||
721 | pri_fw = orinoco_fw[priv->firmware_type].pri_fw; | ||
713 | if (ap) | 722 | if (ap) |
714 | fw = orinoco_fw[priv->firmware_type].ap_fw; | 723 | fw = orinoco_fw[priv->firmware_type].ap_fw; |
715 | else | 724 | else |
716 | fw = orinoco_fw[priv->firmware_type].sta_fw; | 725 | fw = orinoco_fw[priv->firmware_type].sta_fw; |
717 | 726 | ||
727 | if (pri_fw) { | ||
728 | if (request_firmware(&fw_entry, pri_fw, priv->dev) == 0) | ||
729 | priv->cached_pri_fw = fw_entry; | ||
730 | } | ||
731 | |||
718 | if (fw) { | 732 | if (fw) { |
719 | if (request_firmware(&fw_entry, fw, priv->dev) == 0) | 733 | if (request_firmware(&fw_entry, fw, priv->dev) == 0) |
720 | priv->cached_fw = fw_entry; | 734 | priv->cached_fw = fw_entry; |
@@ -723,9 +737,12 @@ static void orinoco_cache_fw(struct orinoco_private *priv, int ap) | |||
723 | 737 | ||
724 | static void orinoco_uncache_fw(struct orinoco_private *priv) | 738 | static void orinoco_uncache_fw(struct orinoco_private *priv) |
725 | { | 739 | { |
740 | if (priv->cached_pri_fw) | ||
741 | release_firmware(priv->cached_pri_fw); | ||
726 | if (priv->cached_fw) | 742 | if (priv->cached_fw) |
727 | release_firmware(priv->cached_fw); | 743 | release_firmware(priv->cached_fw); |
728 | 744 | ||
745 | priv->cached_pri_fw = NULL; | ||
729 | priv->cached_fw = NULL; | 746 | priv->cached_fw = NULL; |
730 | } | 747 | } |
731 | 748 | ||
@@ -3563,6 +3580,7 @@ struct net_device | |||
3563 | netif_carrier_off(dev); | 3580 | netif_carrier_off(dev); |
3564 | priv->last_linkstatus = 0xffff; | 3581 | priv->last_linkstatus = 0xffff; |
3565 | 3582 | ||
3583 | priv->cached_pri_fw = NULL; | ||
3566 | priv->cached_fw = NULL; | 3584 | priv->cached_fw = NULL; |
3567 | 3585 | ||
3568 | return dev; | 3586 | return dev; |
diff --git a/drivers/net/wireless/orinoco/orinoco.h b/drivers/net/wireless/orinoco/orinoco.h index 8c2953834923..f6eaea98db53 100644 --- a/drivers/net/wireless/orinoco/orinoco.h +++ b/drivers/net/wireless/orinoco/orinoco.h | |||
@@ -167,7 +167,8 @@ struct orinoco_private { | |||
167 | unsigned int tkip_cm_active:1; | 167 | unsigned int tkip_cm_active:1; |
168 | unsigned int key_mgmt:3; | 168 | unsigned int key_mgmt:3; |
169 | 169 | ||
170 | /* Cached in memory firmware to use in ->resume */ | 170 | /* Cached in memory firmware to use during ->resume. */ |
171 | const struct firmware *cached_pri_fw; | ||
171 | const struct firmware *cached_fw; | 172 | const struct firmware *cached_fw; |
172 | }; | 173 | }; |
173 | 174 | ||