aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrey Borzenkov <arvidjaar@mail.ru>2009-02-28 15:09:09 -0500
committerJohn W. Linville <linville@tuxdriver.com>2009-03-16 18:09:26 -0400
commit2bfc5cb57b55ed2204bca7668e082f7bf485760a (patch)
treee3a9855ff25ed4d1b9d0895851412fdce7f1b994
parentafece1c6587010cc81d1a43045c855774e8234a3 (diff)
orinoco: firmware: consistently compile out fw cache support if not requested
Currently part of support for FW caching is unconditionally compiled in even if it is never used. Consistently remove caching support if not requested by user. Signed-off-by: Andrey Borzenkov <arvidjaar@mail.ru> Signed-off-by: John W. Linville <linville@tuxdriver.com>
-rw-r--r--drivers/net/wireless/orinoco/fw.c37
-rw-r--r--drivers/net/wireless/orinoco/fw.h5
-rw-r--r--drivers/net/wireless/orinoco/main.c2
-rw-r--r--drivers/net/wireless/orinoco/orinoco.h2
4 files changed, 33 insertions, 13 deletions
diff --git a/drivers/net/wireless/orinoco/fw.c b/drivers/net/wireless/orinoco/fw.c
index e7abb45d6753..1084b43e04bc 100644
--- a/drivers/net/wireless/orinoco/fw.c
+++ b/drivers/net/wireless/orinoco/fw.c
@@ -70,6 +70,19 @@ static const char *validate_fw(const struct orinoco_fw_header *hdr, size_t len)
70 return NULL; 70 return NULL;
71} 71}
72 72
73#if defined(CONFIG_HERMES_CACHE_FW_ON_INIT) || defined(CONFIG_PM_SLEEP)
74static inline const struct firmware *
75orinoco_cached_fw_get(struct orinoco_private *priv, bool primary)
76{
77 if (primary)
78 return priv->cached_pri_fw;
79 else
80 return priv->cached_fw;
81}
82#else
83#define orinoco_cached_fw_get(priv, primary) (NULL)
84#endif
85
73/* Download either STA or AP firmware into the card. */ 86/* Download either STA or AP firmware into the card. */
74static int 87static int
75orinoco_dl_firmware(struct orinoco_private *priv, 88orinoco_dl_firmware(struct orinoco_private *priv,
@@ -107,7 +120,7 @@ orinoco_dl_firmware(struct orinoco_private *priv,
107 if (err) 120 if (err)
108 goto free; 121 goto free;
109 122
110 if (!priv->cached_fw) { 123 if (!orinoco_cached_fw_get(priv, false)) {
111 err = request_firmware(&fw_entry, firmware, priv->dev); 124 err = request_firmware(&fw_entry, firmware, priv->dev);
112 125
113 if (err) { 126 if (err) {
@@ -117,7 +130,7 @@ orinoco_dl_firmware(struct orinoco_private *priv,
117 goto free; 130 goto free;
118 } 131 }
119 } else 132 } else
120 fw_entry = priv->cached_fw; 133 fw_entry = orinoco_cached_fw_get(priv, false);
121 134
122 hdr = (const struct orinoco_fw_header *) fw_entry->data; 135 hdr = (const struct orinoco_fw_header *) fw_entry->data;
123 136
@@ -170,7 +183,7 @@ orinoco_dl_firmware(struct orinoco_private *priv,
170 183
171abort: 184abort:
172 /* If we requested the firmware, release it. */ 185 /* If we requested the firmware, release it. */
173 if (!priv->cached_fw) 186 if (!orinoco_cached_fw_get(priv, false))
174 release_firmware(fw_entry); 187 release_firmware(fw_entry);
175 188
176free: 189free:
@@ -273,20 +286,20 @@ symbol_dl_firmware(struct orinoco_private *priv,
273 int ret; 286 int ret;
274 const struct firmware *fw_entry; 287 const struct firmware *fw_entry;
275 288
276 if (!priv->cached_pri_fw) { 289 if (!orinoco_cached_fw_get(priv, true)) {
277 if (request_firmware(&fw_entry, fw->pri_fw, priv->dev) != 0) { 290 if (request_firmware(&fw_entry, fw->pri_fw, priv->dev) != 0) {
278 printk(KERN_ERR "%s: Cannot find firmware: %s\n", 291 printk(KERN_ERR "%s: Cannot find firmware: %s\n",
279 dev->name, fw->pri_fw); 292 dev->name, fw->pri_fw);
280 return -ENOENT; 293 return -ENOENT;
281 } 294 }
282 } else 295 } else
283 fw_entry = priv->cached_pri_fw; 296 fw_entry = orinoco_cached_fw_get(priv, true);
284 297
285 /* Load primary firmware */ 298 /* Load primary firmware */
286 ret = symbol_dl_image(priv, fw, fw_entry->data, 299 ret = symbol_dl_image(priv, fw, fw_entry->data,
287 fw_entry->data + fw_entry->size, 0); 300 fw_entry->data + fw_entry->size, 0);
288 301
289 if (!priv->cached_pri_fw) 302 if (!orinoco_cached_fw_get(priv, true))
290 release_firmware(fw_entry); 303 release_firmware(fw_entry);
291 if (ret) { 304 if (ret) {
292 printk(KERN_ERR "%s: Primary firmware download failed\n", 305 printk(KERN_ERR "%s: Primary firmware download failed\n",
@@ -294,19 +307,19 @@ symbol_dl_firmware(struct orinoco_private *priv,
294 return ret; 307 return ret;
295 } 308 }
296 309
297 if (!priv->cached_fw) { 310 if (!orinoco_cached_fw_get(priv, false)) {
298 if (request_firmware(&fw_entry, fw->sta_fw, priv->dev) != 0) { 311 if (request_firmware(&fw_entry, fw->sta_fw, priv->dev) != 0) {
299 printk(KERN_ERR "%s: Cannot find firmware: %s\n", 312 printk(KERN_ERR "%s: Cannot find firmware: %s\n",
300 dev->name, fw->sta_fw); 313 dev->name, fw->sta_fw);
301 return -ENOENT; 314 return -ENOENT;
302 } 315 }
303 } else 316 } else
304 fw_entry = priv->cached_fw; 317 fw_entry = orinoco_cached_fw_get(priv, false);
305 318
306 /* Load secondary firmware */ 319 /* Load secondary firmware */
307 ret = symbol_dl_image(priv, fw, fw_entry->data, 320 ret = symbol_dl_image(priv, fw, fw_entry->data,
308 fw_entry->data + fw_entry->size, 1); 321 fw_entry->data + fw_entry->size, 1);
309 if (!priv->cached_fw) 322 if (!orinoco_cached_fw_get(priv, false))
310 release_firmware(fw_entry); 323 release_firmware(fw_entry);
311 if (ret) { 324 if (ret) {
312 printk(KERN_ERR "%s: Secondary firmware download failed\n", 325 printk(KERN_ERR "%s: Secondary firmware download failed\n",
@@ -340,9 +353,9 @@ int orinoco_download(struct orinoco_private *priv)
340 return err; 353 return err;
341} 354}
342 355
356#if defined(CONFIG_HERMES_CACHE_FW_ON_INIT) || defined(CONFIG_PM_SLEEP)
343void orinoco_cache_fw(struct orinoco_private *priv, int ap) 357void orinoco_cache_fw(struct orinoco_private *priv, int ap)
344{ 358{
345#if defined(CONFIG_HERMES_CACHE_FW_ON_INIT) || defined(CONFIG_PM_SLEEP)
346 const struct firmware *fw_entry = NULL; 359 const struct firmware *fw_entry = NULL;
347 const char *pri_fw; 360 const char *pri_fw;
348 const char *fw; 361 const char *fw;
@@ -362,12 +375,10 @@ void orinoco_cache_fw(struct orinoco_private *priv, int ap)
362 if (request_firmware(&fw_entry, fw, priv->dev) == 0) 375 if (request_firmware(&fw_entry, fw, priv->dev) == 0)
363 priv->cached_fw = fw_entry; 376 priv->cached_fw = fw_entry;
364 } 377 }
365#endif
366} 378}
367 379
368void orinoco_uncache_fw(struct orinoco_private *priv) 380void orinoco_uncache_fw(struct orinoco_private *priv)
369{ 381{
370#if defined(CONFIG_HERMES_CACHE_FW_ON_INIT) || defined(CONFIG_PM_SLEEP)
371 if (priv->cached_pri_fw) 382 if (priv->cached_pri_fw)
372 release_firmware(priv->cached_pri_fw); 383 release_firmware(priv->cached_pri_fw);
373 if (priv->cached_fw) 384 if (priv->cached_fw)
@@ -375,5 +386,5 @@ void orinoco_uncache_fw(struct orinoco_private *priv)
375 386
376 priv->cached_pri_fw = NULL; 387 priv->cached_pri_fw = NULL;
377 priv->cached_fw = NULL; 388 priv->cached_fw = NULL;
378#endif
379} 389}
390#endif
diff --git a/drivers/net/wireless/orinoco/fw.h b/drivers/net/wireless/orinoco/fw.h
index 2290f0845d59..89fc26d25b06 100644
--- a/drivers/net/wireless/orinoco/fw.h
+++ b/drivers/net/wireless/orinoco/fw.h
@@ -10,7 +10,12 @@ struct orinoco_private;
10 10
11int orinoco_download(struct orinoco_private *priv); 11int orinoco_download(struct orinoco_private *priv);
12 12
13#if defined(CONFIG_HERMES_CACHE_FW_ON_INIT) || defined(CONFIG_PM_SLEEP)
13void orinoco_cache_fw(struct orinoco_private *priv, int ap); 14void orinoco_cache_fw(struct orinoco_private *priv, int ap);
14void orinoco_uncache_fw(struct orinoco_private *priv); 15void orinoco_uncache_fw(struct orinoco_private *priv);
16#else
17#define orinoco_cache_fw(priv, ap) do { } while(0)
18#define orinoco_uncache_fw(priv) do { } while (0)
19#endif
15 20
16#endif /* _ORINOCO_FW_H_ */ 21#endif /* _ORINOCO_FW_H_ */
diff --git a/drivers/net/wireless/orinoco/main.c b/drivers/net/wireless/orinoco/main.c
index e9b1db77a735..345593c4accb 100644
--- a/drivers/net/wireless/orinoco/main.c
+++ b/drivers/net/wireless/orinoco/main.c
@@ -2580,8 +2580,10 @@ struct net_device
2580 netif_carrier_off(dev); 2580 netif_carrier_off(dev);
2581 priv->last_linkstatus = 0xffff; 2581 priv->last_linkstatus = 0xffff;
2582 2582
2583#if defined(CONFIG_HERMES_CACHE_FW_ON_INIT) || defined(CONFIG_PM_SLEEP)
2583 priv->cached_pri_fw = NULL; 2584 priv->cached_pri_fw = NULL;
2584 priv->cached_fw = NULL; 2585 priv->cached_fw = NULL;
2586#endif
2585 2587
2586 /* Register PM notifiers */ 2588 /* Register PM notifiers */
2587 orinoco_register_pm_notifier(priv); 2589 orinoco_register_pm_notifier(priv);
diff --git a/drivers/net/wireless/orinoco/orinoco.h b/drivers/net/wireless/orinoco/orinoco.h
index f3f94b28ce6d..8e5a72cc297f 100644
--- a/drivers/net/wireless/orinoco/orinoco.h
+++ b/drivers/net/wireless/orinoco/orinoco.h
@@ -159,9 +159,11 @@ struct orinoco_private {
159 unsigned int tkip_cm_active:1; 159 unsigned int tkip_cm_active:1;
160 unsigned int key_mgmt:3; 160 unsigned int key_mgmt:3;
161 161
162#if defined(CONFIG_HERMES_CACHE_FW_ON_INIT) || defined(CONFIG_PM_SLEEP)
162 /* Cached in memory firmware to use during ->resume. */ 163 /* Cached in memory firmware to use during ->resume. */
163 const struct firmware *cached_pri_fw; 164 const struct firmware *cached_pri_fw;
164 const struct firmware *cached_fw; 165 const struct firmware *cached_fw;
166#endif
165 167
166 struct notifier_block pm_notifier; 168 struct notifier_block pm_notifier;
167}; 169};