Commit 2cea7b26 authored by David Kilroy's avatar David Kilroy Committed by John W. Linville

orinoco: Cache Symbol firmware

Signed-off by: David Kilroy <kilroyd@googlemail.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent 74734312
...@@ -645,34 +645,41 @@ symbol_dl_firmware(struct orinoco_private *priv, ...@@ -645,34 +645,41 @@ symbol_dl_firmware(struct orinoco_private *priv,
int ret; int ret;
const struct firmware *fw_entry; const struct firmware *fw_entry;
if (request_firmware(&fw_entry, fw->pri_fw, if (!priv->cached_pri_fw) {
priv->dev) != 0) { if (request_firmware(&fw_entry, fw->pri_fw, priv->dev) != 0) {
printk(KERN_ERR "%s: Cannot find firmware: %s\n", printk(KERN_ERR "%s: Cannot find firmware: %s\n",
dev->name, fw->pri_fw); dev->name, fw->pri_fw);
return -ENOENT; return -ENOENT;
} }
} else
fw_entry = priv->cached_pri_fw;
/* Load primary firmware */ /* Load primary firmware */
ret = symbol_dl_image(priv, fw, fw_entry->data, ret = symbol_dl_image(priv, fw, fw_entry->data,
fw_entry->data + fw_entry->size, 0); fw_entry->data + fw_entry->size, 0);
release_firmware(fw_entry);
if (!priv->cached_pri_fw)
release_firmware(fw_entry);
if (ret) { if (ret) {
printk(KERN_ERR "%s: Primary firmware download failed\n", printk(KERN_ERR "%s: Primary firmware download failed\n",
dev->name); dev->name);
return ret; return ret;
} }
if (request_firmware(&fw_entry, fw->sta_fw, if (!priv->cached_fw) {
priv->dev) != 0) { if (request_firmware(&fw_entry, fw->sta_fw, priv->dev) != 0) {
printk(KERN_ERR "%s: Cannot find firmware: %s\n", printk(KERN_ERR "%s: Cannot find firmware: %s\n",
dev->name, fw->sta_fw); dev->name, fw->sta_fw);
return -ENOENT; return -ENOENT;
} }
} else
fw_entry = priv->cached_fw;
/* Load secondary firmware */ /* Load secondary firmware */
ret = symbol_dl_image(priv, fw, fw_entry->data, ret = symbol_dl_image(priv, fw, fw_entry->data,
fw_entry->data + fw_entry->size, 1); fw_entry->data + fw_entry->size, 1);
release_firmware(fw_entry); if (!priv->cached_fw)
release_firmware(fw_entry);
if (ret) { if (ret) {
printk(KERN_ERR "%s: Secondary firmware download failed\n", printk(KERN_ERR "%s: Secondary firmware download failed\n",
dev->name); dev->name);
...@@ -708,13 +715,20 @@ static int orinoco_download(struct orinoco_private *priv) ...@@ -708,13 +715,20 @@ static int orinoco_download(struct orinoco_private *priv)
static void orinoco_cache_fw(struct orinoco_private *priv, int ap) static void orinoco_cache_fw(struct orinoco_private *priv, int ap)
{ {
const struct firmware *fw_entry = NULL; const struct firmware *fw_entry = NULL;
const char *pri_fw;
const char *fw; const char *fw;
pri_fw = orinoco_fw[priv->firmware_type].pri_fw;
if (ap) if (ap)
fw = orinoco_fw[priv->firmware_type].ap_fw; fw = orinoco_fw[priv->firmware_type].ap_fw;
else else
fw = orinoco_fw[priv->firmware_type].sta_fw; fw = orinoco_fw[priv->firmware_type].sta_fw;
if (pri_fw) {
if (request_firmware(&fw_entry, pri_fw, priv->dev) == 0)
priv->cached_pri_fw = fw_entry;
}
if (fw) { if (fw) {
if (request_firmware(&fw_entry, fw, priv->dev) == 0) if (request_firmware(&fw_entry, fw, priv->dev) == 0)
priv->cached_fw = fw_entry; priv->cached_fw = fw_entry;
...@@ -723,9 +737,12 @@ static void orinoco_cache_fw(struct orinoco_private *priv, int ap) ...@@ -723,9 +737,12 @@ static void orinoco_cache_fw(struct orinoco_private *priv, int ap)
static void orinoco_uncache_fw(struct orinoco_private *priv) static void orinoco_uncache_fw(struct orinoco_private *priv)
{ {
if (priv->cached_pri_fw)
release_firmware(priv->cached_pri_fw);
if (priv->cached_fw) if (priv->cached_fw)
release_firmware(priv->cached_fw); release_firmware(priv->cached_fw);
priv->cached_pri_fw = NULL;
priv->cached_fw = NULL; priv->cached_fw = NULL;
} }
...@@ -3563,6 +3580,7 @@ struct net_device ...@@ -3563,6 +3580,7 @@ struct net_device
netif_carrier_off(dev); netif_carrier_off(dev);
priv->last_linkstatus = 0xffff; priv->last_linkstatus = 0xffff;
priv->cached_pri_fw = NULL;
priv->cached_fw = NULL; priv->cached_fw = NULL;
return dev; return dev;
......
...@@ -167,7 +167,8 @@ struct orinoco_private { ...@@ -167,7 +167,8 @@ struct orinoco_private {
unsigned int tkip_cm_active:1; unsigned int tkip_cm_active:1;
unsigned int key_mgmt:3; unsigned int key_mgmt:3;
/* Cached in memory firmware to use in ->resume */ /* Cached in memory firmware to use during ->resume. */
const struct firmware *cached_pri_fw;
const struct firmware *cached_fw; const struct firmware *cached_fw;
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment