aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/net/wireless/airo_cs.c48
-rw-r--r--drivers/net/wireless/atmel_cs.c46
-rw-r--r--drivers/net/wireless/hostap/hostap_cs.c23
-rw-r--r--drivers/net/wireless/netwave_cs.c88
-rw-r--r--drivers/net/wireless/orinoco/orinoco_cs.c27
-rw-r--r--drivers/net/wireless/orinoco/spectrum_cs.c54
-rw-r--r--drivers/net/wireless/wavelan_cs.c24
-rw-r--r--drivers/net/wireless/wl3501_cs.c67
8 files changed, 136 insertions, 241 deletions
diff --git a/drivers/net/wireless/airo_cs.c b/drivers/net/wireless/airo_cs.c
index d0593ed9170e..a1b84fc48afd 100644
--- a/drivers/net/wireless/airo_cs.c
+++ b/drivers/net/wireless/airo_cs.c
@@ -43,21 +43,6 @@
43 43
44#include "airo.h" 44#include "airo.h"
45 45
46/*
47 All the PCMCIA modules use PCMCIA_DEBUG to control debugging. If
48 you do not define PCMCIA_DEBUG at all, all the debug code will be
49 left out. If you compile with PCMCIA_DEBUG=0, the debug code will
50 be present but disabled -- but it can then be enabled for specific
51 modules at load time with a 'pc_debug=#' option to insmod.
52*/
53#ifdef PCMCIA_DEBUG
54static int pc_debug = PCMCIA_DEBUG;
55module_param(pc_debug, int, 0);
56static char *version = "$Revision: 1.2 $";
57#define DEBUG(n, args...) if (pc_debug > (n)) printk(KERN_DEBUG args);
58#else
59#define DEBUG(n, args...)
60#endif
61 46
62/*====================================================================*/ 47/*====================================================================*/
63 48
@@ -145,7 +130,7 @@ static int airo_probe(struct pcmcia_device *p_dev)
145{ 130{
146 local_info_t *local; 131 local_info_t *local;
147 132
148 DEBUG(0, "airo_attach()\n"); 133 dev_dbg(&p_dev->dev, "airo_attach()\n");
149 134
150 /* Interrupt setup */ 135 /* Interrupt setup */
151 p_dev->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING; 136 p_dev->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING;
@@ -184,7 +169,7 @@ static int airo_probe(struct pcmcia_device *p_dev)
184 169
185static void airo_detach(struct pcmcia_device *link) 170static void airo_detach(struct pcmcia_device *link)
186{ 171{
187 DEBUG(0, "airo_detach(0x%p)\n", link); 172 dev_dbg(&link->dev, "airo_detach\n");
188 173
189 airo_release(link); 174 airo_release(link);
190 175
@@ -204,9 +189,6 @@ static void airo_detach(struct pcmcia_device *link)
204 189
205 ======================================================================*/ 190 ======================================================================*/
206 191
207#define CS_CHECK(fn, ret) \
208do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0)
209
210static int airo_cs_config_check(struct pcmcia_device *p_dev, 192static int airo_cs_config_check(struct pcmcia_device *p_dev,
211 cistpl_cftable_entry_t *cfg, 193 cistpl_cftable_entry_t *cfg,
212 cistpl_cftable_entry_t *dflt, 194 cistpl_cftable_entry_t *dflt,
@@ -291,11 +273,11 @@ static int airo_config(struct pcmcia_device *link)
291{ 273{
292 local_info_t *dev; 274 local_info_t *dev;
293 win_req_t *req; 275 win_req_t *req;
294 int last_fn, last_ret; 276 int ret;
295 277
296 dev = link->priv; 278 dev = link->priv;
297 279
298 DEBUG(0, "airo_config(0x%p)\n", link); 280 dev_dbg(&link->dev, "airo_config\n");
299 281
300 req = kzalloc(sizeof(win_req_t), GFP_KERNEL); 282 req = kzalloc(sizeof(win_req_t), GFP_KERNEL);
301 if (!req) 283 if (!req)
@@ -315,8 +297,8 @@ static int airo_config(struct pcmcia_device *link)
315 * and most client drivers will only use the CIS to fill in 297 * and most client drivers will only use the CIS to fill in
316 * implementation-defined details. 298 * implementation-defined details.
317 */ 299 */
318 last_ret = pcmcia_loop_config(link, airo_cs_config_check, req); 300 ret = pcmcia_loop_config(link, airo_cs_config_check, req);
319 if (last_ret) 301 if (ret)
320 goto failed; 302 goto failed;
321 303
322 /* 304 /*
@@ -324,21 +306,25 @@ static int airo_config(struct pcmcia_device *link)
324 handler to the interrupt, unless the 'Handler' member of the 306 handler to the interrupt, unless the 'Handler' member of the
325 irq structure is initialized. 307 irq structure is initialized.
326 */ 308 */
327 if (link->conf.Attributes & CONF_ENABLE_IRQ) 309 if (link->conf.Attributes & CONF_ENABLE_IRQ) {
328 CS_CHECK(RequestIRQ, pcmcia_request_irq(link, &link->irq)); 310 ret = pcmcia_request_irq(link, &link->irq);
311 if (ret)
312 goto failed;
313 }
329 314
330 /* 315 /*
331 This actually configures the PCMCIA socket -- setting up 316 This actually configures the PCMCIA socket -- setting up
332 the I/O windows and the interrupt mapping, and putting the 317 the I/O windows and the interrupt mapping, and putting the
333 card and host interface into "Memory and IO" mode. 318 card and host interface into "Memory and IO" mode.
334 */ 319 */
335 CS_CHECK(RequestConfiguration, 320 ret = pcmcia_request_configuration(link, &link->conf);
336 pcmcia_request_configuration(link, &link->conf)); 321 if (ret)
322 goto failed;
337 ((local_info_t *)link->priv)->eth_dev = 323 ((local_info_t *)link->priv)->eth_dev =
338 init_airo_card(link->irq.AssignedIRQ, 324 init_airo_card(link->irq.AssignedIRQ,
339 link->io.BasePort1, 1, &handle_to_dev(link)); 325 link->io.BasePort1, 1, &handle_to_dev(link));
340 if (!((local_info_t *)link->priv)->eth_dev) 326 if (!((local_info_t *)link->priv)->eth_dev)
341 goto cs_failed; 327 goto failed;
342 328
343 /* 329 /*
344 At this point, the dev_node_t structure(s) need to be 330 At this point, the dev_node_t structure(s) need to be
@@ -368,8 +354,6 @@ static int airo_config(struct pcmcia_device *link)
368 kfree(req); 354 kfree(req);
369 return 0; 355 return 0;
370 356
371 cs_failed:
372 cs_error(link, last_fn, last_ret);
373 failed: 357 failed:
374 airo_release(link); 358 airo_release(link);
375 kfree(req); 359 kfree(req);
@@ -386,7 +370,7 @@ static int airo_config(struct pcmcia_device *link)
386 370
387static void airo_release(struct pcmcia_device *link) 371static void airo_release(struct pcmcia_device *link)
388{ 372{
389 DEBUG(0, "airo_release(0x%p)\n", link); 373 dev_dbg(&link->dev, "airo_release\n");
390 pcmcia_disable_device(link); 374 pcmcia_disable_device(link);
391} 375}
392 376
diff --git a/drivers/net/wireless/atmel_cs.c b/drivers/net/wireless/atmel_cs.c
index ddaa859c3491..78385722a768 100644
--- a/drivers/net/wireless/atmel_cs.c
+++ b/drivers/net/wireless/atmel_cs.c
@@ -55,22 +55,6 @@
55 55
56#include "atmel.h" 56#include "atmel.h"
57 57
58/*
59 All the PCMCIA modules use PCMCIA_DEBUG to control debugging. If
60 you do not define PCMCIA_DEBUG at all, all the debug code will be
61 left out. If you compile with PCMCIA_DEBUG=0, the debug code will
62 be present but disabled -- but it can then be enabled for specific
63 modules at load time with a 'pc_debug=#' option to insmod.
64*/
65
66#ifdef PCMCIA_DEBUG
67static int pc_debug = PCMCIA_DEBUG;
68module_param(pc_debug, int, 0);
69static char *version = "$Revision: 1.2 $";
70#define DEBUG(n, args...) if (pc_debug>(n)) printk(KERN_DEBUG args);
71#else
72#define DEBUG(n, args...)
73#endif
74 58
75/*====================================================================*/ 59/*====================================================================*/
76 60
@@ -155,7 +139,7 @@ static int atmel_probe(struct pcmcia_device *p_dev)
155{ 139{
156 local_info_t *local; 140 local_info_t *local;
157 141
158 DEBUG(0, "atmel_attach()\n"); 142 dev_dbg(&p_dev->dev, "atmel_attach()\n");
159 143
160 /* Interrupt setup */ 144 /* Interrupt setup */
161 p_dev->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING; 145 p_dev->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING;
@@ -194,7 +178,7 @@ static int atmel_probe(struct pcmcia_device *p_dev)
194 178
195static void atmel_detach(struct pcmcia_device *link) 179static void atmel_detach(struct pcmcia_device *link)
196{ 180{
197 DEBUG(0, "atmel_detach(0x%p)\n", link); 181 dev_dbg(&link->dev, "atmel_detach\n");
198 182
199 atmel_release(link); 183 atmel_release(link);
200 184
@@ -209,9 +193,6 @@ static void atmel_detach(struct pcmcia_device *link)
209 193
210 ======================================================================*/ 194 ======================================================================*/
211 195
212#define CS_CHECK(fn, ret) \
213do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0)
214
215/* Call-back function to interrogate PCMCIA-specific information 196/* Call-back function to interrogate PCMCIA-specific information
216 about the current existance of the card */ 197 about the current existance of the card */
217static int card_present(void *arg) 198static int card_present(void *arg)
@@ -275,13 +256,13 @@ static int atmel_config_check(struct pcmcia_device *p_dev,
275static int atmel_config(struct pcmcia_device *link) 256static int atmel_config(struct pcmcia_device *link)
276{ 257{
277 local_info_t *dev; 258 local_info_t *dev;
278 int last_fn, last_ret; 259 int ret;
279 struct pcmcia_device_id *did; 260 struct pcmcia_device_id *did;
280 261
281 dev = link->priv; 262 dev = link->priv;
282 did = dev_get_drvdata(&handle_to_dev(link)); 263 did = dev_get_drvdata(&handle_to_dev(link));
283 264
284 DEBUG(0, "atmel_config(0x%p)\n", link); 265 dev_dbg(&link->dev, "atmel_config\n");
285 266
286 /* 267 /*
287 In this loop, we scan the CIS for configuration table entries, 268 In this loop, we scan the CIS for configuration table entries,
@@ -303,20 +284,25 @@ static int atmel_config(struct pcmcia_device *link)
303 handler to the interrupt, unless the 'Handler' member of the 284 handler to the interrupt, unless the 'Handler' member of the
304 irq structure is initialized. 285 irq structure is initialized.
305 */ 286 */
306 if (link->conf.Attributes & CONF_ENABLE_IRQ) 287 if (link->conf.Attributes & CONF_ENABLE_IRQ) {
307 CS_CHECK(RequestIRQ, pcmcia_request_irq(link, &link->irq)); 288 ret = pcmcia_request_irq(link, &link->irq);
289 if (ret)
290 goto failed;
291 }
308 292
309 /* 293 /*
310 This actually configures the PCMCIA socket -- setting up 294 This actually configures the PCMCIA socket -- setting up
311 the I/O windows and the interrupt mapping, and putting the 295 the I/O windows and the interrupt mapping, and putting the
312 card and host interface into "Memory and IO" mode. 296 card and host interface into "Memory and IO" mode.
313 */ 297 */
314 CS_CHECK(RequestConfiguration, pcmcia_request_configuration(link, &link->conf)); 298 ret = pcmcia_request_configuration(link, &link->conf);
299 if (ret)
300 goto failed;
315 301
316 if (link->irq.AssignedIRQ == 0) { 302 if (link->irq.AssignedIRQ == 0) {
317 printk(KERN_ALERT 303 printk(KERN_ALERT
318 "atmel: cannot assign IRQ: check that CONFIG_ISA is set in kernel config."); 304 "atmel: cannot assign IRQ: check that CONFIG_ISA is set in kernel config.");
319 goto cs_failed; 305 goto failed;
320 } 306 }
321 307
322 ((local_info_t*)link->priv)->eth_dev = 308 ((local_info_t*)link->priv)->eth_dev =
@@ -327,7 +313,7 @@ static int atmel_config(struct pcmcia_device *link)
327 card_present, 313 card_present,
328 link); 314 link);
329 if (!((local_info_t*)link->priv)->eth_dev) 315 if (!((local_info_t*)link->priv)->eth_dev)
330 goto cs_failed; 316 goto failed;
331 317
332 318
333 /* 319 /*
@@ -340,8 +326,6 @@ static int atmel_config(struct pcmcia_device *link)
340 326
341 return 0; 327 return 0;
342 328
343 cs_failed:
344 cs_error(link, last_fn, last_ret);
345 failed: 329 failed:
346 atmel_release(link); 330 atmel_release(link);
347 return -ENODEV; 331 return -ENODEV;
@@ -359,7 +343,7 @@ static void atmel_release(struct pcmcia_device *link)
359{ 343{
360 struct net_device *dev = ((local_info_t*)link->priv)->eth_dev; 344 struct net_device *dev = ((local_info_t*)link->priv)->eth_dev;
361 345
362 DEBUG(0, "atmel_release(0x%p)\n", link); 346 dev_dbg(&link->dev, "atmel_release\n");
363 347
364 if (dev) 348 if (dev)
365 stop_atmel_card(dev); 349 stop_atmel_card(dev);
diff --git a/drivers/net/wireless/hostap/hostap_cs.c b/drivers/net/wireless/hostap/hostap_cs.c
index 31b60dd87bfe..ca3ab849ac03 100644
--- a/drivers/net/wireless/hostap/hostap_cs.c
+++ b/drivers/net/wireless/hostap/hostap_cs.c
@@ -510,10 +510,6 @@ static void prism2_detach(struct pcmcia_device *link)
510} 510}
511 511
512 512
513#define CS_CHECK(fn, ret) \
514do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0)
515
516
517/* run after a CARD_INSERTION event is received to configure the PCMCIA 513/* run after a CARD_INSERTION event is received to configure the PCMCIA
518 * socket and make the device available to the system */ 514 * socket and make the device available to the system */
519 515
@@ -605,7 +601,6 @@ static int prism2_config(struct pcmcia_device *link)
605 struct hostap_interface *iface; 601 struct hostap_interface *iface;
606 local_info_t *local; 602 local_info_t *local;
607 int ret = 1; 603 int ret = 1;
608 int last_fn, last_ret;
609 struct hostap_cs_priv *hw_priv; 604 struct hostap_cs_priv *hw_priv;
610 605
611 PDEBUG(DEBUG_FLOW, "prism2_config()\n"); 606 PDEBUG(DEBUG_FLOW, "prism2_config()\n");
@@ -617,13 +612,12 @@ static int prism2_config(struct pcmcia_device *link)
617 } 612 }
618 613
619 /* Look for an appropriate configuration table entry in the CIS */ 614 /* Look for an appropriate configuration table entry in the CIS */
620 last_ret = pcmcia_loop_config(link, prism2_config_check, NULL); 615 ret = pcmcia_loop_config(link, prism2_config_check, NULL);
621 if (last_ret) { 616 if (ret) {
622 if (!ignore_cis_vcc) 617 if (!ignore_cis_vcc)
623 printk(KERN_ERR "GetNextTuple(): No matching " 618 printk(KERN_ERR "GetNextTuple(): No matching "
624 "CIS configuration. Maybe you need the " 619 "CIS configuration. Maybe you need the "
625 "ignore_cis_vcc=1 parameter.\n"); 620 "ignore_cis_vcc=1 parameter.\n");
626 cs_error(link, RequestIO, last_ret);
627 goto failed; 621 goto failed;
628 } 622 }
629 623
@@ -652,8 +646,9 @@ static int prism2_config(struct pcmcia_device *link)
652 link->irq.IRQInfo1 = IRQ_LEVEL_ID; 646 link->irq.IRQInfo1 = IRQ_LEVEL_ID;
653 link->irq.Handler = prism2_interrupt; 647 link->irq.Handler = prism2_interrupt;
654 link->irq.Instance = dev; 648 link->irq.Instance = dev;
655 CS_CHECK(RequestIRQ, 649 ret = pcmcia_request_irq(link, &link->irq);
656 pcmcia_request_irq(link, &link->irq)); 650 if (ret)
651 goto failed;
657 } 652 }
658 653
659 /* 654 /*
@@ -661,8 +656,9 @@ static int prism2_config(struct pcmcia_device *link)
661 * the I/O windows and the interrupt mapping, and putting the 656 * the I/O windows and the interrupt mapping, and putting the
662 * card and host interface into "Memory and IO" mode. 657 * card and host interface into "Memory and IO" mode.
663 */ 658 */
664 CS_CHECK(RequestConfiguration, 659 ret = pcmcia_request_configuration(link, &link->conf);
665 pcmcia_request_configuration(link, &link->conf)); 660 if (ret)
661 goto failed;
666 662
667 dev->irq = link->irq.AssignedIRQ; 663 dev->irq = link->irq.AssignedIRQ;
668 dev->base_addr = link->io.BasePort1; 664 dev->base_addr = link->io.BasePort1;
@@ -695,9 +691,6 @@ static int prism2_config(struct pcmcia_device *link)
695 } 691 }
696 return ret; 692 return ret;
697 693
698 cs_failed:
699 cs_error(link, last_fn, last_ret);
700
701 failed: 694 failed:
702 kfree(hw_priv); 695 kfree(hw_priv);
703 prism2_release((u_long)link); 696 prism2_release((u_long)link);
diff --git a/drivers/net/wireless/netwave_cs.c b/drivers/net/wireless/netwave_cs.c
index 9498b46c99a4..cbd85de0c601 100644
--- a/drivers/net/wireless/netwave_cs.c
+++ b/drivers/net/wireless/netwave_cs.c
@@ -145,23 +145,6 @@ static const unsigned int txConfEUD = 0x10; /* Enable Uni-Data packets */
145static const unsigned int txConfKey = 0x02; /* Scramble data packets */ 145static const unsigned int txConfKey = 0x02; /* Scramble data packets */
146static const unsigned int txConfLoop = 0x01; /* Loopback mode */ 146static const unsigned int txConfLoop = 0x01; /* Loopback mode */
147 147
148/*
149 All the PCMCIA modules use PCMCIA_DEBUG to control debugging. If
150 you do not define PCMCIA_DEBUG at all, all the debug code will be
151 left out. If you compile with PCMCIA_DEBUG=0, the debug code will
152 be present but disabled -- but it can then be enabled for specific
153 modules at load time with a 'pc_debug=#' option to insmod.
154*/
155
156#ifdef PCMCIA_DEBUG
157static int pc_debug = PCMCIA_DEBUG;
158module_param(pc_debug, int, 0);
159#define DEBUG(n, args...) if (pc_debug>(n)) printk(KERN_DEBUG args)
160static char *version =
161"netwave_cs.c 0.3.0 Thu Jul 17 14:36:02 1997 (John Markus Bjørndalen)\n";
162#else
163#define DEBUG(n, args...)
164#endif
165 148
166/*====================================================================*/ 149/*====================================================================*/
167 150
@@ -383,7 +366,7 @@ static int netwave_probe(struct pcmcia_device *link)
383 struct net_device *dev; 366 struct net_device *dev;
384 netwave_private *priv; 367 netwave_private *priv;
385 368
386 DEBUG(0, "netwave_attach()\n"); 369 dev_dbg(&link->dev, "netwave_attach()\n");
387 370
388 /* Initialize the struct pcmcia_device structure */ 371 /* Initialize the struct pcmcia_device structure */
389 dev = alloc_etherdev(sizeof(netwave_private)); 372 dev = alloc_etherdev(sizeof(netwave_private));
@@ -438,7 +421,7 @@ static void netwave_detach(struct pcmcia_device *link)
438{ 421{
439 struct net_device *dev = link->priv; 422 struct net_device *dev = link->priv;
440 423
441 DEBUG(0, "netwave_detach(0x%p)\n", link); 424 dev_dbg(&link->dev, "netwave_detach\n");
442 425
443 netwave_release(link); 426 netwave_release(link);
444 427
@@ -725,18 +708,15 @@ static const struct iw_handler_def netwave_handler_def =
725 * 708 *
726 */ 709 */
727 710
728#define CS_CHECK(fn, ret) \
729do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0)
730
731static int netwave_pcmcia_config(struct pcmcia_device *link) { 711static int netwave_pcmcia_config(struct pcmcia_device *link) {
732 struct net_device *dev = link->priv; 712 struct net_device *dev = link->priv;
733 netwave_private *priv = netdev_priv(dev); 713 netwave_private *priv = netdev_priv(dev);
734 int i, j, last_ret, last_fn; 714 int i, j, ret;
735 win_req_t req; 715 win_req_t req;
736 memreq_t mem; 716 memreq_t mem;
737 u_char __iomem *ramBase = NULL; 717 u_char __iomem *ramBase = NULL;
738 718
739 DEBUG(0, "netwave_pcmcia_config(0x%p)\n", link); 719 dev_dbg(&link->dev, "netwave_pcmcia_config\n");
740 720
741 /* 721 /*
742 * Try allocating IO ports. This tries a few fixed addresses. 722 * Try allocating IO ports. This tries a few fixed addresses.
@@ -749,22 +729,24 @@ static int netwave_pcmcia_config(struct pcmcia_device *link) {
749 if (i == 0) 729 if (i == 0)
750 break; 730 break;
751 } 731 }
752 if (i != 0) { 732 if (i != 0)
753 cs_error(link, RequestIO, i);
754 goto failed; 733 goto failed;
755 }
756 734
757 /* 735 /*
758 * Now allocate an interrupt line. Note that this does not 736 * Now allocate an interrupt line. Note that this does not
759 * actually assign a handler to the interrupt. 737 * actually assign a handler to the interrupt.
760 */ 738 */
761 CS_CHECK(RequestIRQ, pcmcia_request_irq(link, &link->irq)); 739 ret = pcmcia_request_irq(link, &link->irq);
740 if (ret)
741 goto failed;
762 742
763 /* 743 /*
764 * This actually configures the PCMCIA socket -- setting up 744 * This actually configures the PCMCIA socket -- setting up
765 * the I/O windows and the interrupt mapping. 745 * the I/O windows and the interrupt mapping.
766 */ 746 */
767 CS_CHECK(RequestConfiguration, pcmcia_request_configuration(link, &link->conf)); 747 ret = pcmcia_request_configuration(link, &link->conf);
748 if (ret)
749 goto failed;
768 750
769 /* 751 /*
770 * Allocate a 32K memory window. Note that the struct pcmcia_device 752 * Allocate a 32K memory window. Note that the struct pcmcia_device
@@ -772,14 +754,18 @@ static int netwave_pcmcia_config(struct pcmcia_device *link) {
772 * device needs several windows, you'll need to keep track of 754 * device needs several windows, you'll need to keep track of
773 * the handles in your private data structure, dev->priv. 755 * the handles in your private data structure, dev->priv.
774 */ 756 */
775 DEBUG(1, "Setting mem speed of %d\n", mem_speed); 757 dev_dbg(&link->dev, "Setting mem speed of %d\n", mem_speed);
776 758
777 req.Attributes = WIN_DATA_WIDTH_8|WIN_MEMORY_TYPE_CM|WIN_ENABLE; 759 req.Attributes = WIN_DATA_WIDTH_8|WIN_MEMORY_TYPE_CM|WIN_ENABLE;
778 req.Base = 0; req.Size = 0x8000; 760 req.Base = 0; req.Size = 0x8000;
779 req.AccessSpeed = mem_speed; 761 req.AccessSpeed = mem_speed;
780 CS_CHECK(RequestWindow, pcmcia_request_window(&link, &req, &link->win)); 762 ret = pcmcia_request_window(&link, &req, &link->win);
763 if (ret)
764 goto failed;
781 mem.CardOffset = 0x20000; mem.Page = 0; 765 mem.CardOffset = 0x20000; mem.Page = 0;
782 CS_CHECK(MapMemPage, pcmcia_map_mem_page(link->win, &mem)); 766 ret = pcmcia_map_mem_page(link->win, &mem);
767 if (ret)
768 goto failed;
783 769
784 /* Store base address of the common window frame */ 770 /* Store base address of the common window frame */
785 ramBase = ioremap(req.Base, 0x8000); 771 ramBase = ioremap(req.Base, 0x8000);
@@ -818,8 +804,6 @@ static int netwave_pcmcia_config(struct pcmcia_device *link) {
818 get_uint16(ramBase + NETWAVE_EREG_ARW+2)); 804 get_uint16(ramBase + NETWAVE_EREG_ARW+2));
819 return 0; 805 return 0;
820 806
821cs_failed:
822 cs_error(link, last_fn, last_ret);
823failed: 807failed:
824 netwave_release(link); 808 netwave_release(link);
825 return -ENODEV; 809 return -ENODEV;
@@ -837,7 +821,7 @@ static void netwave_release(struct pcmcia_device *link)
837 struct net_device *dev = link->priv; 821 struct net_device *dev = link->priv;
838 netwave_private *priv = netdev_priv(dev); 822 netwave_private *priv = netdev_priv(dev);
839 823
840 DEBUG(0, "netwave_release(0x%p)\n", link); 824 dev_dbg(&link->dev, "netwave_release\n");
841 825
842 pcmcia_disable_device(link); 826 pcmcia_disable_device(link);
843 if (link->win) 827 if (link->win)
@@ -892,7 +876,7 @@ static void netwave_reset(struct net_device *dev) {
892 u_char __iomem *ramBase = priv->ramBase; 876 u_char __iomem *ramBase = priv->ramBase;
893 unsigned int iobase = dev->base_addr; 877 unsigned int iobase = dev->base_addr;
894 878
895 DEBUG(0, "netwave_reset: Done with hardware reset\n"); 879 pr_debug("netwave_reset: Done with hardware reset\n");
896 880
897 priv->timeoutCounter = 0; 881 priv->timeoutCounter = 0;
898 882
@@ -988,7 +972,7 @@ static int netwave_hw_xmit(unsigned char* data, int len,
988 972
989 dev->stats.tx_bytes += len; 973 dev->stats.tx_bytes += len;
990 974
991 DEBUG(3, "Transmitting with SPCQ %x SPU %x LIF %x ISPLQ %x\n", 975 pr_debug("Transmitting with SPCQ %x SPU %x LIF %x ISPLQ %x\n",
992 readb(ramBase + NETWAVE_EREG_SPCQ), 976 readb(ramBase + NETWAVE_EREG_SPCQ),
993 readb(ramBase + NETWAVE_EREG_SPU), 977 readb(ramBase + NETWAVE_EREG_SPU),
994 readb(ramBase + NETWAVE_EREG_LIF), 978 readb(ramBase + NETWAVE_EREG_LIF),
@@ -1000,7 +984,7 @@ static int netwave_hw_xmit(unsigned char* data, int len,
1000 MaxData = get_uint16(ramBase + NETWAVE_EREG_TDP+2); 984 MaxData = get_uint16(ramBase + NETWAVE_EREG_TDP+2);
1001 DataOffset = get_uint16(ramBase + NETWAVE_EREG_TDP+4); 985 DataOffset = get_uint16(ramBase + NETWAVE_EREG_TDP+4);
1002 986
1003 DEBUG(3, "TxFreeList %x, MaxData %x, DataOffset %x\n", 987 pr_debug("TxFreeList %x, MaxData %x, DataOffset %x\n",
1004 TxFreeList, MaxData, DataOffset); 988 TxFreeList, MaxData, DataOffset);
1005 989
1006 /* Copy packet to the adapter fragment buffers */ 990 /* Copy packet to the adapter fragment buffers */
@@ -1088,7 +1072,7 @@ static irqreturn_t netwave_interrupt(int irq, void* dev_id)
1088 status = inb(iobase + NETWAVE_REG_ASR); 1072 status = inb(iobase + NETWAVE_REG_ASR);
1089 1073
1090 if (!pcmcia_dev_present(link)) { 1074 if (!pcmcia_dev_present(link)) {
1091 DEBUG(1, "netwave_interrupt: Interrupt with status 0x%x " 1075 pr_debug("netwave_interrupt: Interrupt with status 0x%x "
1092 "from removed or suspended card!\n", status); 1076 "from removed or suspended card!\n", status);
1093 break; 1077 break;
1094 } 1078 }
@@ -1132,7 +1116,7 @@ static irqreturn_t netwave_interrupt(int irq, void* dev_id)
1132 int txStatus; 1116 int txStatus;
1133 1117
1134 txStatus = readb(ramBase + NETWAVE_EREG_TSER); 1118 txStatus = readb(ramBase + NETWAVE_EREG_TSER);
1135 DEBUG(3, "Transmit done. TSER = %x id %x\n", 1119 pr_debug("Transmit done. TSER = %x id %x\n",
1136 txStatus, readb(ramBase + NETWAVE_EREG_TSER + 1)); 1120 txStatus, readb(ramBase + NETWAVE_EREG_TSER + 1));
1137 1121
1138 if (txStatus & 0x20) { 1122 if (txStatus & 0x20) {
@@ -1156,7 +1140,7 @@ static irqreturn_t netwave_interrupt(int irq, void* dev_id)
1156 * TxGU and TxNOAP is set. (Those are the only ones 1140 * TxGU and TxNOAP is set. (Those are the only ones
1157 * to set TxErr). 1141 * to set TxErr).
1158 */ 1142 */
1159 DEBUG(3, "netwave_interrupt: TxDN with error status %x\n", 1143 pr_debug("netwave_interrupt: TxDN with error status %x\n",
1160 txStatus); 1144 txStatus);
1161 1145
1162 /* Clear out TxGU, TxNOAP, TxErr and TxTrys */ 1146 /* Clear out TxGU, TxNOAP, TxErr and TxTrys */
@@ -1164,7 +1148,7 @@ static irqreturn_t netwave_interrupt(int irq, void* dev_id)
1164 writeb(0xdf & txStatus, ramBase+NETWAVE_EREG_TSER+4); 1148 writeb(0xdf & txStatus, ramBase+NETWAVE_EREG_TSER+4);
1165 ++dev->stats.tx_errors; 1149 ++dev->stats.tx_errors;
1166 } 1150 }
1167 DEBUG(3, "New status is TSER %x ASR %x\n", 1151 pr_debug("New status is TSER %x ASR %x\n",
1168 readb(ramBase + NETWAVE_EREG_TSER), 1152 readb(ramBase + NETWAVE_EREG_TSER),
1169 inb(iobase + NETWAVE_REG_ASR)); 1153 inb(iobase + NETWAVE_REG_ASR));
1170 1154
@@ -1172,7 +1156,7 @@ static irqreturn_t netwave_interrupt(int irq, void* dev_id)
1172 } 1156 }
1173 /* TxBA, this would trigger on all error packets received */ 1157 /* TxBA, this would trigger on all error packets received */
1174 /* if (status & 0x01) { 1158 /* if (status & 0x01) {
1175 DEBUG(4, "Transmit buffers available, %x\n", status); 1159 pr_debug("Transmit buffers available, %x\n", status);
1176 } 1160 }
1177 */ 1161 */
1178 } 1162 }
@@ -1190,7 +1174,7 @@ static irqreturn_t netwave_interrupt(int irq, void* dev_id)
1190 */ 1174 */
1191static void netwave_watchdog(struct net_device *dev) { 1175static void netwave_watchdog(struct net_device *dev) {
1192 1176
1193 DEBUG(1, "%s: netwave_watchdog: watchdog timer expired\n", dev->name); 1177 pr_debug("%s: netwave_watchdog: watchdog timer expired\n", dev->name);
1194 netwave_reset(dev); 1178 netwave_reset(dev);
1195 dev->trans_start = jiffies; 1179 dev->trans_start = jiffies;
1196 netif_wake_queue(dev); 1180 netif_wake_queue(dev);
@@ -1211,7 +1195,7 @@ static int netwave_rx(struct net_device *dev)
1211 int i; 1195 int i;
1212 u_char *ptr; 1196 u_char *ptr;
1213 1197
1214 DEBUG(3, "xinw_rx: Receiving ... \n"); 1198 pr_debug("xinw_rx: Receiving ... \n");
1215 1199
1216 /* Receive max 10 packets for now. */ 1200 /* Receive max 10 packets for now. */
1217 for (i = 0; i < 10; i++) { 1201 for (i = 0; i < 10; i++) {
@@ -1237,7 +1221,7 @@ static int netwave_rx(struct net_device *dev)
1237 1221
1238 skb = dev_alloc_skb(rcvLen+5); 1222 skb = dev_alloc_skb(rcvLen+5);
1239 if (skb == NULL) { 1223 if (skb == NULL) {
1240 DEBUG(1, "netwave_rx: Could not allocate an sk_buff of " 1224 pr_debug("netwave_rx: Could not allocate an sk_buff of "
1241 "length %d\n", rcvLen); 1225 "length %d\n", rcvLen);
1242 ++dev->stats.rx_dropped; 1226 ++dev->stats.rx_dropped;
1243 /* Tell the adapter to skip the packet */ 1227 /* Tell the adapter to skip the packet */
@@ -1279,7 +1263,7 @@ static int netwave_rx(struct net_device *dev)
1279 wait_WOC(iobase); 1263 wait_WOC(iobase);
1280 writeb(NETWAVE_CMD_SRP, ramBase + NETWAVE_EREG_CB + 0); 1264 writeb(NETWAVE_CMD_SRP, ramBase + NETWAVE_EREG_CB + 0);
1281 writeb(NETWAVE_CMD_EOC, ramBase + NETWAVE_EREG_CB + 1); 1265 writeb(NETWAVE_CMD_EOC, ramBase + NETWAVE_EREG_CB + 1);
1282 DEBUG(3, "Packet reception ok\n"); 1266 pr_debug("Packet reception ok\n");
1283 } 1267 }
1284 return 0; 1268 return 0;
1285} 1269}
@@ -1288,7 +1272,7 @@ static int netwave_open(struct net_device *dev) {
1288 netwave_private *priv = netdev_priv(dev); 1272 netwave_private *priv = netdev_priv(dev);
1289 struct pcmcia_device *link = priv->p_dev; 1273 struct pcmcia_device *link = priv->p_dev;
1290 1274
1291 DEBUG(1, "netwave_open: starting.\n"); 1275 dev_dbg(&link->dev, "netwave_open: starting.\n");
1292 1276
1293 if (!pcmcia_dev_present(link)) 1277 if (!pcmcia_dev_present(link))
1294 return -ENODEV; 1278 return -ENODEV;
@@ -1305,7 +1289,7 @@ static int netwave_close(struct net_device *dev) {
1305 netwave_private *priv = netdev_priv(dev); 1289 netwave_private *priv = netdev_priv(dev);
1306 struct pcmcia_device *link = priv->p_dev; 1290 struct pcmcia_device *link = priv->p_dev;
1307 1291
1308 DEBUG(1, "netwave_close: finishing.\n"); 1292 dev_dbg(&link->dev, "netwave_close: finishing.\n");
1309 1293
1310 link->open--; 1294 link->open--;
1311 netif_stop_queue(dev); 1295 netif_stop_queue(dev);
@@ -1358,11 +1342,11 @@ static void set_multicast_list(struct net_device *dev)
1358 u_char rcvMode = 0; 1342 u_char rcvMode = 0;
1359 1343
1360#ifdef PCMCIA_DEBUG 1344#ifdef PCMCIA_DEBUG
1361 if (pc_debug > 2) { 1345 {
1362 static int old; 1346 xstatic int old;
1363 if (old != dev->mc_count) { 1347 if (old != dev->mc_count) {
1364 old = dev->mc_count; 1348 old = dev->mc_count;
1365 DEBUG(0, "%s: setting Rx mode to %d addresses.\n", 1349 pr_debug("%s: setting Rx mode to %d addresses.\n",
1366 dev->name, dev->mc_count); 1350 dev->name, dev->mc_count);
1367 } 1351 }
1368 } 1352 }
diff --git a/drivers/net/wireless/orinoco/orinoco_cs.c b/drivers/net/wireless/orinoco/orinoco_cs.c
index 38c1c9d2abb8..da626ec663d0 100644
--- a/drivers/net/wireless/orinoco/orinoco_cs.c
+++ b/drivers/net/wireless/orinoco/orinoco_cs.c
@@ -160,12 +160,6 @@ static void orinoco_cs_detach(struct pcmcia_device *link)
160 * device available to the system. 160 * device available to the system.
161 */ 161 */
162 162
163#define CS_CHECK(fn, ret) do { \
164 last_fn = (fn); \
165 if ((last_ret = (ret)) != 0) \
166 goto cs_failed; \
167} while (0)
168
169static int orinoco_cs_config_check(struct pcmcia_device *p_dev, 163static int orinoco_cs_config_check(struct pcmcia_device *p_dev,
170 cistpl_cftable_entry_t *cfg, 164 cistpl_cftable_entry_t *cfg,
171 cistpl_cftable_entry_t *dflt, 165 cistpl_cftable_entry_t *dflt,
@@ -240,7 +234,7 @@ orinoco_cs_config(struct pcmcia_device *link)
240 struct orinoco_private *priv = link->priv; 234 struct orinoco_private *priv = link->priv;
241 struct orinoco_pccard *card = priv->card; 235 struct orinoco_pccard *card = priv->card;
242 hermes_t *hw = &priv->hw; 236 hermes_t *hw = &priv->hw;
243 int last_fn, last_ret; 237 int ret;
244 void __iomem *mem; 238 void __iomem *mem;
245 239
246 /* 240 /*
@@ -257,13 +251,12 @@ orinoco_cs_config(struct pcmcia_device *link)
257 * and most client drivers will only use the CIS to fill in 251 * and most client drivers will only use the CIS to fill in
258 * implementation-defined details. 252 * implementation-defined details.
259 */ 253 */
260 last_ret = pcmcia_loop_config(link, orinoco_cs_config_check, NULL); 254 ret = pcmcia_loop_config(link, orinoco_cs_config_check, NULL);
261 if (last_ret) { 255 if (ret) {
262 if (!ignore_cis_vcc) 256 if (!ignore_cis_vcc)
263 printk(KERN_ERR PFX "GetNextTuple(): No matching " 257 printk(KERN_ERR PFX "GetNextTuple(): No matching "
264 "CIS configuration. Maybe you need the " 258 "CIS configuration. Maybe you need the "
265 "ignore_cis_vcc=1 parameter.\n"); 259 "ignore_cis_vcc=1 parameter.\n");
266 cs_error(link, RequestIO, last_ret);
267 goto failed; 260 goto failed;
268 } 261 }
269 262
@@ -272,14 +265,16 @@ orinoco_cs_config(struct pcmcia_device *link)
272 * a handler to the interrupt, unless the 'Handler' member of 265 * a handler to the interrupt, unless the 'Handler' member of
273 * the irq structure is initialized. 266 * the irq structure is initialized.
274 */ 267 */
275 CS_CHECK(RequestIRQ, pcmcia_request_irq(link, &link->irq)); 268 ret = pcmcia_request_irq(link, &link->irq);
269 if (ret)
270 goto failed;
276 271
277 /* We initialize the hermes structure before completing PCMCIA 272 /* We initialize the hermes structure before completing PCMCIA
278 * configuration just in case the interrupt handler gets 273 * configuration just in case the interrupt handler gets
279 * called. */ 274 * called. */
280 mem = ioport_map(link->io.BasePort1, link->io.NumPorts1); 275 mem = ioport_map(link->io.BasePort1, link->io.NumPorts1);
281 if (!mem) 276 if (!mem)
282 goto cs_failed; 277 goto failed;
283 278
284 hermes_struct_init(hw, mem, HERMES_16BIT_REGSPACING); 279 hermes_struct_init(hw, mem, HERMES_16BIT_REGSPACING);
285 280
@@ -288,8 +283,9 @@ orinoco_cs_config(struct pcmcia_device *link)
288 * the I/O windows and the interrupt mapping, and putting the 283 * the I/O windows and the interrupt mapping, and putting the
289 * card and host interface into "Memory and IO" mode. 284 * card and host interface into "Memory and IO" mode.
290 */ 285 */
291 CS_CHECK(RequestConfiguration, 286 ret = pcmcia_request_configuration(link, &link->conf);
292 pcmcia_request_configuration(link, &link->conf)); 287 if (ret)
288 goto failed;
293 289
294 /* Ok, we have the configuration, prepare to register the netdev */ 290 /* Ok, we have the configuration, prepare to register the netdev */
295 card->node.major = card->node.minor = 0; 291 card->node.major = card->node.minor = 0;
@@ -315,9 +311,6 @@ orinoco_cs_config(struct pcmcia_device *link)
315 * net_device has been registered */ 311 * net_device has been registered */
316 return 0; 312 return 0;
317 313
318 cs_failed:
319 cs_error(link, last_fn, last_ret);
320
321 failed: 314 failed:
322 orinoco_cs_release(link); 315 orinoco_cs_release(link);
323 return -ENODEV; 316 return -ENODEV;
diff --git a/drivers/net/wireless/orinoco/spectrum_cs.c b/drivers/net/wireless/orinoco/spectrum_cs.c
index c361310b885d..700010e9e346 100644
--- a/drivers/net/wireless/orinoco/spectrum_cs.c
+++ b/drivers/net/wireless/orinoco/spectrum_cs.c
@@ -73,9 +73,6 @@ static void spectrum_cs_release(struct pcmcia_device *link);
73#define HCR_MEM16 0x10 /* memory width bit, should be preserved */ 73#define HCR_MEM16 0x10 /* memory width bit, should be preserved */
74 74
75 75
76#define CS_CHECK(fn, ret) \
77 do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0)
78
79/* 76/*
80 * Reset the card using configuration registers COR and CCSR. 77 * Reset the card using configuration registers COR and CCSR.
81 * If IDLE is 1, stop the firmware, so that it can be safely rewritten. 78 * If IDLE is 1, stop the firmware, so that it can be safely rewritten.
@@ -83,7 +80,7 @@ static void spectrum_cs_release(struct pcmcia_device *link);
83static int 80static int
84spectrum_reset(struct pcmcia_device *link, int idle) 81spectrum_reset(struct pcmcia_device *link, int idle)
85{ 82{
86 int last_ret, last_fn; 83 int ret;
87 conf_reg_t reg; 84 conf_reg_t reg;
88 u_int save_cor; 85 u_int save_cor;
89 86
@@ -95,23 +92,26 @@ spectrum_reset(struct pcmcia_device *link, int idle)
95 reg.Function = 0; 92 reg.Function = 0;
96 reg.Action = CS_READ; 93 reg.Action = CS_READ;
97 reg.Offset = CISREG_COR; 94 reg.Offset = CISREG_COR;
98 CS_CHECK(AccessConfigurationRegister, 95 ret = pcmcia_access_configuration_register(link, &reg);
99 pcmcia_access_configuration_register(link, &reg)); 96 if (ret)
97 goto failed;
100 save_cor = reg.Value; 98 save_cor = reg.Value;
101 99
102 /* Soft-Reset card */ 100 /* Soft-Reset card */
103 reg.Action = CS_WRITE; 101 reg.Action = CS_WRITE;
104 reg.Offset = CISREG_COR; 102 reg.Offset = CISREG_COR;
105 reg.Value = (save_cor | COR_SOFT_RESET); 103 reg.Value = (save_cor | COR_SOFT_RESET);
106 CS_CHECK(AccessConfigurationRegister, 104 ret = pcmcia_access_configuration_register(link, &reg);
107 pcmcia_access_configuration_register(link, &reg)); 105 if (ret)
106 goto failed;
108 udelay(1000); 107 udelay(1000);
109 108
110 /* Read CCSR */ 109 /* Read CCSR */
111 reg.Action = CS_READ; 110 reg.Action = CS_READ;
112 reg.Offset = CISREG_CCSR; 111 reg.Offset = CISREG_CCSR;
113 CS_CHECK(AccessConfigurationRegister, 112 ret = pcmcia_access_configuration_register(link, &reg);
114 pcmcia_access_configuration_register(link, &reg)); 113 if (ret)
114 goto failed;
115 115
116 /* 116 /*
117 * Start or stop the firmware. Memory width bit should be 117 * Start or stop the firmware. Memory width bit should be
@@ -120,21 +120,22 @@ spectrum_reset(struct pcmcia_device *link, int idle)
120 reg.Action = CS_WRITE; 120 reg.Action = CS_WRITE;
121 reg.Offset = CISREG_CCSR; 121 reg.Offset = CISREG_CCSR;
122 reg.Value = (idle ? HCR_IDLE : HCR_RUN) | (reg.Value & HCR_MEM16); 122 reg.Value = (idle ? HCR_IDLE : HCR_RUN) | (reg.Value & HCR_MEM16);
123 CS_CHECK(AccessConfigurationRegister, 123 ret = pcmcia_access_configuration_register(link, &reg);
124 pcmcia_access_configuration_register(link, &reg)); 124 if (ret)
125 goto failed;
125 udelay(1000); 126 udelay(1000);
126 127
127 /* Restore original COR configuration index */ 128 /* Restore original COR configuration index */
128 reg.Action = CS_WRITE; 129 reg.Action = CS_WRITE;
129 reg.Offset = CISREG_COR; 130 reg.Offset = CISREG_COR;
130 reg.Value = (save_cor & ~COR_SOFT_RESET); 131 reg.Value = (save_cor & ~COR_SOFT_RESET);
131 CS_CHECK(AccessConfigurationRegister, 132 ret = pcmcia_access_configuration_register(link, &reg);
132 pcmcia_access_configuration_register(link, &reg)); 133 if (ret)
134 goto failed;
133 udelay(1000); 135 udelay(1000);
134 return 0; 136 return 0;
135 137
136cs_failed: 138failed:
137 cs_error(link, last_fn, last_ret);
138 return -ENODEV; 139 return -ENODEV;
139} 140}
140 141
@@ -307,7 +308,7 @@ spectrum_cs_config(struct pcmcia_device *link)
307 struct orinoco_private *priv = link->priv; 308 struct orinoco_private *priv = link->priv;
308 struct orinoco_pccard *card = priv->card; 309 struct orinoco_pccard *card = priv->card;
309 hermes_t *hw = &priv->hw; 310 hermes_t *hw = &priv->hw;
310 int last_fn, last_ret; 311 int ret;
311 void __iomem *mem; 312 void __iomem *mem;
312 313
313 /* 314 /*
@@ -324,13 +325,12 @@ spectrum_cs_config(struct pcmcia_device *link)
324 * and most client drivers will only use the CIS to fill in 325 * and most client drivers will only use the CIS to fill in
325 * implementation-defined details. 326 * implementation-defined details.
326 */ 327 */
327 last_ret = pcmcia_loop_config(link, spectrum_cs_config_check, NULL); 328 ret = pcmcia_loop_config(link, spectrum_cs_config_check, NULL);
328 if (last_ret) { 329 if (ret) {
329 if (!ignore_cis_vcc) 330 if (!ignore_cis_vcc)
330 printk(KERN_ERR PFX "GetNextTuple(): No matching " 331 printk(KERN_ERR PFX "GetNextTuple(): No matching "
331 "CIS configuration. Maybe you need the " 332 "CIS configuration. Maybe you need the "
332 "ignore_cis_vcc=1 parameter.\n"); 333 "ignore_cis_vcc=1 parameter.\n");
333 cs_error(link, RequestIO, last_ret);
334 goto failed; 334 goto failed;
335 } 335 }
336 336
@@ -339,14 +339,16 @@ spectrum_cs_config(struct pcmcia_device *link)
339 * a handler to the interrupt, unless the 'Handler' member of 339 * a handler to the interrupt, unless the 'Handler' member of
340 * the irq structure is initialized. 340 * the irq structure is initialized.
341 */ 341 */
342 CS_CHECK(RequestIRQ, pcmcia_request_irq(link, &link->irq)); 342 ret = pcmcia_request_irq(link, &link->irq);
343 if (ret)
344 goto failed;
343 345
344 /* We initialize the hermes structure before completing PCMCIA 346 /* We initialize the hermes structure before completing PCMCIA
345 * configuration just in case the interrupt handler gets 347 * configuration just in case the interrupt handler gets
346 * called. */ 348 * called. */
347 mem = ioport_map(link->io.BasePort1, link->io.NumPorts1); 349 mem = ioport_map(link->io.BasePort1, link->io.NumPorts1);
348 if (!mem) 350 if (!mem)
349 goto cs_failed; 351 goto failed;
350 352
351 hermes_struct_init(hw, mem, HERMES_16BIT_REGSPACING); 353 hermes_struct_init(hw, mem, HERMES_16BIT_REGSPACING);
352 354
@@ -355,8 +357,9 @@ spectrum_cs_config(struct pcmcia_device *link)
355 * the I/O windows and the interrupt mapping, and putting the 357 * the I/O windows and the interrupt mapping, and putting the
356 * card and host interface into "Memory and IO" mode. 358 * card and host interface into "Memory and IO" mode.
357 */ 359 */
358 CS_CHECK(RequestConfiguration, 360 ret = pcmcia_request_configuration(link, &link->conf);
359 pcmcia_request_configuration(link, &link->conf)); 361 if (ret)
362 goto failed;
360 363
361 /* Ok, we have the configuration, prepare to register the netdev */ 364 /* Ok, we have the configuration, prepare to register the netdev */
362 card->node.major = card->node.minor = 0; 365 card->node.major = card->node.minor = 0;
@@ -386,9 +389,6 @@ spectrum_cs_config(struct pcmcia_device *link)
386 * net_device has been registered */ 389 * net_device has been registered */
387 return 0; 390 return 0;
388 391
389 cs_failed:
390 cs_error(link, last_fn, last_ret);
391
392 failed: 392 failed:
393 spectrum_cs_release(link); 393 spectrum_cs_release(link);
394 return -ENODEV; 394 return -ENODEV;
diff --git a/drivers/net/wireless/wavelan_cs.c b/drivers/net/wireless/wavelan_cs.c
index 431a20ec6db6..2fad4ac89827 100644
--- a/drivers/net/wireless/wavelan_cs.c
+++ b/drivers/net/wireless/wavelan_cs.c
@@ -3656,10 +3656,7 @@ wv_pcmcia_reset(struct net_device * dev)
3656 3656
3657 i = pcmcia_access_configuration_register(link, &reg); 3657 i = pcmcia_access_configuration_register(link, &reg);
3658 if (i != 0) 3658 if (i != 0)
3659 {
3660 cs_error(link, AccessConfigurationRegister, i);
3661 return FALSE; 3659 return FALSE;
3662 }
3663 3660
3664#ifdef DEBUG_CONFIG_INFO 3661#ifdef DEBUG_CONFIG_INFO
3665 printk(KERN_DEBUG "%s: wavelan_pcmcia_reset(): Config reg is 0x%x\n", 3662 printk(KERN_DEBUG "%s: wavelan_pcmcia_reset(): Config reg is 0x%x\n",
@@ -3670,19 +3667,13 @@ wv_pcmcia_reset(struct net_device * dev)
3670 reg.Value = reg.Value | COR_SW_RESET; 3667 reg.Value = reg.Value | COR_SW_RESET;
3671 i = pcmcia_access_configuration_register(link, &reg); 3668 i = pcmcia_access_configuration_register(link, &reg);
3672 if (i != 0) 3669 if (i != 0)
3673 {
3674 cs_error(link, AccessConfigurationRegister, i);
3675 return FALSE; 3670 return FALSE;
3676 }
3677 3671
3678 reg.Action = CS_WRITE; 3672 reg.Action = CS_WRITE;
3679 reg.Value = COR_LEVEL_IRQ | COR_CONFIG; 3673 reg.Value = COR_LEVEL_IRQ | COR_CONFIG;
3680 i = pcmcia_access_configuration_register(link, &reg); 3674 i = pcmcia_access_configuration_register(link, &reg);
3681 if (i != 0) 3675 if (i != 0)
3682 {
3683 cs_error(link, AccessConfigurationRegister, i);
3684 return FALSE; 3676 return FALSE;
3685 }
3686 3677
3687#ifdef DEBUG_CONFIG_TRACE 3678#ifdef DEBUG_CONFIG_TRACE
3688 printk(KERN_DEBUG "%s: <-wv_pcmcia_reset()\n", dev->name); 3679 printk(KERN_DEBUG "%s: <-wv_pcmcia_reset()\n", dev->name);
@@ -3857,10 +3848,7 @@ wv_pcmcia_config(struct pcmcia_device * link)
3857 { 3848 {
3858 i = pcmcia_request_io(link, &link->io); 3849 i = pcmcia_request_io(link, &link->io);
3859 if (i != 0) 3850 if (i != 0)
3860 {
3861 cs_error(link, RequestIO, i);
3862 break; 3851 break;
3863 }
3864 3852
3865 /* 3853 /*
3866 * Now allocate an interrupt line. Note that this does not 3854 * Now allocate an interrupt line. Note that this does not
@@ -3868,10 +3856,7 @@ wv_pcmcia_config(struct pcmcia_device * link)
3868 */ 3856 */
3869 i = pcmcia_request_irq(link, &link->irq); 3857 i = pcmcia_request_irq(link, &link->irq);
3870 if (i != 0) 3858 if (i != 0)
3871 {
3872 cs_error(link, RequestIRQ, i);
3873 break; 3859 break;
3874 }
3875 3860
3876 /* 3861 /*
3877 * This actually configures the PCMCIA socket -- setting up 3862 * This actually configures the PCMCIA socket -- setting up
@@ -3880,10 +3865,7 @@ wv_pcmcia_config(struct pcmcia_device * link)
3880 link->conf.ConfigIndex = 1; 3865 link->conf.ConfigIndex = 1;
3881 i = pcmcia_request_configuration(link, &link->conf); 3866 i = pcmcia_request_configuration(link, &link->conf);
3882 if (i != 0) 3867 if (i != 0)
3883 {
3884 cs_error(link, RequestConfiguration, i);
3885 break; 3868 break;
3886 }
3887 3869
3888 /* 3870 /*
3889 * Allocate a small memory window. Note that the struct pcmcia_device 3871 * Allocate a small memory window. Note that the struct pcmcia_device
@@ -3896,10 +3878,7 @@ wv_pcmcia_config(struct pcmcia_device * link)
3896 req.AccessSpeed = mem_speed; 3878 req.AccessSpeed = mem_speed;
3897 i = pcmcia_request_window(&link, &req, &link->win); 3879 i = pcmcia_request_window(&link, &req, &link->win);
3898 if (i != 0) 3880 if (i != 0)
3899 {
3900 cs_error(link, RequestWindow, i);
3901 break; 3881 break;
3902 }
3903 3882
3904 lp->mem = ioremap(req.Base, req.Size); 3883 lp->mem = ioremap(req.Base, req.Size);
3905 dev->mem_start = (u_long)lp->mem; 3884 dev->mem_start = (u_long)lp->mem;
@@ -3908,10 +3887,7 @@ wv_pcmcia_config(struct pcmcia_device * link)
3908 mem.CardOffset = 0; mem.Page = 0; 3887 mem.CardOffset = 0; mem.Page = 0;
3909 i = pcmcia_map_mem_page(link->win, &mem); 3888 i = pcmcia_map_mem_page(link->win, &mem);
3910 if (i != 0) 3889 if (i != 0)
3911 {
3912 cs_error(link, MapMemPage, i);
3913 break; 3890 break;
3914 }
3915 3891
3916 /* Feed device with this info... */ 3892 /* Feed device with this info... */
3917 dev->irq = link->irq.AssignedIRQ; 3893 dev->irq = link->irq.AssignedIRQ;
diff --git a/drivers/net/wireless/wl3501_cs.c b/drivers/net/wireless/wl3501_cs.c
index 4f1e0cfe609b..7e8e269b4cb6 100644
--- a/drivers/net/wireless/wl3501_cs.c
+++ b/drivers/net/wireless/wl3501_cs.c
@@ -67,23 +67,7 @@
67/* For rough constant delay */ 67/* For rough constant delay */
68#define WL3501_NOPLOOP(n) { int x = 0; while (x++ < n) slow_down_io(); } 68#define WL3501_NOPLOOP(n) { int x = 0; while (x++ < n) slow_down_io(); }
69 69
70/* 70
71 * All the PCMCIA modules use PCMCIA_DEBUG to control debugging. If you do not
72 * define PCMCIA_DEBUG at all, all the debug code will be left out. If you
73 * compile with PCMCIA_DEBUG=0, the debug code will be present but disabled --
74 * but it can then be enabled for specific modules at load time with a
75 * 'pc_debug=#' option to insmod.
76 */
77#define PCMCIA_DEBUG 0
78#ifdef PCMCIA_DEBUG
79static int pc_debug = PCMCIA_DEBUG;
80module_param(pc_debug, int, 0);
81#define dprintk(n, format, args...) \
82 { if (pc_debug > (n)) \
83 printk(KERN_INFO "%s: " format "\n", __func__ , ##args); }
84#else
85#define dprintk(n, format, args...)
86#endif
87 71
88#define wl3501_outb(a, b) { outb(a, b); slow_down_io(); } 72#define wl3501_outb(a, b) { outb(a, b); slow_down_io(); }
89#define wl3501_outb_p(a, b) { outb_p(a, b); slow_down_io(); } 73#define wl3501_outb_p(a, b) { outb_p(a, b); slow_down_io(); }
@@ -684,10 +668,10 @@ static void wl3501_mgmt_scan_confirm(struct wl3501_card *this, u16 addr)
684 int matchflag = 0; 668 int matchflag = 0;
685 struct wl3501_scan_confirm sig; 669 struct wl3501_scan_confirm sig;
686 670
687 dprintk(3, "entry"); 671 pr_debug("entry");
688 wl3501_get_from_wla(this, addr, &sig, sizeof(sig)); 672 wl3501_get_from_wla(this, addr, &sig, sizeof(sig));
689 if (sig.status == WL3501_STATUS_SUCCESS) { 673 if (sig.status == WL3501_STATUS_SUCCESS) {
690 dprintk(3, "success"); 674 pr_debug("success");
691 if ((this->net_type == IW_MODE_INFRA && 675 if ((this->net_type == IW_MODE_INFRA &&
692 (sig.cap_info & WL3501_MGMT_CAPABILITY_ESS)) || 676 (sig.cap_info & WL3501_MGMT_CAPABILITY_ESS)) ||
693 (this->net_type == IW_MODE_ADHOC && 677 (this->net_type == IW_MODE_ADHOC &&
@@ -722,7 +706,7 @@ static void wl3501_mgmt_scan_confirm(struct wl3501_card *this, u16 addr)
722 } 706 }
723 } 707 }
724 } else if (sig.status == WL3501_STATUS_TIMEOUT) { 708 } else if (sig.status == WL3501_STATUS_TIMEOUT) {
725 dprintk(3, "timeout"); 709 pr_debug("timeout");
726 this->join_sta_bss = 0; 710 this->join_sta_bss = 0;
727 for (i = this->join_sta_bss; i < this->bss_cnt; i++) 711 for (i = this->join_sta_bss; i < this->bss_cnt; i++)
728 if (!wl3501_mgmt_join(this, i)) 712 if (!wl3501_mgmt_join(this, i))
@@ -879,7 +863,7 @@ static int wl3501_mgmt_auth(struct wl3501_card *this)
879 .timeout = 1000, 863 .timeout = 1000,
880 }; 864 };
881 865
882 dprintk(3, "entry"); 866 pr_debug("entry");
883 memcpy(sig.mac_addr, this->bssid, ETH_ALEN); 867 memcpy(sig.mac_addr, this->bssid, ETH_ALEN);
884 return wl3501_esbq_exec(this, &sig, sizeof(sig)); 868 return wl3501_esbq_exec(this, &sig, sizeof(sig));
885} 869}
@@ -893,7 +877,7 @@ static int wl3501_mgmt_association(struct wl3501_card *this)
893 .cap_info = this->cap_info, 877 .cap_info = this->cap_info,
894 }; 878 };
895 879
896 dprintk(3, "entry"); 880 pr_debug("entry");
897 memcpy(sig.mac_addr, this->bssid, ETH_ALEN); 881 memcpy(sig.mac_addr, this->bssid, ETH_ALEN);
898 return wl3501_esbq_exec(this, &sig, sizeof(sig)); 882 return wl3501_esbq_exec(this, &sig, sizeof(sig));
899} 883}
@@ -903,7 +887,7 @@ static void wl3501_mgmt_join_confirm(struct net_device *dev, u16 addr)
903 struct wl3501_card *this = netdev_priv(dev); 887 struct wl3501_card *this = netdev_priv(dev);
904 struct wl3501_join_confirm sig; 888 struct wl3501_join_confirm sig;
905 889
906 dprintk(3, "entry"); 890 pr_debug("entry");
907 wl3501_get_from_wla(this, addr, &sig, sizeof(sig)); 891 wl3501_get_from_wla(this, addr, &sig, sizeof(sig));
908 if (sig.status == WL3501_STATUS_SUCCESS) { 892 if (sig.status == WL3501_STATUS_SUCCESS) {
909 if (this->net_type == IW_MODE_INFRA) { 893 if (this->net_type == IW_MODE_INFRA) {
@@ -962,7 +946,7 @@ static inline void wl3501_md_confirm_interrupt(struct net_device *dev,
962{ 946{
963 struct wl3501_md_confirm sig; 947 struct wl3501_md_confirm sig;
964 948
965 dprintk(3, "entry"); 949 pr_debug("entry");
966 wl3501_get_from_wla(this, addr, &sig, sizeof(sig)); 950 wl3501_get_from_wla(this, addr, &sig, sizeof(sig));
967 wl3501_free_tx_buffer(this, sig.data); 951 wl3501_free_tx_buffer(this, sig.data);
968 if (netif_queue_stopped(dev)) 952 if (netif_queue_stopped(dev))
@@ -1017,7 +1001,7 @@ static inline void wl3501_md_ind_interrupt(struct net_device *dev,
1017static inline void wl3501_get_confirm_interrupt(struct wl3501_card *this, 1001static inline void wl3501_get_confirm_interrupt(struct wl3501_card *this,
1018 u16 addr, void *sig, int size) 1002 u16 addr, void *sig, int size)
1019{ 1003{
1020 dprintk(3, "entry"); 1004 pr_debug("entry");
1021 wl3501_get_from_wla(this, addr, &this->sig_get_confirm, 1005 wl3501_get_from_wla(this, addr, &this->sig_get_confirm,
1022 sizeof(this->sig_get_confirm)); 1006 sizeof(this->sig_get_confirm));
1023 wake_up(&this->wait); 1007 wake_up(&this->wait);
@@ -1029,7 +1013,7 @@ static inline void wl3501_start_confirm_interrupt(struct net_device *dev,
1029{ 1013{
1030 struct wl3501_start_confirm sig; 1014 struct wl3501_start_confirm sig;
1031 1015
1032 dprintk(3, "entry"); 1016 pr_debug("entry");
1033 wl3501_get_from_wla(this, addr, &sig, sizeof(sig)); 1017 wl3501_get_from_wla(this, addr, &sig, sizeof(sig));
1034 if (sig.status == WL3501_STATUS_SUCCESS) 1018 if (sig.status == WL3501_STATUS_SUCCESS)
1035 netif_wake_queue(dev); 1019 netif_wake_queue(dev);
@@ -1041,7 +1025,7 @@ static inline void wl3501_assoc_confirm_interrupt(struct net_device *dev,
1041 struct wl3501_card *this = netdev_priv(dev); 1025 struct wl3501_card *this = netdev_priv(dev);
1042 struct wl3501_assoc_confirm sig; 1026 struct wl3501_assoc_confirm sig;
1043 1027
1044 dprintk(3, "entry"); 1028 pr_debug("entry");
1045 wl3501_get_from_wla(this, addr, &sig, sizeof(sig)); 1029 wl3501_get_from_wla(this, addr, &sig, sizeof(sig));
1046 1030
1047 if (sig.status == WL3501_STATUS_SUCCESS) 1031 if (sig.status == WL3501_STATUS_SUCCESS)
@@ -1053,7 +1037,7 @@ static inline void wl3501_auth_confirm_interrupt(struct wl3501_card *this,
1053{ 1037{
1054 struct wl3501_auth_confirm sig; 1038 struct wl3501_auth_confirm sig;
1055 1039
1056 dprintk(3, "entry"); 1040 pr_debug("entry");
1057 wl3501_get_from_wla(this, addr, &sig, sizeof(sig)); 1041 wl3501_get_from_wla(this, addr, &sig, sizeof(sig));
1058 1042
1059 if (sig.status == WL3501_STATUS_SUCCESS) 1043 if (sig.status == WL3501_STATUS_SUCCESS)
@@ -1069,7 +1053,7 @@ static inline void wl3501_rx_interrupt(struct net_device *dev)
1069 u8 sig_id; 1053 u8 sig_id;
1070 struct wl3501_card *this = netdev_priv(dev); 1054 struct wl3501_card *this = netdev_priv(dev);
1071 1055
1072 dprintk(3, "entry"); 1056 pr_debug("entry");
1073loop: 1057loop:
1074 morepkts = 0; 1058 morepkts = 0;
1075 if (!wl3501_esbq_confirm(this)) 1059 if (!wl3501_esbq_confirm(this))
@@ -1302,7 +1286,7 @@ static int wl3501_reset(struct net_device *dev)
1302 wl3501_ack_interrupt(this); 1286 wl3501_ack_interrupt(this);
1303 wl3501_unblock_interrupt(this); 1287 wl3501_unblock_interrupt(this);
1304 wl3501_mgmt_scan(this, 100); 1288 wl3501_mgmt_scan(this, 100);
1305 dprintk(1, "%s: device reset", dev->name); 1289 pr_debug("%s: device reset", dev->name);
1306 rc = 0; 1290 rc = 0;
1307out: 1291out:
1308 return rc; 1292 return rc;
@@ -1376,7 +1360,7 @@ static int wl3501_open(struct net_device *dev)
1376 link->open++; 1360 link->open++;
1377 1361
1378 /* Initial WL3501 firmware */ 1362 /* Initial WL3501 firmware */
1379 dprintk(1, "%s: Initialize WL3501 firmware...", dev->name); 1363 pr_debug("%s: Initialize WL3501 firmware...", dev->name);
1380 if (wl3501_init_firmware(this)) 1364 if (wl3501_init_firmware(this))
1381 goto fail; 1365 goto fail;
1382 /* Initial device variables */ 1366 /* Initial device variables */
@@ -1388,7 +1372,7 @@ static int wl3501_open(struct net_device *dev)
1388 wl3501_unblock_interrupt(this); 1372 wl3501_unblock_interrupt(this);
1389 wl3501_mgmt_scan(this, 100); 1373 wl3501_mgmt_scan(this, 100);
1390 rc = 0; 1374 rc = 0;
1391 dprintk(1, "%s: WL3501 opened", dev->name); 1375 pr_debug("%s: WL3501 opened", dev->name);
1392 printk(KERN_INFO "%s: Card Name: %s\n" 1376 printk(KERN_INFO "%s: Card Name: %s\n"
1393 "%s: Firmware Date: %s\n", 1377 "%s: Firmware Date: %s\n",
1394 dev->name, this->card_name, 1378 dev->name, this->card_name,
@@ -1945,9 +1929,6 @@ out_link:
1945 return -ENOMEM; 1929 return -ENOMEM;
1946} 1930}
1947 1931
1948#define CS_CHECK(fn, ret) \
1949do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0)
1950
1951/** 1932/**
1952 * wl3501_config - configure the PCMCIA socket and make eth device available 1933 * wl3501_config - configure the PCMCIA socket and make eth device available
1953 * @link - FILL_IN 1934 * @link - FILL_IN
@@ -1959,7 +1940,7 @@ do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0)
1959static int wl3501_config(struct pcmcia_device *link) 1940static int wl3501_config(struct pcmcia_device *link)
1960{ 1941{
1961 struct net_device *dev = link->priv; 1942 struct net_device *dev = link->priv;
1962 int i = 0, j, last_fn, last_ret; 1943 int i = 0, j, ret;
1963 struct wl3501_card *this; 1944 struct wl3501_card *this;
1964 1945
1965 /* Try allocating IO ports. This tries a few fixed addresses. If you 1946 /* Try allocating IO ports. This tries a few fixed addresses. If you
@@ -1975,20 +1956,22 @@ static int wl3501_config(struct pcmcia_device *link)
1975 if (i == 0) 1956 if (i == 0)
1976 break; 1957 break;
1977 } 1958 }
1978 if (i != 0) { 1959 if (i != 0)
1979 cs_error(link, RequestIO, i);
1980 goto failed; 1960 goto failed;
1981 }
1982 1961
1983 /* Now allocate an interrupt line. Note that this does not actually 1962 /* Now allocate an interrupt line. Note that this does not actually
1984 * assign a handler to the interrupt. */ 1963 * assign a handler to the interrupt. */
1985 1964
1986 CS_CHECK(RequestIRQ, pcmcia_request_irq(link, &link->irq)); 1965 ret = pcmcia_request_irq(link, &link->irq);
1966 if (ret)
1967 goto failed;
1987 1968
1988 /* This actually configures the PCMCIA socket -- setting up the I/O 1969 /* This actually configures the PCMCIA socket -- setting up the I/O
1989 * windows and the interrupt mapping. */ 1970 * windows and the interrupt mapping. */
1990 1971
1991 CS_CHECK(RequestConfiguration, pcmcia_request_configuration(link, &link->conf)); 1972 ret = pcmcia_request_configuration(link, &link->conf);
1973 if (ret)
1974 goto failed;
1992 1975
1993 dev->irq = link->irq.AssignedIRQ; 1976 dev->irq = link->irq.AssignedIRQ;
1994 dev->base_addr = link->io.BasePort1; 1977 dev->base_addr = link->io.BasePort1;
@@ -2041,8 +2024,6 @@ static int wl3501_config(struct pcmcia_device *link)
2041 netif_start_queue(dev); 2024 netif_start_queue(dev);
2042 return 0; 2025 return 0;
2043 2026
2044cs_failed:
2045 cs_error(link, last_fn, last_ret);
2046failed: 2027failed:
2047 wl3501_release(link); 2028 wl3501_release(link);
2048 return -ENODEV; 2029 return -ENODEV;