diff options
author | Dominik Brodowski <linux@dominikbrodowski.net> | 2010-07-28 03:32:02 -0400 |
---|---|---|
committer | Dominik Brodowski <linux@dominikbrodowski.net> | 2010-08-03 03:04:21 -0400 |
commit | 0f52e86ded65749c6037473013ad77b2afa4f68d (patch) | |
tree | ac5bb89a3d3187d5640e538a5aa9b414ea18a0c5 /drivers | |
parent | ad0c7be28bc7593da43f494f6d074767ea96ca59 (diff) |
pcmcia: do not request windows if you don't need to
Several drivers contained dummy code to request for memory windows,
even though they never made use of it. Remove all such code
snippets.
CC: netdev@vger.kernel.org
CC: linux-wireless@vger.kernel.org
Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/isdn/hisax/sedlbauer_cs.c | 37 | ||||
-rw-r--r-- | drivers/net/wireless/airo_cs.c | 37 | ||||
-rw-r--r-- | drivers/staging/comedi/drivers/ni_daq_700.c | 23 | ||||
-rw-r--r-- | drivers/staging/comedi/drivers/ni_daq_dio24.c | 24 | ||||
-rw-r--r-- | drivers/staging/comedi/drivers/ni_labpc_cs.c | 24 |
5 files changed, 5 insertions, 140 deletions
diff --git a/drivers/isdn/hisax/sedlbauer_cs.c b/drivers/isdn/hisax/sedlbauer_cs.c index 0b06dbb2d52d..a024192b672a 100644 --- a/drivers/isdn/hisax/sedlbauer_cs.c +++ b/drivers/isdn/hisax/sedlbauer_cs.c | |||
@@ -171,8 +171,6 @@ static int sedlbauer_config_check(struct pcmcia_device *p_dev, | |||
171 | unsigned int vcc, | 171 | unsigned int vcc, |
172 | void *priv_data) | 172 | void *priv_data) |
173 | { | 173 | { |
174 | win_req_t *req = priv_data; | ||
175 | |||
176 | if (cfg->index == 0) | 174 | if (cfg->index == 0) |
177 | return -ENODEV; | 175 | return -ENODEV; |
178 | 176 | ||
@@ -219,31 +217,6 @@ static int sedlbauer_config_check(struct pcmcia_device *p_dev, | |||
219 | return -ENODEV; | 217 | return -ENODEV; |
220 | } | 218 | } |
221 | 219 | ||
222 | /* | ||
223 | Now set up a common memory window, if needed. There is room | ||
224 | in the struct pcmcia_device structure for one memory window handle, | ||
225 | but if the base addresses need to be saved, or if multiple | ||
226 | windows are needed, the info should go in the private data | ||
227 | structure for this device. | ||
228 | |||
229 | Note that the memory window base is a physical address, and | ||
230 | needs to be mapped to virtual space with ioremap() before it | ||
231 | is used. | ||
232 | */ | ||
233 | if ((cfg->mem.nwin > 0) || (dflt->mem.nwin > 0)) { | ||
234 | cistpl_mem_t *mem = (cfg->mem.nwin) ? &cfg->mem : &dflt->mem; | ||
235 | req->Attributes = WIN_DATA_WIDTH_16|WIN_MEMORY_TYPE_CM; | ||
236 | req->Attributes |= WIN_ENABLE; | ||
237 | req->Base = mem->win[0].host_addr; | ||
238 | req->Size = mem->win[0].len; | ||
239 | req->AccessSpeed = 0; | ||
240 | if (pcmcia_request_window(p_dev, req, &p_dev->win) != 0) | ||
241 | return -ENODEV; | ||
242 | |||
243 | if (pcmcia_map_mem_page(p_dev, p_dev->win, | ||
244 | mem->win[0].card_addr) != 0) | ||
245 | return -ENODEV; | ||
246 | } | ||
247 | return 0; | 220 | return 0; |
248 | } | 221 | } |
249 | 222 | ||
@@ -251,16 +224,11 @@ static int sedlbauer_config_check(struct pcmcia_device *p_dev, | |||
251 | 224 | ||
252 | static int __devinit sedlbauer_config(struct pcmcia_device *link) | 225 | static int __devinit sedlbauer_config(struct pcmcia_device *link) |
253 | { | 226 | { |
254 | win_req_t *req; | ||
255 | int ret; | 227 | int ret; |
256 | IsdnCard_t icard; | 228 | IsdnCard_t icard; |
257 | 229 | ||
258 | dev_dbg(&link->dev, "sedlbauer_config(0x%p)\n", link); | 230 | dev_dbg(&link->dev, "sedlbauer_config(0x%p)\n", link); |
259 | 231 | ||
260 | req = kzalloc(sizeof(win_req_t), GFP_KERNEL); | ||
261 | if (!req) | ||
262 | return -ENOMEM; | ||
263 | |||
264 | /* | 232 | /* |
265 | In this loop, we scan the CIS for configuration table entries, | 233 | In this loop, we scan the CIS for configuration table entries, |
266 | each of which describes a valid card configuration, including | 234 | each of which describes a valid card configuration, including |
@@ -273,7 +241,7 @@ static int __devinit sedlbauer_config(struct pcmcia_device *link) | |||
273 | these things without consulting the CIS, and most client drivers | 241 | these things without consulting the CIS, and most client drivers |
274 | will only use the CIS to fill in implementation-defined details. | 242 | will only use the CIS to fill in implementation-defined details. |
275 | */ | 243 | */ |
276 | ret = pcmcia_loop_config(link, sedlbauer_config_check, req); | 244 | ret = pcmcia_loop_config(link, sedlbauer_config_check, NULL); |
277 | if (ret) | 245 | if (ret) |
278 | goto failed; | 246 | goto failed; |
279 | 247 | ||
@@ -297,9 +265,6 @@ static int __devinit sedlbauer_config(struct pcmcia_device *link) | |||
297 | printk(" & %pR", link->resource[0]); | 265 | printk(" & %pR", link->resource[0]); |
298 | if (link->resource[1]) | 266 | if (link->resource[1]) |
299 | printk(" & %pR", link->resource[1]); | 267 | printk(" & %pR", link->resource[1]); |
300 | if (link->win) | ||
301 | printk(", mem 0x%06lx-0x%06lx", req->Base, | ||
302 | req->Base+req->Size-1); | ||
303 | printk("\n"); | 268 | printk("\n"); |
304 | 269 | ||
305 | icard.para[0] = link->irq; | 270 | icard.para[0] = link->irq; |
diff --git a/drivers/net/wireless/airo_cs.c b/drivers/net/wireless/airo_cs.c index d47672cb4196..9a121a5b787c 100644 --- a/drivers/net/wireless/airo_cs.c +++ b/drivers/net/wireless/airo_cs.c | |||
@@ -154,8 +154,6 @@ static int airo_cs_config_check(struct pcmcia_device *p_dev, | |||
154 | unsigned int vcc, | 154 | unsigned int vcc, |
155 | void *priv_data) | 155 | void *priv_data) |
156 | { | 156 | { |
157 | win_req_t *req = priv_data; | ||
158 | |||
159 | if (cfg->index == 0) | 157 | if (cfg->index == 0) |
160 | return -ENODEV; | 158 | return -ENODEV; |
161 | 159 | ||
@@ -194,29 +192,6 @@ static int airo_cs_config_check(struct pcmcia_device *p_dev, | |||
194 | if (pcmcia_request_io(p_dev) != 0) | 192 | if (pcmcia_request_io(p_dev) != 0) |
195 | return -ENODEV; | 193 | return -ENODEV; |
196 | 194 | ||
197 | /* | ||
198 | Now set up a common memory window, if needed. There is room | ||
199 | in the struct pcmcia_device structure for one memory window handle, | ||
200 | but if the base addresses need to be saved, or if multiple | ||
201 | windows are needed, the info should go in the private data | ||
202 | structure for this device. | ||
203 | |||
204 | Note that the memory window base is a physical address, and | ||
205 | needs to be mapped to virtual space with ioremap() before it | ||
206 | is used. | ||
207 | */ | ||
208 | if ((cfg->mem.nwin > 0) || (dflt->mem.nwin > 0)) { | ||
209 | cistpl_mem_t *mem = (cfg->mem.nwin) ? &cfg->mem : &dflt->mem; | ||
210 | req->Attributes = WIN_DATA_WIDTH_16|WIN_MEMORY_TYPE_CM; | ||
211 | req->Base = mem->win[0].host_addr; | ||
212 | req->Size = mem->win[0].len; | ||
213 | req->AccessSpeed = 0; | ||
214 | if (pcmcia_request_window(p_dev, req, &p_dev->win) != 0) | ||
215 | return -ENODEV; | ||
216 | if (pcmcia_map_mem_page(p_dev, p_dev->win, | ||
217 | mem->win[0].card_addr) != 0) | ||
218 | return -ENODEV; | ||
219 | } | ||
220 | /* If we got this far, we're cool! */ | 195 | /* If we got this far, we're cool! */ |
221 | return 0; | 196 | return 0; |
222 | } | 197 | } |
@@ -225,17 +200,12 @@ static int airo_cs_config_check(struct pcmcia_device *p_dev, | |||
225 | static int airo_config(struct pcmcia_device *link) | 200 | static int airo_config(struct pcmcia_device *link) |
226 | { | 201 | { |
227 | local_info_t *dev; | 202 | local_info_t *dev; |
228 | win_req_t *req; | ||
229 | int ret; | 203 | int ret; |
230 | 204 | ||
231 | dev = link->priv; | 205 | dev = link->priv; |
232 | 206 | ||
233 | dev_dbg(&link->dev, "airo_config\n"); | 207 | dev_dbg(&link->dev, "airo_config\n"); |
234 | 208 | ||
235 | req = kzalloc(sizeof(win_req_t), GFP_KERNEL); | ||
236 | if (!req) | ||
237 | return -ENOMEM; | ||
238 | |||
239 | /* | 209 | /* |
240 | * In this loop, we scan the CIS for configuration table | 210 | * In this loop, we scan the CIS for configuration table |
241 | * entries, each of which describes a valid card | 211 | * entries, each of which describes a valid card |
@@ -250,7 +220,7 @@ static int airo_config(struct pcmcia_device *link) | |||
250 | * and most client drivers will only use the CIS to fill in | 220 | * and most client drivers will only use the CIS to fill in |
251 | * implementation-defined details. | 221 | * implementation-defined details. |
252 | */ | 222 | */ |
253 | ret = pcmcia_loop_config(link, airo_cs_config_check, req); | 223 | ret = pcmcia_loop_config(link, airo_cs_config_check, NULL); |
254 | if (ret) | 224 | if (ret) |
255 | goto failed; | 225 | goto failed; |
256 | 226 | ||
@@ -281,16 +251,11 @@ static int airo_config(struct pcmcia_device *link) | |||
281 | printk(" & %pR", link->resource[0]); | 251 | printk(" & %pR", link->resource[0]); |
282 | if (link->resource[1]) | 252 | if (link->resource[1]) |
283 | printk(" & %pR", link->resource[1]); | 253 | printk(" & %pR", link->resource[1]); |
284 | if (link->win) | ||
285 | printk(", mem 0x%06lx-0x%06lx", req->Base, | ||
286 | req->Base+req->Size-1); | ||
287 | printk("\n"); | 254 | printk("\n"); |
288 | kfree(req); | ||
289 | return 0; | 255 | return 0; |
290 | 256 | ||
291 | failed: | 257 | failed: |
292 | airo_release(link); | 258 | airo_release(link); |
293 | kfree(req); | ||
294 | return -ENODEV; | 259 | return -ENODEV; |
295 | } /* airo_config */ | 260 | } /* airo_config */ |
296 | 261 | ||
diff --git a/drivers/staging/comedi/drivers/ni_daq_700.c b/drivers/staging/comedi/drivers/ni_daq_700.c index abaa40b8be7e..bf2e84aa03ea 100644 --- a/drivers/staging/comedi/drivers/ni_daq_700.c +++ b/drivers/staging/comedi/drivers/ni_daq_700.c | |||
@@ -555,8 +555,6 @@ static int dio700_pcmcia_config_loop(struct pcmcia_device *p_dev, | |||
555 | unsigned int vcc, | 555 | unsigned int vcc, |
556 | void *priv_data) | 556 | void *priv_data) |
557 | { | 557 | { |
558 | win_req_t *req = priv_data; | ||
559 | |||
560 | if (cfg->index == 0) | 558 | if (cfg->index == 0) |
561 | return -ENODEV; | 559 | return -ENODEV; |
562 | 560 | ||
@@ -589,22 +587,6 @@ static int dio700_pcmcia_config_loop(struct pcmcia_device *p_dev, | |||
589 | return -ENODEV; | 587 | return -ENODEV; |
590 | } | 588 | } |
591 | 589 | ||
592 | if ((cfg->mem.nwin > 0) || (dflt->mem.nwin > 0)) { | ||
593 | cistpl_mem_t *mem = | ||
594 | (cfg->mem.nwin) ? &cfg->mem : &dflt->mem; | ||
595 | req->Attributes = WIN_DATA_WIDTH_16 | WIN_MEMORY_TYPE_CM; | ||
596 | req->Attributes |= WIN_ENABLE; | ||
597 | req->Base = mem->win[0].host_addr; | ||
598 | req->Size = mem->win[0].len; | ||
599 | if (req->Size < 0x1000) | ||
600 | req->Size = 0x1000; | ||
601 | req->AccessSpeed = 0; | ||
602 | if (pcmcia_request_window(p_dev, req, &p_dev->win)) | ||
603 | return -ENODEV; | ||
604 | if (pcmcia_map_mem_page(p_dev, p_dev->win, | ||
605 | mem->win[0].card_addr)) | ||
606 | return -ENODEV; | ||
607 | } | ||
608 | /* If we got this far, we're cool! */ | 590 | /* If we got this far, we're cool! */ |
609 | return 0; | 591 | return 0; |
610 | } | 592 | } |
@@ -618,7 +600,7 @@ static void dio700_config(struct pcmcia_device *link) | |||
618 | 600 | ||
619 | dev_dbg(&link->dev, "dio700_config\n"); | 601 | dev_dbg(&link->dev, "dio700_config\n"); |
620 | 602 | ||
621 | ret = pcmcia_loop_config(link, dio700_pcmcia_config_loop, &req); | 603 | ret = pcmcia_loop_config(link, dio700_pcmcia_config_loop, NULL); |
622 | if (ret) { | 604 | if (ret) { |
623 | dev_warn(&link->dev, "no configuration found\n"); | 605 | dev_warn(&link->dev, "no configuration found\n"); |
624 | goto failed; | 606 | goto failed; |
@@ -644,9 +626,6 @@ static void dio700_config(struct pcmcia_device *link) | |||
644 | printk(", io %pR", link->resource[0]); | 626 | printk(", io %pR", link->resource[0]); |
645 | if (link->resource[1]) | 627 | if (link->resource[1]) |
646 | printk(" & %pR", link->resource[1]); | 628 | printk(" & %pR", link->resource[1]); |
647 | if (link->win) | ||
648 | printk(", mem 0x%06lx-0x%06lx", req.Base, | ||
649 | req.Base + req.Size - 1); | ||
650 | printk("\n"); | 629 | printk("\n"); |
651 | 630 | ||
652 | return; | 631 | return; |
diff --git a/drivers/staging/comedi/drivers/ni_daq_dio24.c b/drivers/staging/comedi/drivers/ni_daq_dio24.c index caccece20855..9112e70cc856 100644 --- a/drivers/staging/comedi/drivers/ni_daq_dio24.c +++ b/drivers/staging/comedi/drivers/ni_daq_dio24.c | |||
@@ -307,8 +307,6 @@ static int dio24_pcmcia_config_loop(struct pcmcia_device *p_dev, | |||
307 | unsigned int vcc, | 307 | unsigned int vcc, |
308 | void *priv_data) | 308 | void *priv_data) |
309 | { | 309 | { |
310 | win_req_t *req = priv_data; | ||
311 | |||
312 | if (cfg->index == 0) | 310 | if (cfg->index == 0) |
313 | return -ENODEV; | 311 | return -ENODEV; |
314 | 312 | ||
@@ -341,22 +339,6 @@ static int dio24_pcmcia_config_loop(struct pcmcia_device *p_dev, | |||
341 | return -ENODEV; | 339 | return -ENODEV; |
342 | } | 340 | } |
343 | 341 | ||
344 | if ((cfg->mem.nwin > 0) || (dflt->mem.nwin > 0)) { | ||
345 | cistpl_mem_t *mem = | ||
346 | (cfg->mem.nwin) ? &cfg->mem : &dflt->mem; | ||
347 | req->Attributes = WIN_DATA_WIDTH_16 | WIN_MEMORY_TYPE_CM; | ||
348 | req->Attributes |= WIN_ENABLE; | ||
349 | req->Base = mem->win[0].host_addr; | ||
350 | req->Size = mem->win[0].len; | ||
351 | if (req->Size < 0x1000) | ||
352 | req->Size = 0x1000; | ||
353 | req->AccessSpeed = 0; | ||
354 | if (pcmcia_request_window(p_dev, req, &p_dev->win)) | ||
355 | return -ENODEV; | ||
356 | if (pcmcia_map_mem_page(p_dev, p_dev->win, | ||
357 | mem->win[0].card_addr)) | ||
358 | return -ENODEV; | ||
359 | } | ||
360 | /* If we got this far, we're cool! */ | 342 | /* If we got this far, we're cool! */ |
361 | return 0; | 343 | return 0; |
362 | } | 344 | } |
@@ -364,13 +346,12 @@ static int dio24_pcmcia_config_loop(struct pcmcia_device *p_dev, | |||
364 | static void dio24_config(struct pcmcia_device *link) | 346 | static void dio24_config(struct pcmcia_device *link) |
365 | { | 347 | { |
366 | int ret; | 348 | int ret; |
367 | win_req_t req; | ||
368 | 349 | ||
369 | printk(KERN_INFO "ni_daq_dio24: HOLA SOY YO! - config\n"); | 350 | printk(KERN_INFO "ni_daq_dio24: HOLA SOY YO! - config\n"); |
370 | 351 | ||
371 | dev_dbg(&link->dev, "dio24_config\n"); | 352 | dev_dbg(&link->dev, "dio24_config\n"); |
372 | 353 | ||
373 | ret = pcmcia_loop_config(link, dio24_pcmcia_config_loop, &req); | 354 | ret = pcmcia_loop_config(link, dio24_pcmcia_config_loop, NULL); |
374 | if (ret) { | 355 | if (ret) { |
375 | dev_warn(&link->dev, "no configuration found\n"); | 356 | dev_warn(&link->dev, "no configuration found\n"); |
376 | goto failed; | 357 | goto failed; |
@@ -396,9 +377,6 @@ static void dio24_config(struct pcmcia_device *link) | |||
396 | printk(" & %pR", link->resource[0]); | 377 | printk(" & %pR", link->resource[0]); |
397 | if (link->resource[1]) | 378 | if (link->resource[1]) |
398 | printk(" & %pR", link->resource[1]); | 379 | printk(" & %pR", link->resource[1]); |
399 | if (link->win) | ||
400 | printk(", mem 0x%06lx-0x%06lx", req.Base, | ||
401 | req.Base + req.Size - 1); | ||
402 | printk("\n"); | 380 | printk("\n"); |
403 | 381 | ||
404 | return; | 382 | return; |
diff --git a/drivers/staging/comedi/drivers/ni_labpc_cs.c b/drivers/staging/comedi/drivers/ni_labpc_cs.c index 94d9f7fe6f2c..f204961e0786 100644 --- a/drivers/staging/comedi/drivers/ni_labpc_cs.c +++ b/drivers/staging/comedi/drivers/ni_labpc_cs.c | |||
@@ -285,8 +285,6 @@ static int labpc_pcmcia_config_loop(struct pcmcia_device *p_dev, | |||
285 | unsigned int vcc, | 285 | unsigned int vcc, |
286 | void *priv_data) | 286 | void *priv_data) |
287 | { | 287 | { |
288 | win_req_t *req = priv_data; | ||
289 | |||
290 | if (cfg->index == 0) | 288 | if (cfg->index == 0) |
291 | return -ENODEV; | 289 | return -ENODEV; |
292 | 290 | ||
@@ -319,22 +317,6 @@ static int labpc_pcmcia_config_loop(struct pcmcia_device *p_dev, | |||
319 | return -ENODEV; | 317 | return -ENODEV; |
320 | } | 318 | } |
321 | 319 | ||
322 | if ((cfg->mem.nwin > 0) || (dflt->mem.nwin > 0)) { | ||
323 | cistpl_mem_t *mem = | ||
324 | (cfg->mem.nwin) ? &cfg->mem : &dflt->mem; | ||
325 | req->Attributes = WIN_DATA_WIDTH_16 | WIN_MEMORY_TYPE_CM; | ||
326 | req->Attributes |= WIN_ENABLE; | ||
327 | req->Base = mem->win[0].host_addr; | ||
328 | req->Size = mem->win[0].len; | ||
329 | if (req->Size < 0x1000) | ||
330 | req->Size = 0x1000; | ||
331 | req->AccessSpeed = 0; | ||
332 | if (pcmcia_request_window(p_dev, req, &p_dev->win)) | ||
333 | return -ENODEV; | ||
334 | if (pcmcia_map_mem_page(p_dev, p_dev->win, | ||
335 | mem->win[0].card_addr)) | ||
336 | return -ENODEV; | ||
337 | } | ||
338 | /* If we got this far, we're cool! */ | 320 | /* If we got this far, we're cool! */ |
339 | return 0; | 321 | return 0; |
340 | } | 322 | } |
@@ -343,11 +325,10 @@ static int labpc_pcmcia_config_loop(struct pcmcia_device *p_dev, | |||
343 | static void labpc_config(struct pcmcia_device *link) | 325 | static void labpc_config(struct pcmcia_device *link) |
344 | { | 326 | { |
345 | int ret; | 327 | int ret; |
346 | win_req_t req; | ||
347 | 328 | ||
348 | dev_dbg(&link->dev, "labpc_config\n"); | 329 | dev_dbg(&link->dev, "labpc_config\n"); |
349 | 330 | ||
350 | ret = pcmcia_loop_config(link, labpc_pcmcia_config_loop, &req); | 331 | ret = pcmcia_loop_config(link, labpc_pcmcia_config_loop, NULL); |
351 | if (ret) { | 332 | if (ret) { |
352 | dev_warn(&link->dev, "no configuration found\n"); | 333 | dev_warn(&link->dev, "no configuration found\n"); |
353 | goto failed; | 334 | goto failed; |
@@ -373,9 +354,6 @@ static void labpc_config(struct pcmcia_device *link) | |||
373 | printk(" & %pR", link->resource[0]); | 354 | printk(" & %pR", link->resource[0]); |
374 | if (link->resource[1]) | 355 | if (link->resource[1]) |
375 | printk(" & %pR", link->resource[1]); | 356 | printk(" & %pR", link->resource[1]); |
376 | if (link->win) | ||
377 | printk(", mem 0x%06lx-0x%06lx", req.Base, | ||
378 | req.Base + req.Size - 1); | ||
379 | printk("\n"); | 357 | printk("\n"); |
380 | 358 | ||
381 | return; | 359 | return; |