aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/wireless')
-rw-r--r--drivers/net/wireless/airo_cs.c55
-rw-r--r--drivers/net/wireless/atmel_cs.c51
-rw-r--r--drivers/net/wireless/b43/pcmcia.c26
-rw-r--r--drivers/net/wireless/hostap/hostap_cs.c51
-rw-r--r--drivers/net/wireless/libertas/if_cs.c72
-rw-r--r--drivers/net/wireless/netwave_cs.c95
-rw-r--r--drivers/net/wireless/orinoco/orinoco_cs.c33
-rw-r--r--drivers/net/wireless/orinoco/spectrum_cs.c60
-rw-r--r--drivers/net/wireless/ray_cs.c357
-rw-r--r--drivers/net/wireless/wavelan_cs.c35
-rw-r--r--drivers/net/wireless/wl3501_cs.c74
11 files changed, 362 insertions, 547 deletions
diff --git a/drivers/net/wireless/airo_cs.c b/drivers/net/wireless/airo_cs.c
index d0593ed9170e..f6036fb42319 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,11 +130,10 @@ 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;
152 p_dev->irq.IRQInfo1 = IRQ_LEVEL_ID;
153 p_dev->irq.Handler = NULL; 137 p_dev->irq.Handler = NULL;
154 138
155 /* 139 /*
@@ -184,7 +168,7 @@ static int airo_probe(struct pcmcia_device *p_dev)
184 168
185static void airo_detach(struct pcmcia_device *link) 169static void airo_detach(struct pcmcia_device *link)
186{ 170{
187 DEBUG(0, "airo_detach(0x%p)\n", link); 171 dev_dbg(&link->dev, "airo_detach\n");
188 172
189 airo_release(link); 173 airo_release(link);
190 174
@@ -204,9 +188,6 @@ static void airo_detach(struct pcmcia_device *link)
204 188
205 ======================================================================*/ 189 ======================================================================*/
206 190
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, 191static int airo_cs_config_check(struct pcmcia_device *p_dev,
211 cistpl_cftable_entry_t *cfg, 192 cistpl_cftable_entry_t *cfg,
212 cistpl_cftable_entry_t *dflt, 193 cistpl_cftable_entry_t *dflt,
@@ -275,11 +256,11 @@ static int airo_cs_config_check(struct pcmcia_device *p_dev,
275 req->Base = mem->win[0].host_addr; 256 req->Base = mem->win[0].host_addr;
276 req->Size = mem->win[0].len; 257 req->Size = mem->win[0].len;
277 req->AccessSpeed = 0; 258 req->AccessSpeed = 0;
278 if (pcmcia_request_window(&p_dev, req, &p_dev->win) != 0) 259 if (pcmcia_request_window(p_dev, req, &p_dev->win) != 0)
279 return -ENODEV; 260 return -ENODEV;
280 map.Page = 0; 261 map.Page = 0;
281 map.CardOffset = mem->win[0].card_addr; 262 map.CardOffset = mem->win[0].card_addr;
282 if (pcmcia_map_mem_page(p_dev->win, &map) != 0) 263 if (pcmcia_map_mem_page(p_dev, p_dev->win, &map) != 0)
283 return -ENODEV; 264 return -ENODEV;
284 } 265 }
285 /* If we got this far, we're cool! */ 266 /* If we got this far, we're cool! */
@@ -291,11 +272,11 @@ static int airo_config(struct pcmcia_device *link)
291{ 272{
292 local_info_t *dev; 273 local_info_t *dev;
293 win_req_t *req; 274 win_req_t *req;
294 int last_fn, last_ret; 275 int ret;
295 276
296 dev = link->priv; 277 dev = link->priv;
297 278
298 DEBUG(0, "airo_config(0x%p)\n", link); 279 dev_dbg(&link->dev, "airo_config\n");
299 280
300 req = kzalloc(sizeof(win_req_t), GFP_KERNEL); 281 req = kzalloc(sizeof(win_req_t), GFP_KERNEL);
301 if (!req) 282 if (!req)
@@ -315,8 +296,8 @@ static int airo_config(struct pcmcia_device *link)
315 * and most client drivers will only use the CIS to fill in 296 * and most client drivers will only use the CIS to fill in
316 * implementation-defined details. 297 * implementation-defined details.
317 */ 298 */
318 last_ret = pcmcia_loop_config(link, airo_cs_config_check, req); 299 ret = pcmcia_loop_config(link, airo_cs_config_check, req);
319 if (last_ret) 300 if (ret)
320 goto failed; 301 goto failed;
321 302
322 /* 303 /*
@@ -324,21 +305,25 @@ static int airo_config(struct pcmcia_device *link)
324 handler to the interrupt, unless the 'Handler' member of the 305 handler to the interrupt, unless the 'Handler' member of the
325 irq structure is initialized. 306 irq structure is initialized.
326 */ 307 */
327 if (link->conf.Attributes & CONF_ENABLE_IRQ) 308 if (link->conf.Attributes & CONF_ENABLE_IRQ) {
328 CS_CHECK(RequestIRQ, pcmcia_request_irq(link, &link->irq)); 309 ret = pcmcia_request_irq(link, &link->irq);
310 if (ret)
311 goto failed;
312 }
329 313
330 /* 314 /*
331 This actually configures the PCMCIA socket -- setting up 315 This actually configures the PCMCIA socket -- setting up
332 the I/O windows and the interrupt mapping, and putting the 316 the I/O windows and the interrupt mapping, and putting the
333 card and host interface into "Memory and IO" mode. 317 card and host interface into "Memory and IO" mode.
334 */ 318 */
335 CS_CHECK(RequestConfiguration, 319 ret = pcmcia_request_configuration(link, &link->conf);
336 pcmcia_request_configuration(link, &link->conf)); 320 if (ret)
321 goto failed;
337 ((local_info_t *)link->priv)->eth_dev = 322 ((local_info_t *)link->priv)->eth_dev =
338 init_airo_card(link->irq.AssignedIRQ, 323 init_airo_card(link->irq.AssignedIRQ,
339 link->io.BasePort1, 1, &handle_to_dev(link)); 324 link->io.BasePort1, 1, &link->dev);
340 if (!((local_info_t *)link->priv)->eth_dev) 325 if (!((local_info_t *)link->priv)->eth_dev)
341 goto cs_failed; 326 goto failed;
342 327
343 /* 328 /*
344 At this point, the dev_node_t structure(s) need to be 329 At this point, the dev_node_t structure(s) need to be
@@ -368,8 +353,6 @@ static int airo_config(struct pcmcia_device *link)
368 kfree(req); 353 kfree(req);
369 return 0; 354 return 0;
370 355
371 cs_failed:
372 cs_error(link, last_fn, last_ret);
373 failed: 356 failed:
374 airo_release(link); 357 airo_release(link);
375 kfree(req); 358 kfree(req);
@@ -386,7 +369,7 @@ static int airo_config(struct pcmcia_device *link)
386 369
387static void airo_release(struct pcmcia_device *link) 370static void airo_release(struct pcmcia_device *link)
388{ 371{
389 DEBUG(0, "airo_release(0x%p)\n", link); 372 dev_dbg(&link->dev, "airo_release\n");
390 pcmcia_disable_device(link); 373 pcmcia_disable_device(link);
391} 374}
392 375
diff --git a/drivers/net/wireless/atmel_cs.c b/drivers/net/wireless/atmel_cs.c
index ddaa859c3491..32407911842f 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,11 +139,10 @@ 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;
162 p_dev->irq.IRQInfo1 = IRQ_LEVEL_ID;
163 p_dev->irq.Handler = NULL; 146 p_dev->irq.Handler = NULL;
164 147
165 /* 148 /*
@@ -194,7 +177,7 @@ static int atmel_probe(struct pcmcia_device *p_dev)
194 177
195static void atmel_detach(struct pcmcia_device *link) 178static void atmel_detach(struct pcmcia_device *link)
196{ 179{
197 DEBUG(0, "atmel_detach(0x%p)\n", link); 180 dev_dbg(&link->dev, "atmel_detach\n");
198 181
199 atmel_release(link); 182 atmel_release(link);
200 183
@@ -209,9 +192,6 @@ static void atmel_detach(struct pcmcia_device *link)
209 192
210 ======================================================================*/ 193 ======================================================================*/
211 194
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 195/* Call-back function to interrogate PCMCIA-specific information
216 about the current existance of the card */ 196 about the current existance of the card */
217static int card_present(void *arg) 197static int card_present(void *arg)
@@ -275,13 +255,13 @@ static int atmel_config_check(struct pcmcia_device *p_dev,
275static int atmel_config(struct pcmcia_device *link) 255static int atmel_config(struct pcmcia_device *link)
276{ 256{
277 local_info_t *dev; 257 local_info_t *dev;
278 int last_fn, last_ret; 258 int ret;
279 struct pcmcia_device_id *did; 259 struct pcmcia_device_id *did;
280 260
281 dev = link->priv; 261 dev = link->priv;
282 did = dev_get_drvdata(&handle_to_dev(link)); 262 did = dev_get_drvdata(&link->dev);
283 263
284 DEBUG(0, "atmel_config(0x%p)\n", link); 264 dev_dbg(&link->dev, "atmel_config\n");
285 265
286 /* 266 /*
287 In this loop, we scan the CIS for configuration table entries, 267 In this loop, we scan the CIS for configuration table entries,
@@ -303,31 +283,36 @@ static int atmel_config(struct pcmcia_device *link)
303 handler to the interrupt, unless the 'Handler' member of the 283 handler to the interrupt, unless the 'Handler' member of the
304 irq structure is initialized. 284 irq structure is initialized.
305 */ 285 */
306 if (link->conf.Attributes & CONF_ENABLE_IRQ) 286 if (link->conf.Attributes & CONF_ENABLE_IRQ) {
307 CS_CHECK(RequestIRQ, pcmcia_request_irq(link, &link->irq)); 287 ret = pcmcia_request_irq(link, &link->irq);
288 if (ret)
289 goto failed;
290 }
308 291
309 /* 292 /*
310 This actually configures the PCMCIA socket -- setting up 293 This actually configures the PCMCIA socket -- setting up
311 the I/O windows and the interrupt mapping, and putting the 294 the I/O windows and the interrupt mapping, and putting the
312 card and host interface into "Memory and IO" mode. 295 card and host interface into "Memory and IO" mode.
313 */ 296 */
314 CS_CHECK(RequestConfiguration, pcmcia_request_configuration(link, &link->conf)); 297 ret = pcmcia_request_configuration(link, &link->conf);
298 if (ret)
299 goto failed;
315 300
316 if (link->irq.AssignedIRQ == 0) { 301 if (link->irq.AssignedIRQ == 0) {
317 printk(KERN_ALERT 302 printk(KERN_ALERT
318 "atmel: cannot assign IRQ: check that CONFIG_ISA is set in kernel config."); 303 "atmel: cannot assign IRQ: check that CONFIG_ISA is set in kernel config.");
319 goto cs_failed; 304 goto failed;
320 } 305 }
321 306
322 ((local_info_t*)link->priv)->eth_dev = 307 ((local_info_t*)link->priv)->eth_dev =
323 init_atmel_card(link->irq.AssignedIRQ, 308 init_atmel_card(link->irq.AssignedIRQ,
324 link->io.BasePort1, 309 link->io.BasePort1,
325 did ? did->driver_info : ATMEL_FW_TYPE_NONE, 310 did ? did->driver_info : ATMEL_FW_TYPE_NONE,
326 &handle_to_dev(link), 311 &link->dev,
327 card_present, 312 card_present,
328 link); 313 link);
329 if (!((local_info_t*)link->priv)->eth_dev) 314 if (!((local_info_t*)link->priv)->eth_dev)
330 goto cs_failed; 315 goto failed;
331 316
332 317
333 /* 318 /*
@@ -340,8 +325,6 @@ static int atmel_config(struct pcmcia_device *link)
340 325
341 return 0; 326 return 0;
342 327
343 cs_failed:
344 cs_error(link, last_fn, last_ret);
345 failed: 328 failed:
346 atmel_release(link); 329 atmel_release(link);
347 return -ENODEV; 330 return -ENODEV;
@@ -359,7 +342,7 @@ static void atmel_release(struct pcmcia_device *link)
359{ 342{
360 struct net_device *dev = ((local_info_t*)link->priv)->eth_dev; 343 struct net_device *dev = ((local_info_t*)link->priv)->eth_dev;
361 344
362 DEBUG(0, "atmel_release(0x%p)\n", link); 345 dev_dbg(&link->dev, "atmel_release\n");
363 346
364 if (dev) 347 if (dev)
365 stop_atmel_card(dev); 348 stop_atmel_card(dev);
diff --git a/drivers/net/wireless/b43/pcmcia.c b/drivers/net/wireless/b43/pcmcia.c
index 6c3a74964ab8..984174bc7b0f 100644
--- a/drivers/net/wireless/b43/pcmcia.c
+++ b/drivers/net/wireless/b43/pcmcia.c
@@ -65,35 +65,15 @@ static int __devinit b43_pcmcia_probe(struct pcmcia_device *dev)
65 struct ssb_bus *ssb; 65 struct ssb_bus *ssb;
66 win_req_t win; 66 win_req_t win;
67 memreq_t mem; 67 memreq_t mem;
68 tuple_t tuple;
69 cisparse_t parse;
70 int err = -ENOMEM; 68 int err = -ENOMEM;
71 int res = 0; 69 int res = 0;
72 unsigned char buf[64];
73 70
74 ssb = kzalloc(sizeof(*ssb), GFP_KERNEL); 71 ssb = kzalloc(sizeof(*ssb), GFP_KERNEL);
75 if (!ssb) 72 if (!ssb)
76 goto out_error; 73 goto out_error;
77 74
78 err = -ENODEV; 75 err = -ENODEV;
79 tuple.DesiredTuple = CISTPL_CONFIG;
80 tuple.Attributes = 0;
81 tuple.TupleData = buf;
82 tuple.TupleDataMax = sizeof(buf);
83 tuple.TupleOffset = 0;
84 76
85 res = pcmcia_get_first_tuple(dev, &tuple);
86 if (res != 0)
87 goto err_kfree_ssb;
88 res = pcmcia_get_tuple_data(dev, &tuple);
89 if (res != 0)
90 goto err_kfree_ssb;
91 res = pcmcia_parse_tuple(&tuple, &parse);
92 if (res != 0)
93 goto err_kfree_ssb;
94
95 dev->conf.ConfigBase = parse.config.base;
96 dev->conf.Present = parse.config.rmask[0];
97 dev->conf.Attributes = CONF_ENABLE_IRQ; 77 dev->conf.Attributes = CONF_ENABLE_IRQ;
98 dev->conf.IntType = INT_MEMORY_AND_IO; 78 dev->conf.IntType = INT_MEMORY_AND_IO;
99 79
@@ -107,20 +87,18 @@ static int __devinit b43_pcmcia_probe(struct pcmcia_device *dev)
107 win.Base = 0; 87 win.Base = 0;
108 win.Size = SSB_CORE_SIZE; 88 win.Size = SSB_CORE_SIZE;
109 win.AccessSpeed = 250; 89 win.AccessSpeed = 250;
110 res = pcmcia_request_window(&dev, &win, &dev->win); 90 res = pcmcia_request_window(dev, &win, &dev->win);
111 if (res != 0) 91 if (res != 0)
112 goto err_kfree_ssb; 92 goto err_kfree_ssb;
113 93
114 mem.CardOffset = 0; 94 mem.CardOffset = 0;
115 mem.Page = 0; 95 mem.Page = 0;
116 res = pcmcia_map_mem_page(dev->win, &mem); 96 res = pcmcia_map_mem_page(dev, dev->win, &mem);
117 if (res != 0) 97 if (res != 0)
118 goto err_disable; 98 goto err_disable;
119 99
120 dev->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING; 100 dev->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING;
121 dev->irq.IRQInfo1 = IRQ_LEVEL_ID;
122 dev->irq.Handler = NULL; /* The handler is registered later. */ 101 dev->irq.Handler = NULL; /* The handler is registered later. */
123 dev->irq.Instance = NULL;
124 res = pcmcia_request_irq(dev, &dev->irq); 102 res = pcmcia_request_irq(dev, &dev->irq);
125 if (res != 0) 103 if (res != 0)
126 goto err_disable; 104 goto err_disable;
diff --git a/drivers/net/wireless/hostap/hostap_cs.c b/drivers/net/wireless/hostap/hostap_cs.c
index ad8eab4a639b..c9640a3e02c9 100644
--- a/drivers/net/wireless/hostap/hostap_cs.c
+++ b/drivers/net/wireless/hostap/hostap_cs.c
@@ -274,9 +274,6 @@ static int sandisk_enable_wireless(struct net_device *dev)
274 conf_reg_t reg; 274 conf_reg_t reg;
275 struct hostap_interface *iface = netdev_priv(dev); 275 struct hostap_interface *iface = netdev_priv(dev);
276 local_info_t *local = iface->local; 276 local_info_t *local = iface->local;
277 tuple_t tuple;
278 cisparse_t *parse = NULL;
279 u_char buf[64];
280 struct hostap_cs_priv *hw_priv = local->hw_priv; 277 struct hostap_cs_priv *hw_priv = local->hw_priv;
281 278
282 if (hw_priv->link->io.NumPorts1 < 0x42) { 279 if (hw_priv->link->io.NumPorts1 < 0x42) {
@@ -285,28 +282,13 @@ static int sandisk_enable_wireless(struct net_device *dev)
285 goto done; 282 goto done;
286 } 283 }
287 284
288 parse = kmalloc(sizeof(cisparse_t), GFP_KERNEL);
289 if (parse == NULL) {
290 ret = -ENOMEM;
291 goto done;
292 }
293
294 tuple.Attributes = TUPLE_RETURN_COMMON;
295 tuple.TupleData = buf;
296 tuple.TupleDataMax = sizeof(buf);
297 tuple.TupleOffset = 0;
298
299 if (hw_priv->link->manf_id != 0xd601 || hw_priv->link->card_id != 0x0101) { 285 if (hw_priv->link->manf_id != 0xd601 || hw_priv->link->card_id != 0x0101) {
300 /* No SanDisk manfid found */ 286 /* No SanDisk manfid found */
301 ret = -ENODEV; 287 ret = -ENODEV;
302 goto done; 288 goto done;
303 } 289 }
304 290
305 tuple.DesiredTuple = CISTPL_LONGLINK_MFC; 291 if (hw_priv->link->socket->functions < 2) {
306 if (pcmcia_get_first_tuple(hw_priv->link, &tuple) ||
307 pcmcia_get_tuple_data(hw_priv->link, &tuple) ||
308 pcmcia_parse_tuple(&tuple, parse) ||
309 parse->longlink_mfc.nfn < 2) {
310 /* No multi-function links found */ 292 /* No multi-function links found */
311 ret = -ENODEV; 293 ret = -ENODEV;
312 goto done; 294 goto done;
@@ -354,7 +336,6 @@ static int sandisk_enable_wireless(struct net_device *dev)
354 udelay(10); 336 udelay(10);
355 337
356done: 338done:
357 kfree(parse);
358 return ret; 339 return ret;
359} 340}
360 341
@@ -529,10 +510,6 @@ static void prism2_detach(struct pcmcia_device *link)
529} 510}
530 511
531 512
532#define CS_CHECK(fn, ret) \
533do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0)
534
535
536/* 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
537 * socket and make the device available to the system */ 514 * socket and make the device available to the system */
538 515
@@ -624,7 +601,6 @@ static int prism2_config(struct pcmcia_device *link)
624 struct hostap_interface *iface; 601 struct hostap_interface *iface;
625 local_info_t *local; 602 local_info_t *local;
626 int ret = 1; 603 int ret = 1;
627 int last_fn, last_ret;
628 struct hostap_cs_priv *hw_priv; 604 struct hostap_cs_priv *hw_priv;
629 605
630 PDEBUG(DEBUG_FLOW, "prism2_config()\n"); 606 PDEBUG(DEBUG_FLOW, "prism2_config()\n");
@@ -636,19 +612,18 @@ static int prism2_config(struct pcmcia_device *link)
636 } 612 }
637 613
638 /* Look for an appropriate configuration table entry in the CIS */ 614 /* Look for an appropriate configuration table entry in the CIS */
639 last_ret = pcmcia_loop_config(link, prism2_config_check, NULL); 615 ret = pcmcia_loop_config(link, prism2_config_check, NULL);
640 if (last_ret) { 616 if (ret) {
641 if (!ignore_cis_vcc) 617 if (!ignore_cis_vcc)
642 printk(KERN_ERR "GetNextTuple(): No matching " 618 printk(KERN_ERR "GetNextTuple(): No matching "
643 "CIS configuration. Maybe you need the " 619 "CIS configuration. Maybe you need the "
644 "ignore_cis_vcc=1 parameter.\n"); 620 "ignore_cis_vcc=1 parameter.\n");
645 cs_error(link, RequestIO, last_ret);
646 goto failed; 621 goto failed;
647 } 622 }
648 623
649 /* Need to allocate net_device before requesting IRQ handler */ 624 /* Need to allocate net_device before requesting IRQ handler */
650 dev = prism2_init_local_data(&prism2_pccard_funcs, 0, 625 dev = prism2_init_local_data(&prism2_pccard_funcs, 0,
651 &handle_to_dev(link)); 626 &link->dev);
652 if (dev == NULL) 627 if (dev == NULL)
653 goto failed; 628 goto failed;
654 link->priv = dev; 629 link->priv = dev;
@@ -666,13 +641,11 @@ static int prism2_config(struct pcmcia_device *link)
666 * irq structure is initialized. 641 * irq structure is initialized.
667 */ 642 */
668 if (link->conf.Attributes & CONF_ENABLE_IRQ) { 643 if (link->conf.Attributes & CONF_ENABLE_IRQ) {
669 link->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING | 644 link->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING;
670 IRQ_HANDLE_PRESENT;
671 link->irq.IRQInfo1 = IRQ_LEVEL_ID;
672 link->irq.Handler = prism2_interrupt; 645 link->irq.Handler = prism2_interrupt;
673 link->irq.Instance = dev; 646 ret = pcmcia_request_irq(link, &link->irq);
674 CS_CHECK(RequestIRQ, 647 if (ret)
675 pcmcia_request_irq(link, &link->irq)); 648 goto failed;
676 } 649 }
677 650
678 /* 651 /*
@@ -680,8 +653,9 @@ static int prism2_config(struct pcmcia_device *link)
680 * the I/O windows and the interrupt mapping, and putting the 653 * the I/O windows and the interrupt mapping, and putting the
681 * card and host interface into "Memory and IO" mode. 654 * card and host interface into "Memory and IO" mode.
682 */ 655 */
683 CS_CHECK(RequestConfiguration, 656 ret = pcmcia_request_configuration(link, &link->conf);
684 pcmcia_request_configuration(link, &link->conf)); 657 if (ret)
658 goto failed;
685 659
686 dev->irq = link->irq.AssignedIRQ; 660 dev->irq = link->irq.AssignedIRQ;
687 dev->base_addr = link->io.BasePort1; 661 dev->base_addr = link->io.BasePort1;
@@ -714,9 +688,6 @@ static int prism2_config(struct pcmcia_device *link)
714 } 688 }
715 return ret; 689 return ret;
716 690
717 cs_failed:
718 cs_error(link, last_fn, last_ret);
719
720 failed: 691 failed:
721 kfree(hw_priv); 692 kfree(hw_priv);
722 prism2_release((u_long)link); 693 prism2_release((u_long)link);
diff --git a/drivers/net/wireless/libertas/if_cs.c b/drivers/net/wireless/libertas/if_cs.c
index 62381768f2d5..b1d84592b959 100644
--- a/drivers/net/wireless/libertas/if_cs.c
+++ b/drivers/net/wireless/libertas/if_cs.c
@@ -590,7 +590,7 @@ static int if_cs_prog_helper(struct if_cs_card *card)
590 590
591 /* TODO: make firmware file configurable */ 591 /* TODO: make firmware file configurable */
592 ret = request_firmware(&fw, "libertas_cs_helper.fw", 592 ret = request_firmware(&fw, "libertas_cs_helper.fw",
593 &handle_to_dev(card->p_dev)); 593 &card->p_dev->dev);
594 if (ret) { 594 if (ret) {
595 lbs_pr_err("can't load helper firmware\n"); 595 lbs_pr_err("can't load helper firmware\n");
596 ret = -ENODEV; 596 ret = -ENODEV;
@@ -663,7 +663,7 @@ static int if_cs_prog_real(struct if_cs_card *card)
663 663
664 /* TODO: make firmware file configurable */ 664 /* TODO: make firmware file configurable */
665 ret = request_firmware(&fw, "libertas_cs.fw", 665 ret = request_firmware(&fw, "libertas_cs.fw",
666 &handle_to_dev(card->p_dev)); 666 &card->p_dev->dev);
667 if (ret) { 667 if (ret) {
668 lbs_pr_err("can't load firmware\n"); 668 lbs_pr_err("can't load firmware\n");
669 ret = -ENODEV; 669 ret = -ENODEV;
@@ -793,18 +793,37 @@ static void if_cs_release(struct pcmcia_device *p_dev)
793 * configure the card at this point -- we wait until we receive a card 793 * configure the card at this point -- we wait until we receive a card
794 * insertion event. 794 * insertion event.
795 */ 795 */
796
797static int if_cs_ioprobe(struct pcmcia_device *p_dev,
798 cistpl_cftable_entry_t *cfg,
799 cistpl_cftable_entry_t *dflt,
800 unsigned int vcc,
801 void *priv_data)
802{
803 p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO;
804 p_dev->io.BasePort1 = cfg->io.win[0].base;
805 p_dev->io.NumPorts1 = cfg->io.win[0].len;
806
807 /* Do we need to allocate an interrupt? */
808 if (cfg->irq.IRQInfo1)
809 p_dev->conf.Attributes |= CONF_ENABLE_IRQ;
810
811 /* IO window settings */
812 if (cfg->io.nwin != 1) {
813 lbs_pr_err("wrong CIS (check number of IO windows)\n");
814 return -ENODEV;
815 }
816
817 /* This reserves IO space but doesn't actually enable it */
818 return pcmcia_request_io(p_dev, &p_dev->io);
819}
820
796static int if_cs_probe(struct pcmcia_device *p_dev) 821static int if_cs_probe(struct pcmcia_device *p_dev)
797{ 822{
798 int ret = -ENOMEM; 823 int ret = -ENOMEM;
799 unsigned int prod_id; 824 unsigned int prod_id;
800 struct lbs_private *priv; 825 struct lbs_private *priv;
801 struct if_cs_card *card; 826 struct if_cs_card *card;
802 /* CIS parsing */
803 tuple_t tuple;
804 cisparse_t parse;
805 cistpl_cftable_entry_t *cfg = &parse.cftable_entry;
806 cistpl_io_t *io = &cfg->io;
807 u_char buf[64];
808 827
809 lbs_deb_enter(LBS_DEB_CS); 828 lbs_deb_enter(LBS_DEB_CS);
810 829
@@ -818,48 +837,15 @@ static int if_cs_probe(struct pcmcia_device *p_dev)
818 837
819 p_dev->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING; 838 p_dev->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING;
820 p_dev->irq.Handler = NULL; 839 p_dev->irq.Handler = NULL;
821 p_dev->irq.IRQInfo1 = IRQ_INFO2_VALID | IRQ_LEVEL_ID;
822 840
823 p_dev->conf.Attributes = 0; 841 p_dev->conf.Attributes = 0;
824 p_dev->conf.IntType = INT_MEMORY_AND_IO; 842 p_dev->conf.IntType = INT_MEMORY_AND_IO;
825 843
826 tuple.Attributes = 0; 844 if (pcmcia_loop_config(p_dev, if_cs_ioprobe, NULL)) {
827 tuple.TupleData = buf; 845 lbs_pr_err("error in pcmcia_loop_config\n");
828 tuple.TupleDataMax = sizeof(buf);
829 tuple.TupleOffset = 0;
830
831 tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY;
832 if ((ret = pcmcia_get_first_tuple(p_dev, &tuple)) != 0 ||
833 (ret = pcmcia_get_tuple_data(p_dev, &tuple)) != 0 ||
834 (ret = pcmcia_parse_tuple(&tuple, &parse)) != 0)
835 {
836 lbs_pr_err("error in pcmcia_get_first_tuple etc\n");
837 goto out1;
838 }
839
840 p_dev->conf.ConfigIndex = cfg->index;
841
842 /* Do we need to allocate an interrupt? */
843 if (cfg->irq.IRQInfo1) {
844 p_dev->conf.Attributes |= CONF_ENABLE_IRQ;
845 }
846
847 /* IO window settings */
848 if (cfg->io.nwin != 1) {
849 lbs_pr_err("wrong CIS (check number of IO windows)\n");
850 ret = -ENODEV;
851 goto out1; 846 goto out1;
852 } 847 }
853 p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO;
854 p_dev->io.BasePort1 = io->win[0].base;
855 p_dev->io.NumPorts1 = io->win[0].len;
856 848
857 /* This reserves IO space but doesn't actually enable it */
858 ret = pcmcia_request_io(p_dev, &p_dev->io);
859 if (ret) {
860 lbs_pr_err("error in pcmcia_request_io\n");
861 goto out1;
862 }
863 849
864 /* 850 /*
865 * Allocate an interrupt line. Note that this does not assign 851 * Allocate an interrupt line. Note that this does not assign
diff --git a/drivers/net/wireless/netwave_cs.c b/drivers/net/wireless/netwave_cs.c
index 9498b46c99a4..e61e6b9440ab 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));
@@ -401,8 +384,7 @@ static int netwave_probe(struct pcmcia_device *link)
401 link->io.IOAddrLines = 5; 384 link->io.IOAddrLines = 5;
402 385
403 /* Interrupt setup */ 386 /* Interrupt setup */
404 link->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING | IRQ_HANDLE_PRESENT; 387 link->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING;
405 link->irq.IRQInfo1 = IRQ_LEVEL_ID;
406 link->irq.Handler = &netwave_interrupt; 388 link->irq.Handler = &netwave_interrupt;
407 389
408 /* General socket configuration */ 390 /* General socket configuration */
@@ -421,8 +403,6 @@ static int netwave_probe(struct pcmcia_device *link)
421 403
422 dev->watchdog_timeo = TX_TIMEOUT; 404 dev->watchdog_timeo = TX_TIMEOUT;
423 405
424 link->irq.Instance = dev;
425
426 return netwave_pcmcia_config( link); 406 return netwave_pcmcia_config( link);
427} /* netwave_attach */ 407} /* netwave_attach */
428 408
@@ -438,7 +418,7 @@ static void netwave_detach(struct pcmcia_device *link)
438{ 418{
439 struct net_device *dev = link->priv; 419 struct net_device *dev = link->priv;
440 420
441 DEBUG(0, "netwave_detach(0x%p)\n", link); 421 dev_dbg(&link->dev, "netwave_detach\n");
442 422
443 netwave_release(link); 423 netwave_release(link);
444 424
@@ -725,18 +705,15 @@ static const struct iw_handler_def netwave_handler_def =
725 * 705 *
726 */ 706 */
727 707
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) { 708static int netwave_pcmcia_config(struct pcmcia_device *link) {
732 struct net_device *dev = link->priv; 709 struct net_device *dev = link->priv;
733 netwave_private *priv = netdev_priv(dev); 710 netwave_private *priv = netdev_priv(dev);
734 int i, j, last_ret, last_fn; 711 int i, j, ret;
735 win_req_t req; 712 win_req_t req;
736 memreq_t mem; 713 memreq_t mem;
737 u_char __iomem *ramBase = NULL; 714 u_char __iomem *ramBase = NULL;
738 715
739 DEBUG(0, "netwave_pcmcia_config(0x%p)\n", link); 716 dev_dbg(&link->dev, "netwave_pcmcia_config\n");
740 717
741 /* 718 /*
742 * Try allocating IO ports. This tries a few fixed addresses. 719 * Try allocating IO ports. This tries a few fixed addresses.
@@ -749,22 +726,24 @@ static int netwave_pcmcia_config(struct pcmcia_device *link) {
749 if (i == 0) 726 if (i == 0)
750 break; 727 break;
751 } 728 }
752 if (i != 0) { 729 if (i != 0)
753 cs_error(link, RequestIO, i);
754 goto failed; 730 goto failed;
755 }
756 731
757 /* 732 /*
758 * Now allocate an interrupt line. Note that this does not 733 * Now allocate an interrupt line. Note that this does not
759 * actually assign a handler to the interrupt. 734 * actually assign a handler to the interrupt.
760 */ 735 */
761 CS_CHECK(RequestIRQ, pcmcia_request_irq(link, &link->irq)); 736 ret = pcmcia_request_irq(link, &link->irq);
737 if (ret)
738 goto failed;
762 739
763 /* 740 /*
764 * This actually configures the PCMCIA socket -- setting up 741 * This actually configures the PCMCIA socket -- setting up
765 * the I/O windows and the interrupt mapping. 742 * the I/O windows and the interrupt mapping.
766 */ 743 */
767 CS_CHECK(RequestConfiguration, pcmcia_request_configuration(link, &link->conf)); 744 ret = pcmcia_request_configuration(link, &link->conf);
745 if (ret)
746 goto failed;
768 747
769 /* 748 /*
770 * Allocate a 32K memory window. Note that the struct pcmcia_device 749 * Allocate a 32K memory window. Note that the struct pcmcia_device
@@ -772,14 +751,18 @@ static int netwave_pcmcia_config(struct pcmcia_device *link) {
772 * device needs several windows, you'll need to keep track of 751 * device needs several windows, you'll need to keep track of
773 * the handles in your private data structure, dev->priv. 752 * the handles in your private data structure, dev->priv.
774 */ 753 */
775 DEBUG(1, "Setting mem speed of %d\n", mem_speed); 754 dev_dbg(&link->dev, "Setting mem speed of %d\n", mem_speed);
776 755
777 req.Attributes = WIN_DATA_WIDTH_8|WIN_MEMORY_TYPE_CM|WIN_ENABLE; 756 req.Attributes = WIN_DATA_WIDTH_8|WIN_MEMORY_TYPE_CM|WIN_ENABLE;
778 req.Base = 0; req.Size = 0x8000; 757 req.Base = 0; req.Size = 0x8000;
779 req.AccessSpeed = mem_speed; 758 req.AccessSpeed = mem_speed;
780 CS_CHECK(RequestWindow, pcmcia_request_window(&link, &req, &link->win)); 759 ret = pcmcia_request_window(link, &req, &link->win);
760 if (ret)
761 goto failed;
781 mem.CardOffset = 0x20000; mem.Page = 0; 762 mem.CardOffset = 0x20000; mem.Page = 0;
782 CS_CHECK(MapMemPage, pcmcia_map_mem_page(link->win, &mem)); 763 ret = pcmcia_map_mem_page(link, link->win, &mem);
764 if (ret)
765 goto failed;
783 766
784 /* Store base address of the common window frame */ 767 /* Store base address of the common window frame */
785 ramBase = ioremap(req.Base, 0x8000); 768 ramBase = ioremap(req.Base, 0x8000);
@@ -787,7 +770,7 @@ static int netwave_pcmcia_config(struct pcmcia_device *link) {
787 770
788 dev->irq = link->irq.AssignedIRQ; 771 dev->irq = link->irq.AssignedIRQ;
789 dev->base_addr = link->io.BasePort1; 772 dev->base_addr = link->io.BasePort1;
790 SET_NETDEV_DEV(dev, &handle_to_dev(link)); 773 SET_NETDEV_DEV(dev, &link->dev);
791 774
792 if (register_netdev(dev) != 0) { 775 if (register_netdev(dev) != 0) {
793 printk(KERN_DEBUG "netwave_cs: register_netdev() failed\n"); 776 printk(KERN_DEBUG "netwave_cs: register_netdev() failed\n");
@@ -818,8 +801,6 @@ static int netwave_pcmcia_config(struct pcmcia_device *link) {
818 get_uint16(ramBase + NETWAVE_EREG_ARW+2)); 801 get_uint16(ramBase + NETWAVE_EREG_ARW+2));
819 return 0; 802 return 0;
820 803
821cs_failed:
822 cs_error(link, last_fn, last_ret);
823failed: 804failed:
824 netwave_release(link); 805 netwave_release(link);
825 return -ENODEV; 806 return -ENODEV;
@@ -837,7 +818,7 @@ static void netwave_release(struct pcmcia_device *link)
837 struct net_device *dev = link->priv; 818 struct net_device *dev = link->priv;
838 netwave_private *priv = netdev_priv(dev); 819 netwave_private *priv = netdev_priv(dev);
839 820
840 DEBUG(0, "netwave_release(0x%p)\n", link); 821 dev_dbg(&link->dev, "netwave_release\n");
841 822
842 pcmcia_disable_device(link); 823 pcmcia_disable_device(link);
843 if (link->win) 824 if (link->win)
@@ -892,7 +873,7 @@ static void netwave_reset(struct net_device *dev) {
892 u_char __iomem *ramBase = priv->ramBase; 873 u_char __iomem *ramBase = priv->ramBase;
893 unsigned int iobase = dev->base_addr; 874 unsigned int iobase = dev->base_addr;
894 875
895 DEBUG(0, "netwave_reset: Done with hardware reset\n"); 876 pr_debug("netwave_reset: Done with hardware reset\n");
896 877
897 priv->timeoutCounter = 0; 878 priv->timeoutCounter = 0;
898 879
@@ -988,7 +969,7 @@ static int netwave_hw_xmit(unsigned char* data, int len,
988 969
989 dev->stats.tx_bytes += len; 970 dev->stats.tx_bytes += len;
990 971
991 DEBUG(3, "Transmitting with SPCQ %x SPU %x LIF %x ISPLQ %x\n", 972 pr_debug("Transmitting with SPCQ %x SPU %x LIF %x ISPLQ %x\n",
992 readb(ramBase + NETWAVE_EREG_SPCQ), 973 readb(ramBase + NETWAVE_EREG_SPCQ),
993 readb(ramBase + NETWAVE_EREG_SPU), 974 readb(ramBase + NETWAVE_EREG_SPU),
994 readb(ramBase + NETWAVE_EREG_LIF), 975 readb(ramBase + NETWAVE_EREG_LIF),
@@ -1000,7 +981,7 @@ static int netwave_hw_xmit(unsigned char* data, int len,
1000 MaxData = get_uint16(ramBase + NETWAVE_EREG_TDP+2); 981 MaxData = get_uint16(ramBase + NETWAVE_EREG_TDP+2);
1001 DataOffset = get_uint16(ramBase + NETWAVE_EREG_TDP+4); 982 DataOffset = get_uint16(ramBase + NETWAVE_EREG_TDP+4);
1002 983
1003 DEBUG(3, "TxFreeList %x, MaxData %x, DataOffset %x\n", 984 pr_debug("TxFreeList %x, MaxData %x, DataOffset %x\n",
1004 TxFreeList, MaxData, DataOffset); 985 TxFreeList, MaxData, DataOffset);
1005 986
1006 /* Copy packet to the adapter fragment buffers */ 987 /* Copy packet to the adapter fragment buffers */
@@ -1088,7 +1069,7 @@ static irqreturn_t netwave_interrupt(int irq, void* dev_id)
1088 status = inb(iobase + NETWAVE_REG_ASR); 1069 status = inb(iobase + NETWAVE_REG_ASR);
1089 1070
1090 if (!pcmcia_dev_present(link)) { 1071 if (!pcmcia_dev_present(link)) {
1091 DEBUG(1, "netwave_interrupt: Interrupt with status 0x%x " 1072 pr_debug("netwave_interrupt: Interrupt with status 0x%x "
1092 "from removed or suspended card!\n", status); 1073 "from removed or suspended card!\n", status);
1093 break; 1074 break;
1094 } 1075 }
@@ -1132,7 +1113,7 @@ static irqreturn_t netwave_interrupt(int irq, void* dev_id)
1132 int txStatus; 1113 int txStatus;
1133 1114
1134 txStatus = readb(ramBase + NETWAVE_EREG_TSER); 1115 txStatus = readb(ramBase + NETWAVE_EREG_TSER);
1135 DEBUG(3, "Transmit done. TSER = %x id %x\n", 1116 pr_debug("Transmit done. TSER = %x id %x\n",
1136 txStatus, readb(ramBase + NETWAVE_EREG_TSER + 1)); 1117 txStatus, readb(ramBase + NETWAVE_EREG_TSER + 1));
1137 1118
1138 if (txStatus & 0x20) { 1119 if (txStatus & 0x20) {
@@ -1156,7 +1137,7 @@ static irqreturn_t netwave_interrupt(int irq, void* dev_id)
1156 * TxGU and TxNOAP is set. (Those are the only ones 1137 * TxGU and TxNOAP is set. (Those are the only ones
1157 * to set TxErr). 1138 * to set TxErr).
1158 */ 1139 */
1159 DEBUG(3, "netwave_interrupt: TxDN with error status %x\n", 1140 pr_debug("netwave_interrupt: TxDN with error status %x\n",
1160 txStatus); 1141 txStatus);
1161 1142
1162 /* Clear out TxGU, TxNOAP, TxErr and TxTrys */ 1143 /* Clear out TxGU, TxNOAP, TxErr and TxTrys */
@@ -1164,7 +1145,7 @@ static irqreturn_t netwave_interrupt(int irq, void* dev_id)
1164 writeb(0xdf & txStatus, ramBase+NETWAVE_EREG_TSER+4); 1145 writeb(0xdf & txStatus, ramBase+NETWAVE_EREG_TSER+4);
1165 ++dev->stats.tx_errors; 1146 ++dev->stats.tx_errors;
1166 } 1147 }
1167 DEBUG(3, "New status is TSER %x ASR %x\n", 1148 pr_debug("New status is TSER %x ASR %x\n",
1168 readb(ramBase + NETWAVE_EREG_TSER), 1149 readb(ramBase + NETWAVE_EREG_TSER),
1169 inb(iobase + NETWAVE_REG_ASR)); 1150 inb(iobase + NETWAVE_REG_ASR));
1170 1151
@@ -1172,7 +1153,7 @@ static irqreturn_t netwave_interrupt(int irq, void* dev_id)
1172 } 1153 }
1173 /* TxBA, this would trigger on all error packets received */ 1154 /* TxBA, this would trigger on all error packets received */
1174 /* if (status & 0x01) { 1155 /* if (status & 0x01) {
1175 DEBUG(4, "Transmit buffers available, %x\n", status); 1156 pr_debug("Transmit buffers available, %x\n", status);
1176 } 1157 }
1177 */ 1158 */
1178 } 1159 }
@@ -1190,7 +1171,7 @@ static irqreturn_t netwave_interrupt(int irq, void* dev_id)
1190 */ 1171 */
1191static void netwave_watchdog(struct net_device *dev) { 1172static void netwave_watchdog(struct net_device *dev) {
1192 1173
1193 DEBUG(1, "%s: netwave_watchdog: watchdog timer expired\n", dev->name); 1174 pr_debug("%s: netwave_watchdog: watchdog timer expired\n", dev->name);
1194 netwave_reset(dev); 1175 netwave_reset(dev);
1195 dev->trans_start = jiffies; 1176 dev->trans_start = jiffies;
1196 netif_wake_queue(dev); 1177 netif_wake_queue(dev);
@@ -1211,7 +1192,7 @@ static int netwave_rx(struct net_device *dev)
1211 int i; 1192 int i;
1212 u_char *ptr; 1193 u_char *ptr;
1213 1194
1214 DEBUG(3, "xinw_rx: Receiving ... \n"); 1195 pr_debug("xinw_rx: Receiving ... \n");
1215 1196
1216 /* Receive max 10 packets for now. */ 1197 /* Receive max 10 packets for now. */
1217 for (i = 0; i < 10; i++) { 1198 for (i = 0; i < 10; i++) {
@@ -1237,7 +1218,7 @@ static int netwave_rx(struct net_device *dev)
1237 1218
1238 skb = dev_alloc_skb(rcvLen+5); 1219 skb = dev_alloc_skb(rcvLen+5);
1239 if (skb == NULL) { 1220 if (skb == NULL) {
1240 DEBUG(1, "netwave_rx: Could not allocate an sk_buff of " 1221 pr_debug("netwave_rx: Could not allocate an sk_buff of "
1241 "length %d\n", rcvLen); 1222 "length %d\n", rcvLen);
1242 ++dev->stats.rx_dropped; 1223 ++dev->stats.rx_dropped;
1243 /* Tell the adapter to skip the packet */ 1224 /* Tell the adapter to skip the packet */
@@ -1279,7 +1260,7 @@ static int netwave_rx(struct net_device *dev)
1279 wait_WOC(iobase); 1260 wait_WOC(iobase);
1280 writeb(NETWAVE_CMD_SRP, ramBase + NETWAVE_EREG_CB + 0); 1261 writeb(NETWAVE_CMD_SRP, ramBase + NETWAVE_EREG_CB + 0);
1281 writeb(NETWAVE_CMD_EOC, ramBase + NETWAVE_EREG_CB + 1); 1262 writeb(NETWAVE_CMD_EOC, ramBase + NETWAVE_EREG_CB + 1);
1282 DEBUG(3, "Packet reception ok\n"); 1263 pr_debug("Packet reception ok\n");
1283 } 1264 }
1284 return 0; 1265 return 0;
1285} 1266}
@@ -1288,7 +1269,7 @@ static int netwave_open(struct net_device *dev) {
1288 netwave_private *priv = netdev_priv(dev); 1269 netwave_private *priv = netdev_priv(dev);
1289 struct pcmcia_device *link = priv->p_dev; 1270 struct pcmcia_device *link = priv->p_dev;
1290 1271
1291 DEBUG(1, "netwave_open: starting.\n"); 1272 dev_dbg(&link->dev, "netwave_open: starting.\n");
1292 1273
1293 if (!pcmcia_dev_present(link)) 1274 if (!pcmcia_dev_present(link))
1294 return -ENODEV; 1275 return -ENODEV;
@@ -1305,7 +1286,7 @@ static int netwave_close(struct net_device *dev) {
1305 netwave_private *priv = netdev_priv(dev); 1286 netwave_private *priv = netdev_priv(dev);
1306 struct pcmcia_device *link = priv->p_dev; 1287 struct pcmcia_device *link = priv->p_dev;
1307 1288
1308 DEBUG(1, "netwave_close: finishing.\n"); 1289 dev_dbg(&link->dev, "netwave_close: finishing.\n");
1309 1290
1310 link->open--; 1291 link->open--;
1311 netif_stop_queue(dev); 1292 netif_stop_queue(dev);
@@ -1358,11 +1339,11 @@ static void set_multicast_list(struct net_device *dev)
1358 u_char rcvMode = 0; 1339 u_char rcvMode = 0;
1359 1340
1360#ifdef PCMCIA_DEBUG 1341#ifdef PCMCIA_DEBUG
1361 if (pc_debug > 2) { 1342 {
1362 static int old; 1343 xstatic int old;
1363 if (old != dev->mc_count) { 1344 if (old != dev->mc_count) {
1364 old = dev->mc_count; 1345 old = dev->mc_count;
1365 DEBUG(0, "%s: setting Rx mode to %d addresses.\n", 1346 pr_debug("%s: setting Rx mode to %d addresses.\n",
1366 dev->name, dev->mc_count); 1347 dev->name, dev->mc_count);
1367 } 1348 }
1368 } 1349 }
diff --git a/drivers/net/wireless/orinoco/orinoco_cs.c b/drivers/net/wireless/orinoco/orinoco_cs.c
index 38c1c9d2abb8..f27bb8367c98 100644
--- a/drivers/net/wireless/orinoco/orinoco_cs.c
+++ b/drivers/net/wireless/orinoco/orinoco_cs.c
@@ -109,7 +109,7 @@ orinoco_cs_probe(struct pcmcia_device *link)
109 struct orinoco_private *priv; 109 struct orinoco_private *priv;
110 struct orinoco_pccard *card; 110 struct orinoco_pccard *card;
111 111
112 priv = alloc_orinocodev(sizeof(*card), &handle_to_dev(link), 112 priv = alloc_orinocodev(sizeof(*card), &link->dev,
113 orinoco_cs_hard_reset, NULL); 113 orinoco_cs_hard_reset, NULL);
114 if (!priv) 114 if (!priv)
115 return -ENOMEM; 115 return -ENOMEM;
@@ -120,10 +120,8 @@ orinoco_cs_probe(struct pcmcia_device *link)
120 link->priv = priv; 120 link->priv = priv;
121 121
122 /* Interrupt setup */ 122 /* Interrupt setup */
123 link->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING | IRQ_HANDLE_PRESENT; 123 link->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING;
124 link->irq.IRQInfo1 = IRQ_LEVEL_ID;
125 link->irq.Handler = orinoco_interrupt; 124 link->irq.Handler = orinoco_interrupt;
126 link->irq.Instance = priv;
127 125
128 /* General socket configuration defaults can go here. In this 126 /* General socket configuration defaults can go here. In this
129 * client, we assume very little, and rely on the CIS for 127 * client, we assume very little, and rely on the CIS for
@@ -160,12 +158,6 @@ static void orinoco_cs_detach(struct pcmcia_device *link)
160 * device available to the system. 158 * device available to the system.
161 */ 159 */
162 160
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, 161static int orinoco_cs_config_check(struct pcmcia_device *p_dev,
170 cistpl_cftable_entry_t *cfg, 162 cistpl_cftable_entry_t *cfg,
171 cistpl_cftable_entry_t *dflt, 163 cistpl_cftable_entry_t *dflt,
@@ -240,7 +232,7 @@ orinoco_cs_config(struct pcmcia_device *link)
240 struct orinoco_private *priv = link->priv; 232 struct orinoco_private *priv = link->priv;
241 struct orinoco_pccard *card = priv->card; 233 struct orinoco_pccard *card = priv->card;
242 hermes_t *hw = &priv->hw; 234 hermes_t *hw = &priv->hw;
243 int last_fn, last_ret; 235 int ret;
244 void __iomem *mem; 236 void __iomem *mem;
245 237
246 /* 238 /*
@@ -257,13 +249,12 @@ orinoco_cs_config(struct pcmcia_device *link)
257 * and most client drivers will only use the CIS to fill in 249 * and most client drivers will only use the CIS to fill in
258 * implementation-defined details. 250 * implementation-defined details.
259 */ 251 */
260 last_ret = pcmcia_loop_config(link, orinoco_cs_config_check, NULL); 252 ret = pcmcia_loop_config(link, orinoco_cs_config_check, NULL);
261 if (last_ret) { 253 if (ret) {
262 if (!ignore_cis_vcc) 254 if (!ignore_cis_vcc)
263 printk(KERN_ERR PFX "GetNextTuple(): No matching " 255 printk(KERN_ERR PFX "GetNextTuple(): No matching "
264 "CIS configuration. Maybe you need the " 256 "CIS configuration. Maybe you need the "
265 "ignore_cis_vcc=1 parameter.\n"); 257 "ignore_cis_vcc=1 parameter.\n");
266 cs_error(link, RequestIO, last_ret);
267 goto failed; 258 goto failed;
268 } 259 }
269 260
@@ -272,14 +263,16 @@ orinoco_cs_config(struct pcmcia_device *link)
272 * a handler to the interrupt, unless the 'Handler' member of 263 * a handler to the interrupt, unless the 'Handler' member of
273 * the irq structure is initialized. 264 * the irq structure is initialized.
274 */ 265 */
275 CS_CHECK(RequestIRQ, pcmcia_request_irq(link, &link->irq)); 266 ret = pcmcia_request_irq(link, &link->irq);
267 if (ret)
268 goto failed;
276 269
277 /* We initialize the hermes structure before completing PCMCIA 270 /* We initialize the hermes structure before completing PCMCIA
278 * configuration just in case the interrupt handler gets 271 * configuration just in case the interrupt handler gets
279 * called. */ 272 * called. */
280 mem = ioport_map(link->io.BasePort1, link->io.NumPorts1); 273 mem = ioport_map(link->io.BasePort1, link->io.NumPorts1);
281 if (!mem) 274 if (!mem)
282 goto cs_failed; 275 goto failed;
283 276
284 hermes_struct_init(hw, mem, HERMES_16BIT_REGSPACING); 277 hermes_struct_init(hw, mem, HERMES_16BIT_REGSPACING);
285 278
@@ -288,8 +281,9 @@ orinoco_cs_config(struct pcmcia_device *link)
288 * the I/O windows and the interrupt mapping, and putting the 281 * the I/O windows and the interrupt mapping, and putting the
289 * card and host interface into "Memory and IO" mode. 282 * card and host interface into "Memory and IO" mode.
290 */ 283 */
291 CS_CHECK(RequestConfiguration, 284 ret = pcmcia_request_configuration(link, &link->conf);
292 pcmcia_request_configuration(link, &link->conf)); 285 if (ret)
286 goto failed;
293 287
294 /* Ok, we have the configuration, prepare to register the netdev */ 288 /* Ok, we have the configuration, prepare to register the netdev */
295 card->node.major = card->node.minor = 0; 289 card->node.major = card->node.minor = 0;
@@ -315,9 +309,6 @@ orinoco_cs_config(struct pcmcia_device *link)
315 * net_device has been registered */ 309 * net_device has been registered */
316 return 0; 310 return 0;
317 311
318 cs_failed:
319 cs_error(link, last_fn, last_ret);
320
321 failed: 312 failed:
322 orinoco_cs_release(link); 313 orinoco_cs_release(link);
323 return -ENODEV; 314 return -ENODEV;
diff --git a/drivers/net/wireless/orinoco/spectrum_cs.c b/drivers/net/wireless/orinoco/spectrum_cs.c
index c361310b885d..59bda240fdc2 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
@@ -181,7 +182,7 @@ spectrum_cs_probe(struct pcmcia_device *link)
181 struct orinoco_private *priv; 182 struct orinoco_private *priv;
182 struct orinoco_pccard *card; 183 struct orinoco_pccard *card;
183 184
184 priv = alloc_orinocodev(sizeof(*card), &handle_to_dev(link), 185 priv = alloc_orinocodev(sizeof(*card), &link->dev,
185 spectrum_cs_hard_reset, 186 spectrum_cs_hard_reset,
186 spectrum_cs_stop_firmware); 187 spectrum_cs_stop_firmware);
187 if (!priv) 188 if (!priv)
@@ -193,10 +194,8 @@ spectrum_cs_probe(struct pcmcia_device *link)
193 link->priv = priv; 194 link->priv = priv;
194 195
195 /* Interrupt setup */ 196 /* Interrupt setup */
196 link->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING | IRQ_HANDLE_PRESENT; 197 link->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING;
197 link->irq.IRQInfo1 = IRQ_LEVEL_ID;
198 link->irq.Handler = orinoco_interrupt; 198 link->irq.Handler = orinoco_interrupt;
199 link->irq.Instance = priv;
200 199
201 /* General socket configuration defaults can go here. In this 200 /* General socket configuration defaults can go here. In this
202 * client, we assume very little, and rely on the CIS for 201 * client, we assume very little, and rely on the CIS for
@@ -307,7 +306,7 @@ spectrum_cs_config(struct pcmcia_device *link)
307 struct orinoco_private *priv = link->priv; 306 struct orinoco_private *priv = link->priv;
308 struct orinoco_pccard *card = priv->card; 307 struct orinoco_pccard *card = priv->card;
309 hermes_t *hw = &priv->hw; 308 hermes_t *hw = &priv->hw;
310 int last_fn, last_ret; 309 int ret;
311 void __iomem *mem; 310 void __iomem *mem;
312 311
313 /* 312 /*
@@ -324,13 +323,12 @@ spectrum_cs_config(struct pcmcia_device *link)
324 * and most client drivers will only use the CIS to fill in 323 * and most client drivers will only use the CIS to fill in
325 * implementation-defined details. 324 * implementation-defined details.
326 */ 325 */
327 last_ret = pcmcia_loop_config(link, spectrum_cs_config_check, NULL); 326 ret = pcmcia_loop_config(link, spectrum_cs_config_check, NULL);
328 if (last_ret) { 327 if (ret) {
329 if (!ignore_cis_vcc) 328 if (!ignore_cis_vcc)
330 printk(KERN_ERR PFX "GetNextTuple(): No matching " 329 printk(KERN_ERR PFX "GetNextTuple(): No matching "
331 "CIS configuration. Maybe you need the " 330 "CIS configuration. Maybe you need the "
332 "ignore_cis_vcc=1 parameter.\n"); 331 "ignore_cis_vcc=1 parameter.\n");
333 cs_error(link, RequestIO, last_ret);
334 goto failed; 332 goto failed;
335 } 333 }
336 334
@@ -339,14 +337,16 @@ spectrum_cs_config(struct pcmcia_device *link)
339 * a handler to the interrupt, unless the 'Handler' member of 337 * a handler to the interrupt, unless the 'Handler' member of
340 * the irq structure is initialized. 338 * the irq structure is initialized.
341 */ 339 */
342 CS_CHECK(RequestIRQ, pcmcia_request_irq(link, &link->irq)); 340 ret = pcmcia_request_irq(link, &link->irq);
341 if (ret)
342 goto failed;
343 343
344 /* We initialize the hermes structure before completing PCMCIA 344 /* We initialize the hermes structure before completing PCMCIA
345 * configuration just in case the interrupt handler gets 345 * configuration just in case the interrupt handler gets
346 * called. */ 346 * called. */
347 mem = ioport_map(link->io.BasePort1, link->io.NumPorts1); 347 mem = ioport_map(link->io.BasePort1, link->io.NumPorts1);
348 if (!mem) 348 if (!mem)
349 goto cs_failed; 349 goto failed;
350 350
351 hermes_struct_init(hw, mem, HERMES_16BIT_REGSPACING); 351 hermes_struct_init(hw, mem, HERMES_16BIT_REGSPACING);
352 352
@@ -355,8 +355,9 @@ spectrum_cs_config(struct pcmcia_device *link)
355 * the I/O windows and the interrupt mapping, and putting the 355 * the I/O windows and the interrupt mapping, and putting the
356 * card and host interface into "Memory and IO" mode. 356 * card and host interface into "Memory and IO" mode.
357 */ 357 */
358 CS_CHECK(RequestConfiguration, 358 ret = pcmcia_request_configuration(link, &link->conf);
359 pcmcia_request_configuration(link, &link->conf)); 359 if (ret)
360 goto failed;
360 361
361 /* Ok, we have the configuration, prepare to register the netdev */ 362 /* Ok, we have the configuration, prepare to register the netdev */
362 card->node.major = card->node.minor = 0; 363 card->node.major = card->node.minor = 0;
@@ -386,9 +387,6 @@ spectrum_cs_config(struct pcmcia_device *link)
386 * net_device has been registered */ 387 * net_device has been registered */
387 return 0; 388 return 0;
388 389
389 cs_failed:
390 cs_error(link, last_fn, last_ret);
391
392 failed: 390 failed:
393 spectrum_cs_release(link); 391 spectrum_cs_release(link);
394 return -ENODEV; 392 return -ENODEV;
diff --git a/drivers/net/wireless/ray_cs.c b/drivers/net/wireless/ray_cs.c
index 1c88c2ea59aa..5b8e3e4cdd9f 100644
--- a/drivers/net/wireless/ray_cs.c
+++ b/drivers/net/wireless/ray_cs.c
@@ -71,25 +71,7 @@ typedef u_char mac_addr[ETH_ALEN]; /* Hardware address */
71#include "rayctl.h" 71#include "rayctl.h"
72#include "ray_cs.h" 72#include "ray_cs.h"
73 73
74/* All the PCMCIA modules use PCMCIA_DEBUG to control debugging. If
75 you do not define PCMCIA_DEBUG at all, all the debug code will be
76 left out. If you compile with PCMCIA_DEBUG=0, the debug code will
77 be present but disabled -- but it can then be enabled for specific
78 modules at load time with a 'pc_debug=#' option to insmod.
79*/
80 74
81#ifdef RAYLINK_DEBUG
82#define PCMCIA_DEBUG RAYLINK_DEBUG
83#endif
84#ifdef PCMCIA_DEBUG
85static int ray_debug;
86static int pc_debug = PCMCIA_DEBUG;
87module_param(pc_debug, int, 0);
88/* #define DEBUG(n, args...) if (pc_debug>(n)) printk(KERN_DEBUG args); */
89#define DEBUG(n, args...) if (pc_debug > (n)) printk(args);
90#else
91#define DEBUG(n, args...)
92#endif
93/** Prototypes based on PCMCIA skeleton driver *******************************/ 75/** Prototypes based on PCMCIA skeleton driver *******************************/
94static int ray_config(struct pcmcia_device *link); 76static int ray_config(struct pcmcia_device *link);
95static void ray_release(struct pcmcia_device *link); 77static void ray_release(struct pcmcia_device *link);
@@ -325,7 +307,7 @@ static int ray_probe(struct pcmcia_device *p_dev)
325 ray_dev_t *local; 307 ray_dev_t *local;
326 struct net_device *dev; 308 struct net_device *dev;
327 309
328 DEBUG(1, "ray_attach()\n"); 310 dev_dbg(&p_dev->dev, "ray_attach()\n");
329 311
330 /* Allocate space for private device-specific data */ 312 /* Allocate space for private device-specific data */
331 dev = alloc_etherdev(sizeof(ray_dev_t)); 313 dev = alloc_etherdev(sizeof(ray_dev_t));
@@ -341,8 +323,7 @@ static int ray_probe(struct pcmcia_device *p_dev)
341 p_dev->io.IOAddrLines = 5; 323 p_dev->io.IOAddrLines = 5;
342 324
343 /* Interrupt setup. For PCMCIA, driver takes what's given */ 325 /* Interrupt setup. For PCMCIA, driver takes what's given */
344 p_dev->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING | IRQ_HANDLE_PRESENT; 326 p_dev->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING;
345 p_dev->irq.IRQInfo1 = IRQ_LEVEL_ID;
346 p_dev->irq.Handler = &ray_interrupt; 327 p_dev->irq.Handler = &ray_interrupt;
347 328
348 /* General socket configuration */ 329 /* General socket configuration */
@@ -351,13 +332,12 @@ static int ray_probe(struct pcmcia_device *p_dev)
351 p_dev->conf.ConfigIndex = 1; 332 p_dev->conf.ConfigIndex = 1;
352 333
353 p_dev->priv = dev; 334 p_dev->priv = dev;
354 p_dev->irq.Instance = dev;
355 335
356 local->finder = p_dev; 336 local->finder = p_dev;
357 local->card_status = CARD_INSERTED; 337 local->card_status = CARD_INSERTED;
358 local->authentication_state = UNAUTHENTICATED; 338 local->authentication_state = UNAUTHENTICATED;
359 local->num_multi = 0; 339 local->num_multi = 0;
360 DEBUG(2, "ray_attach p_dev = %p, dev = %p, local = %p, intr = %p\n", 340 dev_dbg(&p_dev->dev, "ray_attach p_dev = %p, dev = %p, local = %p, intr = %p\n",
361 p_dev, dev, local, &ray_interrupt); 341 p_dev, dev, local, &ray_interrupt);
362 342
363 /* Raylink entries in the device structure */ 343 /* Raylink entries in the device structure */
@@ -370,7 +350,7 @@ static int ray_probe(struct pcmcia_device *p_dev)
370#endif /* WIRELESS_SPY */ 350#endif /* WIRELESS_SPY */
371 351
372 352
373 DEBUG(2, "ray_cs ray_attach calling ether_setup.)\n"); 353 dev_dbg(&p_dev->dev, "ray_cs ray_attach calling ether_setup.)\n");
374 netif_stop_queue(dev); 354 netif_stop_queue(dev);
375 355
376 init_timer(&local->timer); 356 init_timer(&local->timer);
@@ -393,7 +373,7 @@ static void ray_detach(struct pcmcia_device *link)
393 struct net_device *dev; 373 struct net_device *dev;
394 ray_dev_t *local; 374 ray_dev_t *local;
395 375
396 DEBUG(1, "ray_detach(0x%p)\n", link); 376 dev_dbg(&link->dev, "ray_detach\n");
397 377
398 this_device = NULL; 378 this_device = NULL;
399 dev = link->priv; 379 dev = link->priv;
@@ -408,7 +388,7 @@ static void ray_detach(struct pcmcia_device *link)
408 unregister_netdev(dev); 388 unregister_netdev(dev);
409 free_netdev(dev); 389 free_netdev(dev);
410 } 390 }
411 DEBUG(2, "ray_cs ray_detach ending\n"); 391 dev_dbg(&link->dev, "ray_cs ray_detach ending\n");
412} /* ray_detach */ 392} /* ray_detach */
413 393
414/*============================================================================= 394/*=============================================================================
@@ -416,19 +396,17 @@ static void ray_detach(struct pcmcia_device *link)
416 is received, to configure the PCMCIA socket, and to make the 396 is received, to configure the PCMCIA socket, and to make the
417 ethernet device available to the system. 397 ethernet device available to the system.
418=============================================================================*/ 398=============================================================================*/
419#define CS_CHECK(fn, ret) \
420do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0)
421#define MAX_TUPLE_SIZE 128 399#define MAX_TUPLE_SIZE 128
422static int ray_config(struct pcmcia_device *link) 400static int ray_config(struct pcmcia_device *link)
423{ 401{
424 int last_fn = 0, last_ret = 0; 402 int ret = 0;
425 int i; 403 int i;
426 win_req_t req; 404 win_req_t req;
427 memreq_t mem; 405 memreq_t mem;
428 struct net_device *dev = (struct net_device *)link->priv; 406 struct net_device *dev = (struct net_device *)link->priv;
429 ray_dev_t *local = netdev_priv(dev); 407 ray_dev_t *local = netdev_priv(dev);
430 408
431 DEBUG(1, "ray_config(0x%p)\n", link); 409 dev_dbg(&link->dev, "ray_config\n");
432 410
433 /* Determine card type and firmware version */ 411 /* Determine card type and firmware version */
434 printk(KERN_INFO "ray_cs Detected: %s%s%s%s\n", 412 printk(KERN_INFO "ray_cs Detected: %s%s%s%s\n",
@@ -440,14 +418,17 @@ static int ray_config(struct pcmcia_device *link)
440 /* Now allocate an interrupt line. Note that this does not 418 /* Now allocate an interrupt line. Note that this does not
441 actually assign a handler to the interrupt. 419 actually assign a handler to the interrupt.
442 */ 420 */
443 CS_CHECK(RequestIRQ, pcmcia_request_irq(link, &link->irq)); 421 ret = pcmcia_request_irq(link, &link->irq);
422 if (ret)
423 goto failed;
444 dev->irq = link->irq.AssignedIRQ; 424 dev->irq = link->irq.AssignedIRQ;
445 425
446 /* This actually configures the PCMCIA socket -- setting up 426 /* This actually configures the PCMCIA socket -- setting up
447 the I/O windows and the interrupt mapping. 427 the I/O windows and the interrupt mapping.
448 */ 428 */
449 CS_CHECK(RequestConfiguration, 429 ret = pcmcia_request_configuration(link, &link->conf);
450 pcmcia_request_configuration(link, &link->conf)); 430 if (ret)
431 goto failed;
451 432
452/*** Set up 32k window for shared memory (transmit and control) ************/ 433/*** Set up 32k window for shared memory (transmit and control) ************/
453 req.Attributes = 434 req.Attributes =
@@ -455,10 +436,14 @@ static int ray_config(struct pcmcia_device *link)
455 req.Base = 0; 436 req.Base = 0;
456 req.Size = 0x8000; 437 req.Size = 0x8000;
457 req.AccessSpeed = ray_mem_speed; 438 req.AccessSpeed = ray_mem_speed;
458 CS_CHECK(RequestWindow, pcmcia_request_window(&link, &req, &link->win)); 439 ret = pcmcia_request_window(link, &req, &link->win);
440 if (ret)
441 goto failed;
459 mem.CardOffset = 0x0000; 442 mem.CardOffset = 0x0000;
460 mem.Page = 0; 443 mem.Page = 0;
461 CS_CHECK(MapMemPage, pcmcia_map_mem_page(link->win, &mem)); 444 ret = pcmcia_map_mem_page(link, link->win, &mem);
445 if (ret)
446 goto failed;
462 local->sram = ioremap(req.Base, req.Size); 447 local->sram = ioremap(req.Base, req.Size);
463 448
464/*** Set up 16k window for shared memory (receive buffer) ***************/ 449/*** Set up 16k window for shared memory (receive buffer) ***************/
@@ -467,11 +452,14 @@ static int ray_config(struct pcmcia_device *link)
467 req.Base = 0; 452 req.Base = 0;
468 req.Size = 0x4000; 453 req.Size = 0x4000;
469 req.AccessSpeed = ray_mem_speed; 454 req.AccessSpeed = ray_mem_speed;
470 CS_CHECK(RequestWindow, 455 ret = pcmcia_request_window(link, &req, &local->rmem_handle);
471 pcmcia_request_window(&link, &req, &local->rmem_handle)); 456 if (ret)
457 goto failed;
472 mem.CardOffset = 0x8000; 458 mem.CardOffset = 0x8000;
473 mem.Page = 0; 459 mem.Page = 0;
474 CS_CHECK(MapMemPage, pcmcia_map_mem_page(local->rmem_handle, &mem)); 460 ret = pcmcia_map_mem_page(link, local->rmem_handle, &mem);
461 if (ret)
462 goto failed;
475 local->rmem = ioremap(req.Base, req.Size); 463 local->rmem = ioremap(req.Base, req.Size);
476 464
477/*** Set up window for attribute memory ***********************************/ 465/*** Set up window for attribute memory ***********************************/
@@ -480,22 +468,25 @@ static int ray_config(struct pcmcia_device *link)
480 req.Base = 0; 468 req.Base = 0;
481 req.Size = 0x1000; 469 req.Size = 0x1000;
482 req.AccessSpeed = ray_mem_speed; 470 req.AccessSpeed = ray_mem_speed;
483 CS_CHECK(RequestWindow, 471 ret = pcmcia_request_window(link, &req, &local->amem_handle);
484 pcmcia_request_window(&link, &req, &local->amem_handle)); 472 if (ret)
473 goto failed;
485 mem.CardOffset = 0x0000; 474 mem.CardOffset = 0x0000;
486 mem.Page = 0; 475 mem.Page = 0;
487 CS_CHECK(MapMemPage, pcmcia_map_mem_page(local->amem_handle, &mem)); 476 ret = pcmcia_map_mem_page(link, local->amem_handle, &mem);
477 if (ret)
478 goto failed;
488 local->amem = ioremap(req.Base, req.Size); 479 local->amem = ioremap(req.Base, req.Size);
489 480
490 DEBUG(3, "ray_config sram=%p\n", local->sram); 481 dev_dbg(&link->dev, "ray_config sram=%p\n", local->sram);
491 DEBUG(3, "ray_config rmem=%p\n", local->rmem); 482 dev_dbg(&link->dev, "ray_config rmem=%p\n", local->rmem);
492 DEBUG(3, "ray_config amem=%p\n", local->amem); 483 dev_dbg(&link->dev, "ray_config amem=%p\n", local->amem);
493 if (ray_init(dev) < 0) { 484 if (ray_init(dev) < 0) {
494 ray_release(link); 485 ray_release(link);
495 return -ENODEV; 486 return -ENODEV;
496 } 487 }
497 488
498 SET_NETDEV_DEV(dev, &handle_to_dev(link)); 489 SET_NETDEV_DEV(dev, &link->dev);
499 i = register_netdev(dev); 490 i = register_netdev(dev);
500 if (i != 0) { 491 if (i != 0) {
501 printk("ray_config register_netdev() failed\n"); 492 printk("ray_config register_netdev() failed\n");
@@ -511,9 +502,7 @@ static int ray_config(struct pcmcia_device *link)
511 502
512 return 0; 503 return 0;
513 504
514cs_failed: 505failed:
515 cs_error(link, last_fn, last_ret);
516
517 ray_release(link); 506 ray_release(link);
518 return -ENODEV; 507 return -ENODEV;
519} /* ray_config */ 508} /* ray_config */
@@ -543,9 +532,9 @@ static int ray_init(struct net_device *dev)
543 struct ccs __iomem *pccs; 532 struct ccs __iomem *pccs;
544 ray_dev_t *local = netdev_priv(dev); 533 ray_dev_t *local = netdev_priv(dev);
545 struct pcmcia_device *link = local->finder; 534 struct pcmcia_device *link = local->finder;
546 DEBUG(1, "ray_init(0x%p)\n", dev); 535 dev_dbg(&link->dev, "ray_init(0x%p)\n", dev);
547 if (!(pcmcia_dev_present(link))) { 536 if (!(pcmcia_dev_present(link))) {
548 DEBUG(0, "ray_init - device not present\n"); 537 dev_dbg(&link->dev, "ray_init - device not present\n");
549 return -1; 538 return -1;
550 } 539 }
551 540
@@ -567,13 +556,13 @@ static int ray_init(struct net_device *dev)
567 local->fw_ver = local->startup_res.firmware_version[0]; 556 local->fw_ver = local->startup_res.firmware_version[0];
568 local->fw_bld = local->startup_res.firmware_version[1]; 557 local->fw_bld = local->startup_res.firmware_version[1];
569 local->fw_var = local->startup_res.firmware_version[2]; 558 local->fw_var = local->startup_res.firmware_version[2];
570 DEBUG(1, "ray_init firmware version %d.%d \n", local->fw_ver, 559 dev_dbg(&link->dev, "ray_init firmware version %d.%d \n", local->fw_ver,
571 local->fw_bld); 560 local->fw_bld);
572 561
573 local->tib_length = 0x20; 562 local->tib_length = 0x20;
574 if ((local->fw_ver == 5) && (local->fw_bld >= 30)) 563 if ((local->fw_ver == 5) && (local->fw_bld >= 30))
575 local->tib_length = local->startup_res.tib_length; 564 local->tib_length = local->startup_res.tib_length;
576 DEBUG(2, "ray_init tib_length = 0x%02x\n", local->tib_length); 565 dev_dbg(&link->dev, "ray_init tib_length = 0x%02x\n", local->tib_length);
577 /* Initialize CCS's to buffer free state */ 566 /* Initialize CCS's to buffer free state */
578 pccs = ccs_base(local); 567 pccs = ccs_base(local);
579 for (i = 0; i < NUMBER_OF_CCS; i++) { 568 for (i = 0; i < NUMBER_OF_CCS; i++) {
@@ -592,7 +581,7 @@ static int ray_init(struct net_device *dev)
592 581
593 clear_interrupt(local); /* Clear any interrupt from the card */ 582 clear_interrupt(local); /* Clear any interrupt from the card */
594 local->card_status = CARD_AWAITING_PARAM; 583 local->card_status = CARD_AWAITING_PARAM;
595 DEBUG(2, "ray_init ending\n"); 584 dev_dbg(&link->dev, "ray_init ending\n");
596 return 0; 585 return 0;
597} /* ray_init */ 586} /* ray_init */
598 587
@@ -605,9 +594,9 @@ static int dl_startup_params(struct net_device *dev)
605 struct ccs __iomem *pccs; 594 struct ccs __iomem *pccs;
606 struct pcmcia_device *link = local->finder; 595 struct pcmcia_device *link = local->finder;
607 596
608 DEBUG(1, "dl_startup_params entered\n"); 597 dev_dbg(&link->dev, "dl_startup_params entered\n");
609 if (!(pcmcia_dev_present(link))) { 598 if (!(pcmcia_dev_present(link))) {
610 DEBUG(2, "ray_cs dl_startup_params - device not present\n"); 599 dev_dbg(&link->dev, "ray_cs dl_startup_params - device not present\n");
611 return -1; 600 return -1;
612 } 601 }
613 602
@@ -625,7 +614,7 @@ static int dl_startup_params(struct net_device *dev)
625 local->dl_param_ccs = ccsindex; 614 local->dl_param_ccs = ccsindex;
626 pccs = ccs_base(local) + ccsindex; 615 pccs = ccs_base(local) + ccsindex;
627 writeb(CCS_DOWNLOAD_STARTUP_PARAMS, &pccs->cmd); 616 writeb(CCS_DOWNLOAD_STARTUP_PARAMS, &pccs->cmd);
628 DEBUG(2, "dl_startup_params start ccsindex = %d\n", 617 dev_dbg(&link->dev, "dl_startup_params start ccsindex = %d\n",
629 local->dl_param_ccs); 618 local->dl_param_ccs);
630 /* Interrupt the firmware to process the command */ 619 /* Interrupt the firmware to process the command */
631 if (interrupt_ecf(local, ccsindex)) { 620 if (interrupt_ecf(local, ccsindex)) {
@@ -641,7 +630,7 @@ static int dl_startup_params(struct net_device *dev)
641 local->timer.data = (long)local; 630 local->timer.data = (long)local;
642 local->timer.function = &verify_dl_startup; 631 local->timer.function = &verify_dl_startup;
643 add_timer(&local->timer); 632 add_timer(&local->timer);
644 DEBUG(2, 633 dev_dbg(&link->dev,
645 "ray_cs dl_startup_params started timer for verify_dl_startup\n"); 634 "ray_cs dl_startup_params started timer for verify_dl_startup\n");
646 return 0; 635 return 0;
647} /* dl_startup_params */ 636} /* dl_startup_params */
@@ -717,11 +706,11 @@ static void verify_dl_startup(u_long data)
717 struct pcmcia_device *link = local->finder; 706 struct pcmcia_device *link = local->finder;
718 707
719 if (!(pcmcia_dev_present(link))) { 708 if (!(pcmcia_dev_present(link))) {
720 DEBUG(2, "ray_cs verify_dl_startup - device not present\n"); 709 dev_dbg(&link->dev, "ray_cs verify_dl_startup - device not present\n");
721 return; 710 return;
722 } 711 }
723#ifdef PCMCIA_DEBUG 712#if 0
724 if (pc_debug > 2) { 713 {
725 int i; 714 int i;
726 printk(KERN_DEBUG 715 printk(KERN_DEBUG
727 "verify_dl_startup parameters sent via ccs %d:\n", 716 "verify_dl_startup parameters sent via ccs %d:\n",
@@ -760,7 +749,7 @@ static void start_net(u_long data)
760 int ccsindex; 749 int ccsindex;
761 struct pcmcia_device *link = local->finder; 750 struct pcmcia_device *link = local->finder;
762 if (!(pcmcia_dev_present(link))) { 751 if (!(pcmcia_dev_present(link))) {
763 DEBUG(2, "ray_cs start_net - device not present\n"); 752 dev_dbg(&link->dev, "ray_cs start_net - device not present\n");
764 return; 753 return;
765 } 754 }
766 /* Fill in the CCS fields for the ECF */ 755 /* Fill in the CCS fields for the ECF */
@@ -771,7 +760,7 @@ static void start_net(u_long data)
771 writeb(0, &pccs->var.start_network.update_param); 760 writeb(0, &pccs->var.start_network.update_param);
772 /* Interrupt the firmware to process the command */ 761 /* Interrupt the firmware to process the command */
773 if (interrupt_ecf(local, ccsindex)) { 762 if (interrupt_ecf(local, ccsindex)) {
774 DEBUG(1, "ray start net failed - card not ready for intr\n"); 763 dev_dbg(&link->dev, "ray start net failed - card not ready for intr\n");
775 writeb(CCS_BUFFER_FREE, &(pccs++)->buffer_status); 764 writeb(CCS_BUFFER_FREE, &(pccs++)->buffer_status);
776 return; 765 return;
777 } 766 }
@@ -790,7 +779,7 @@ static void join_net(u_long data)
790 struct pcmcia_device *link = local->finder; 779 struct pcmcia_device *link = local->finder;
791 780
792 if (!(pcmcia_dev_present(link))) { 781 if (!(pcmcia_dev_present(link))) {
793 DEBUG(2, "ray_cs join_net - device not present\n"); 782 dev_dbg(&link->dev, "ray_cs join_net - device not present\n");
794 return; 783 return;
795 } 784 }
796 /* Fill in the CCS fields for the ECF */ 785 /* Fill in the CCS fields for the ECF */
@@ -802,7 +791,7 @@ static void join_net(u_long data)
802 writeb(0, &pccs->var.join_network.net_initiated); 791 writeb(0, &pccs->var.join_network.net_initiated);
803 /* Interrupt the firmware to process the command */ 792 /* Interrupt the firmware to process the command */
804 if (interrupt_ecf(local, ccsindex)) { 793 if (interrupt_ecf(local, ccsindex)) {
805 DEBUG(1, "ray join net failed - card not ready for intr\n"); 794 dev_dbg(&link->dev, "ray join net failed - card not ready for intr\n");
806 writeb(CCS_BUFFER_FREE, &(pccs++)->buffer_status); 795 writeb(CCS_BUFFER_FREE, &(pccs++)->buffer_status);
807 return; 796 return;
808 } 797 }
@@ -821,7 +810,7 @@ static void ray_release(struct pcmcia_device *link)
821 ray_dev_t *local = netdev_priv(dev); 810 ray_dev_t *local = netdev_priv(dev);
822 int i; 811 int i;
823 812
824 DEBUG(1, "ray_release(0x%p)\n", link); 813 dev_dbg(&link->dev, "ray_release\n");
825 814
826 del_timer(&local->timer); 815 del_timer(&local->timer);
827 816
@@ -829,15 +818,15 @@ static void ray_release(struct pcmcia_device *link)
829 iounmap(local->rmem); 818 iounmap(local->rmem);
830 iounmap(local->amem); 819 iounmap(local->amem);
831 /* Do bother checking to see if these succeed or not */ 820 /* Do bother checking to see if these succeed or not */
832 i = pcmcia_release_window(local->amem_handle); 821 i = pcmcia_release_window(link, local->amem_handle);
833 if (i != 0) 822 if (i != 0)
834 DEBUG(0, "ReleaseWindow(local->amem) ret = %x\n", i); 823 dev_dbg(&link->dev, "ReleaseWindow(local->amem) ret = %x\n", i);
835 i = pcmcia_release_window(local->rmem_handle); 824 i = pcmcia_release_window(link, local->rmem_handle);
836 if (i != 0) 825 if (i != 0)
837 DEBUG(0, "ReleaseWindow(local->rmem) ret = %x\n", i); 826 dev_dbg(&link->dev, "ReleaseWindow(local->rmem) ret = %x\n", i);
838 pcmcia_disable_device(link); 827 pcmcia_disable_device(link);
839 828
840 DEBUG(2, "ray_release ending\n"); 829 dev_dbg(&link->dev, "ray_release ending\n");
841} 830}
842 831
843static int ray_suspend(struct pcmcia_device *link) 832static int ray_suspend(struct pcmcia_device *link)
@@ -871,9 +860,9 @@ static int ray_dev_init(struct net_device *dev)
871 ray_dev_t *local = netdev_priv(dev); 860 ray_dev_t *local = netdev_priv(dev);
872 struct pcmcia_device *link = local->finder; 861 struct pcmcia_device *link = local->finder;
873 862
874 DEBUG(1, "ray_dev_init(dev=%p)\n", dev); 863 dev_dbg(&link->dev, "ray_dev_init(dev=%p)\n", dev);
875 if (!(pcmcia_dev_present(link))) { 864 if (!(pcmcia_dev_present(link))) {
876 DEBUG(2, "ray_dev_init - device not present\n"); 865 dev_dbg(&link->dev, "ray_dev_init - device not present\n");
877 return -1; 866 return -1;
878 } 867 }
879#ifdef RAY_IMMEDIATE_INIT 868#ifdef RAY_IMMEDIATE_INIT
@@ -887,7 +876,7 @@ static int ray_dev_init(struct net_device *dev)
887 /* Postpone the card init so that we can still configure the card, 876 /* Postpone the card init so that we can still configure the card,
888 * for example using the Wireless Extensions. The init will happen 877 * for example using the Wireless Extensions. The init will happen
889 * in ray_open() - Jean II */ 878 * in ray_open() - Jean II */
890 DEBUG(1, 879 dev_dbg(&link->dev,
891 "ray_dev_init: postponing card init to ray_open() ; Status = %d\n", 880 "ray_dev_init: postponing card init to ray_open() ; Status = %d\n",
892 local->card_status); 881 local->card_status);
893#endif /* RAY_IMMEDIATE_INIT */ 882#endif /* RAY_IMMEDIATE_INIT */
@@ -896,7 +885,7 @@ static int ray_dev_init(struct net_device *dev)
896 memcpy(dev->dev_addr, &local->sparm.b4.a_mac_addr, ADDRLEN); 885 memcpy(dev->dev_addr, &local->sparm.b4.a_mac_addr, ADDRLEN);
897 memset(dev->broadcast, 0xff, ETH_ALEN); 886 memset(dev->broadcast, 0xff, ETH_ALEN);
898 887
899 DEBUG(2, "ray_dev_init ending\n"); 888 dev_dbg(&link->dev, "ray_dev_init ending\n");
900 return 0; 889 return 0;
901} 890}
902 891
@@ -906,9 +895,9 @@ static int ray_dev_config(struct net_device *dev, struct ifmap *map)
906 ray_dev_t *local = netdev_priv(dev); 895 ray_dev_t *local = netdev_priv(dev);
907 struct pcmcia_device *link = local->finder; 896 struct pcmcia_device *link = local->finder;
908 /* Dummy routine to satisfy device structure */ 897 /* Dummy routine to satisfy device structure */
909 DEBUG(1, "ray_dev_config(dev=%p,ifmap=%p)\n", dev, map); 898 dev_dbg(&link->dev, "ray_dev_config(dev=%p,ifmap=%p)\n", dev, map);
910 if (!(pcmcia_dev_present(link))) { 899 if (!(pcmcia_dev_present(link))) {
911 DEBUG(2, "ray_dev_config - device not present\n"); 900 dev_dbg(&link->dev, "ray_dev_config - device not present\n");
912 return -1; 901 return -1;
913 } 902 }
914 903
@@ -924,14 +913,14 @@ static netdev_tx_t ray_dev_start_xmit(struct sk_buff *skb,
924 short length = skb->len; 913 short length = skb->len;
925 914
926 if (!pcmcia_dev_present(link)) { 915 if (!pcmcia_dev_present(link)) {
927 DEBUG(2, "ray_dev_start_xmit - device not present\n"); 916 dev_dbg(&link->dev, "ray_dev_start_xmit - device not present\n");
928 dev_kfree_skb(skb); 917 dev_kfree_skb(skb);
929 return NETDEV_TX_OK; 918 return NETDEV_TX_OK;
930 } 919 }
931 920
932 DEBUG(3, "ray_dev_start_xmit(skb=%p, dev=%p)\n", skb, dev); 921 dev_dbg(&link->dev, "ray_dev_start_xmit(skb=%p, dev=%p)\n", skb, dev);
933 if (local->authentication_state == NEED_TO_AUTH) { 922 if (local->authentication_state == NEED_TO_AUTH) {
934 DEBUG(0, "ray_cs Sending authentication request.\n"); 923 dev_dbg(&link->dev, "ray_cs Sending authentication request.\n");
935 if (!build_auth_frame(local, local->auth_id, OPEN_AUTH_REQUEST)) { 924 if (!build_auth_frame(local, local->auth_id, OPEN_AUTH_REQUEST)) {
936 local->authentication_state = AUTHENTICATED; 925 local->authentication_state = AUTHENTICATED;
937 netif_stop_queue(dev); 926 netif_stop_queue(dev);
@@ -971,7 +960,7 @@ static int ray_hw_xmit(unsigned char *data, int len, struct net_device *dev,
971 struct tx_msg __iomem *ptx; /* Address of xmit buffer in PC space */ 960 struct tx_msg __iomem *ptx; /* Address of xmit buffer in PC space */
972 short int addr; /* Address of xmit buffer in card space */ 961 short int addr; /* Address of xmit buffer in card space */
973 962
974 DEBUG(3, "ray_hw_xmit(data=%p, len=%d, dev=%p)\n", data, len, dev); 963 pr_debug("ray_hw_xmit(data=%p, len=%d, dev=%p)\n", data, len, dev);
975 if (len + TX_HEADER_LENGTH > TX_BUF_SIZE) { 964 if (len + TX_HEADER_LENGTH > TX_BUF_SIZE) {
976 printk(KERN_INFO "ray_hw_xmit packet too large: %d bytes\n", 965 printk(KERN_INFO "ray_hw_xmit packet too large: %d bytes\n",
977 len); 966 len);
@@ -979,9 +968,9 @@ static int ray_hw_xmit(unsigned char *data, int len, struct net_device *dev,
979 } 968 }
980 switch (ccsindex = get_free_tx_ccs(local)) { 969 switch (ccsindex = get_free_tx_ccs(local)) {
981 case ECCSBUSY: 970 case ECCSBUSY:
982 DEBUG(2, "ray_hw_xmit tx_ccs table busy\n"); 971 pr_debug("ray_hw_xmit tx_ccs table busy\n");
983 case ECCSFULL: 972 case ECCSFULL:
984 DEBUG(2, "ray_hw_xmit No free tx ccs\n"); 973 pr_debug("ray_hw_xmit No free tx ccs\n");
985 case ECARDGONE: 974 case ECARDGONE:
986 netif_stop_queue(dev); 975 netif_stop_queue(dev);
987 return XMIT_NO_CCS; 976 return XMIT_NO_CCS;
@@ -1018,12 +1007,12 @@ static int ray_hw_xmit(unsigned char *data, int len, struct net_device *dev,
1018 writeb(PSM_CAM, &pccs->var.tx_request.pow_sav_mode); 1007 writeb(PSM_CAM, &pccs->var.tx_request.pow_sav_mode);
1019 writeb(local->net_default_tx_rate, &pccs->var.tx_request.tx_rate); 1008 writeb(local->net_default_tx_rate, &pccs->var.tx_request.tx_rate);
1020 writeb(0, &pccs->var.tx_request.antenna); 1009 writeb(0, &pccs->var.tx_request.antenna);
1021 DEBUG(3, "ray_hw_xmit default_tx_rate = 0x%x\n", 1010 pr_debug("ray_hw_xmit default_tx_rate = 0x%x\n",
1022 local->net_default_tx_rate); 1011 local->net_default_tx_rate);
1023 1012
1024 /* Interrupt the firmware to process the command */ 1013 /* Interrupt the firmware to process the command */
1025 if (interrupt_ecf(local, ccsindex)) { 1014 if (interrupt_ecf(local, ccsindex)) {
1026 DEBUG(2, "ray_hw_xmit failed - ECF not ready for intr\n"); 1015 pr_debug("ray_hw_xmit failed - ECF not ready for intr\n");
1027/* TBD very inefficient to copy packet to buffer, and then not 1016/* TBD very inefficient to copy packet to buffer, and then not
1028 send it, but the alternative is to queue the messages and that 1017 send it, but the alternative is to queue the messages and that
1029 won't be done for a while. Maybe set tbusy until a CCS is free? 1018 won't be done for a while. Maybe set tbusy until a CCS is free?
@@ -1040,7 +1029,7 @@ static int translate_frame(ray_dev_t *local, struct tx_msg __iomem *ptx,
1040{ 1029{
1041 __be16 proto = ((struct ethhdr *)data)->h_proto; 1030 __be16 proto = ((struct ethhdr *)data)->h_proto;
1042 if (ntohs(proto) >= 1536) { /* DIX II ethernet frame */ 1031 if (ntohs(proto) >= 1536) { /* DIX II ethernet frame */
1043 DEBUG(3, "ray_cs translate_frame DIX II\n"); 1032 pr_debug("ray_cs translate_frame DIX II\n");
1044 /* Copy LLC header to card buffer */ 1033 /* Copy LLC header to card buffer */
1045 memcpy_toio(&ptx->var, eth2_llc, sizeof(eth2_llc)); 1034 memcpy_toio(&ptx->var, eth2_llc, sizeof(eth2_llc));
1046 memcpy_toio(((void __iomem *)&ptx->var) + sizeof(eth2_llc), 1035 memcpy_toio(((void __iomem *)&ptx->var) + sizeof(eth2_llc),
@@ -1056,9 +1045,9 @@ static int translate_frame(ray_dev_t *local, struct tx_msg __iomem *ptx,
1056 len - ETH_HLEN); 1045 len - ETH_HLEN);
1057 return (int)sizeof(struct snaphdr_t) - ETH_HLEN; 1046 return (int)sizeof(struct snaphdr_t) - ETH_HLEN;
1058 } else { /* already 802 type, and proto is length */ 1047 } else { /* already 802 type, and proto is length */
1059 DEBUG(3, "ray_cs translate_frame 802\n"); 1048 pr_debug("ray_cs translate_frame 802\n");
1060 if (proto == htons(0xffff)) { /* evil netware IPX 802.3 without LLC */ 1049 if (proto == htons(0xffff)) { /* evil netware IPX 802.3 without LLC */
1061 DEBUG(3, "ray_cs translate_frame evil IPX\n"); 1050 pr_debug("ray_cs translate_frame evil IPX\n");
1062 memcpy_toio(&ptx->var, data + ETH_HLEN, len - ETH_HLEN); 1051 memcpy_toio(&ptx->var, data + ETH_HLEN, len - ETH_HLEN);
1063 return 0 - ETH_HLEN; 1052 return 0 - ETH_HLEN;
1064 } 1053 }
@@ -1603,7 +1592,7 @@ static int ray_open(struct net_device *dev)
1603 struct pcmcia_device *link; 1592 struct pcmcia_device *link;
1604 link = local->finder; 1593 link = local->finder;
1605 1594
1606 DEBUG(1, "ray_open('%s')\n", dev->name); 1595 dev_dbg(&link->dev, "ray_open('%s')\n", dev->name);
1607 1596
1608 if (link->open == 0) 1597 if (link->open == 0)
1609 local->num_multi = 0; 1598 local->num_multi = 0;
@@ -1613,7 +1602,7 @@ static int ray_open(struct net_device *dev)
1613 if (local->card_status == CARD_AWAITING_PARAM) { 1602 if (local->card_status == CARD_AWAITING_PARAM) {
1614 int i; 1603 int i;
1615 1604
1616 DEBUG(1, "ray_open: doing init now !\n"); 1605 dev_dbg(&link->dev, "ray_open: doing init now !\n");
1617 1606
1618 /* Download startup parameters */ 1607 /* Download startup parameters */
1619 if ((i = dl_startup_params(dev)) < 0) { 1608 if ((i = dl_startup_params(dev)) < 0) {
@@ -1629,7 +1618,7 @@ static int ray_open(struct net_device *dev)
1629 else 1618 else
1630 netif_start_queue(dev); 1619 netif_start_queue(dev);
1631 1620
1632 DEBUG(2, "ray_open ending\n"); 1621 dev_dbg(&link->dev, "ray_open ending\n");
1633 return 0; 1622 return 0;
1634} /* end ray_open */ 1623} /* end ray_open */
1635 1624
@@ -1640,7 +1629,7 @@ static int ray_dev_close(struct net_device *dev)
1640 struct pcmcia_device *link; 1629 struct pcmcia_device *link;
1641 link = local->finder; 1630 link = local->finder;
1642 1631
1643 DEBUG(1, "ray_dev_close('%s')\n", dev->name); 1632 dev_dbg(&link->dev, "ray_dev_close('%s')\n", dev->name);
1644 1633
1645 link->open--; 1634 link->open--;
1646 netif_stop_queue(dev); 1635 netif_stop_queue(dev);
@@ -1656,7 +1645,7 @@ static int ray_dev_close(struct net_device *dev)
1656/*===========================================================================*/ 1645/*===========================================================================*/
1657static void ray_reset(struct net_device *dev) 1646static void ray_reset(struct net_device *dev)
1658{ 1647{
1659 DEBUG(1, "ray_reset entered\n"); 1648 pr_debug("ray_reset entered\n");
1660 return; 1649 return;
1661} 1650}
1662 1651
@@ -1669,17 +1658,17 @@ static int interrupt_ecf(ray_dev_t *local, int ccs)
1669 struct pcmcia_device *link = local->finder; 1658 struct pcmcia_device *link = local->finder;
1670 1659
1671 if (!(pcmcia_dev_present(link))) { 1660 if (!(pcmcia_dev_present(link))) {
1672 DEBUG(2, "ray_cs interrupt_ecf - device not present\n"); 1661 dev_dbg(&link->dev, "ray_cs interrupt_ecf - device not present\n");
1673 return -1; 1662 return -1;
1674 } 1663 }
1675 DEBUG(2, "interrupt_ecf(local=%p, ccs = 0x%x\n", local, ccs); 1664 dev_dbg(&link->dev, "interrupt_ecf(local=%p, ccs = 0x%x\n", local, ccs);
1676 1665
1677 while (i && 1666 while (i &&
1678 (readb(local->amem + CIS_OFFSET + ECF_INTR_OFFSET) & 1667 (readb(local->amem + CIS_OFFSET + ECF_INTR_OFFSET) &
1679 ECF_INTR_SET)) 1668 ECF_INTR_SET))
1680 i--; 1669 i--;
1681 if (i == 0) { 1670 if (i == 0) {
1682 DEBUG(2, "ray_cs interrupt_ecf card not ready for interrupt\n"); 1671 dev_dbg(&link->dev, "ray_cs interrupt_ecf card not ready for interrupt\n");
1683 return -1; 1672 return -1;
1684 } 1673 }
1685 /* Fill the mailbox, then kick the card */ 1674 /* Fill the mailbox, then kick the card */
@@ -1698,12 +1687,12 @@ static int get_free_tx_ccs(ray_dev_t *local)
1698 struct pcmcia_device *link = local->finder; 1687 struct pcmcia_device *link = local->finder;
1699 1688
1700 if (!(pcmcia_dev_present(link))) { 1689 if (!(pcmcia_dev_present(link))) {
1701 DEBUG(2, "ray_cs get_free_tx_ccs - device not present\n"); 1690 dev_dbg(&link->dev, "ray_cs get_free_tx_ccs - device not present\n");
1702 return ECARDGONE; 1691 return ECARDGONE;
1703 } 1692 }
1704 1693
1705 if (test_and_set_bit(0, &local->tx_ccs_lock)) { 1694 if (test_and_set_bit(0, &local->tx_ccs_lock)) {
1706 DEBUG(1, "ray_cs tx_ccs_lock busy\n"); 1695 dev_dbg(&link->dev, "ray_cs tx_ccs_lock busy\n");
1707 return ECCSBUSY; 1696 return ECCSBUSY;
1708 } 1697 }
1709 1698
@@ -1716,7 +1705,7 @@ static int get_free_tx_ccs(ray_dev_t *local)
1716 } 1705 }
1717 } 1706 }
1718 local->tx_ccs_lock = 0; 1707 local->tx_ccs_lock = 0;
1719 DEBUG(2, "ray_cs ERROR no free tx CCS for raylink card\n"); 1708 dev_dbg(&link->dev, "ray_cs ERROR no free tx CCS for raylink card\n");
1720 return ECCSFULL; 1709 return ECCSFULL;
1721} /* get_free_tx_ccs */ 1710} /* get_free_tx_ccs */
1722 1711
@@ -1730,11 +1719,11 @@ static int get_free_ccs(ray_dev_t *local)
1730 struct pcmcia_device *link = local->finder; 1719 struct pcmcia_device *link = local->finder;
1731 1720
1732 if (!(pcmcia_dev_present(link))) { 1721 if (!(pcmcia_dev_present(link))) {
1733 DEBUG(2, "ray_cs get_free_ccs - device not present\n"); 1722 dev_dbg(&link->dev, "ray_cs get_free_ccs - device not present\n");
1734 return ECARDGONE; 1723 return ECARDGONE;
1735 } 1724 }
1736 if (test_and_set_bit(0, &local->ccs_lock)) { 1725 if (test_and_set_bit(0, &local->ccs_lock)) {
1737 DEBUG(1, "ray_cs ccs_lock busy\n"); 1726 dev_dbg(&link->dev, "ray_cs ccs_lock busy\n");
1738 return ECCSBUSY; 1727 return ECCSBUSY;
1739 } 1728 }
1740 1729
@@ -1747,7 +1736,7 @@ static int get_free_ccs(ray_dev_t *local)
1747 } 1736 }
1748 } 1737 }
1749 local->ccs_lock = 0; 1738 local->ccs_lock = 0;
1750 DEBUG(1, "ray_cs ERROR no free CCS for raylink card\n"); 1739 dev_dbg(&link->dev, "ray_cs ERROR no free CCS for raylink card\n");
1751 return ECCSFULL; 1740 return ECCSFULL;
1752} /* get_free_ccs */ 1741} /* get_free_ccs */
1753 1742
@@ -1823,7 +1812,7 @@ static struct net_device_stats *ray_get_stats(struct net_device *dev)
1823 struct pcmcia_device *link = local->finder; 1812 struct pcmcia_device *link = local->finder;
1824 struct status __iomem *p = local->sram + STATUS_BASE; 1813 struct status __iomem *p = local->sram + STATUS_BASE;
1825 if (!(pcmcia_dev_present(link))) { 1814 if (!(pcmcia_dev_present(link))) {
1826 DEBUG(2, "ray_cs net_device_stats - device not present\n"); 1815 dev_dbg(&link->dev, "ray_cs net_device_stats - device not present\n");
1827 return &local->stats; 1816 return &local->stats;
1828 } 1817 }
1829 if (readb(&p->mrx_overflow_for_host)) { 1818 if (readb(&p->mrx_overflow_for_host)) {
@@ -1856,12 +1845,12 @@ static void ray_update_parm(struct net_device *dev, UCHAR objid, UCHAR *value,
1856 struct ccs __iomem *pccs; 1845 struct ccs __iomem *pccs;
1857 1846
1858 if (!(pcmcia_dev_present(link))) { 1847 if (!(pcmcia_dev_present(link))) {
1859 DEBUG(2, "ray_update_parm - device not present\n"); 1848 dev_dbg(&link->dev, "ray_update_parm - device not present\n");
1860 return; 1849 return;
1861 } 1850 }
1862 1851
1863 if ((ccsindex = get_free_ccs(local)) < 0) { 1852 if ((ccsindex = get_free_ccs(local)) < 0) {
1864 DEBUG(0, "ray_update_parm - No free ccs\n"); 1853 dev_dbg(&link->dev, "ray_update_parm - No free ccs\n");
1865 return; 1854 return;
1866 } 1855 }
1867 pccs = ccs_base(local) + ccsindex; 1856 pccs = ccs_base(local) + ccsindex;
@@ -1874,7 +1863,7 @@ static void ray_update_parm(struct net_device *dev, UCHAR objid, UCHAR *value,
1874 } 1863 }
1875 /* Interrupt the firmware to process the command */ 1864 /* Interrupt the firmware to process the command */
1876 if (interrupt_ecf(local, ccsindex)) { 1865 if (interrupt_ecf(local, ccsindex)) {
1877 DEBUG(0, "ray_cs associate failed - ECF not ready for intr\n"); 1866 dev_dbg(&link->dev, "ray_cs associate failed - ECF not ready for intr\n");
1878 writeb(CCS_BUFFER_FREE, &(pccs++)->buffer_status); 1867 writeb(CCS_BUFFER_FREE, &(pccs++)->buffer_status);
1879 } 1868 }
1880} 1869}
@@ -1891,12 +1880,12 @@ static void ray_update_multi_list(struct net_device *dev, int all)
1891 void __iomem *p = local->sram + HOST_TO_ECF_BASE; 1880 void __iomem *p = local->sram + HOST_TO_ECF_BASE;
1892 1881
1893 if (!(pcmcia_dev_present(link))) { 1882 if (!(pcmcia_dev_present(link))) {
1894 DEBUG(2, "ray_update_multi_list - device not present\n"); 1883 dev_dbg(&link->dev, "ray_update_multi_list - device not present\n");
1895 return; 1884 return;
1896 } else 1885 } else
1897 DEBUG(2, "ray_update_multi_list(%p)\n", dev); 1886 dev_dbg(&link->dev, "ray_update_multi_list(%p)\n", dev);
1898 if ((ccsindex = get_free_ccs(local)) < 0) { 1887 if ((ccsindex = get_free_ccs(local)) < 0) {
1899 DEBUG(1, "ray_update_multi - No free ccs\n"); 1888 dev_dbg(&link->dev, "ray_update_multi - No free ccs\n");
1900 return; 1889 return;
1901 } 1890 }
1902 pccs = ccs_base(local) + ccsindex; 1891 pccs = ccs_base(local) + ccsindex;
@@ -1910,7 +1899,7 @@ static void ray_update_multi_list(struct net_device *dev, int all)
1910 for (dmip = &dev->mc_list; (dmi = *dmip) != NULL; 1899 for (dmip = &dev->mc_list; (dmi = *dmip) != NULL;
1911 dmip = &dmi->next) { 1900 dmip = &dmi->next) {
1912 memcpy_toio(p, dmi->dmi_addr, ETH_ALEN); 1901 memcpy_toio(p, dmi->dmi_addr, ETH_ALEN);
1913 DEBUG(1, 1902 dev_dbg(&link->dev,
1914 "ray_update_multi add addr %02x%02x%02x%02x%02x%02x\n", 1903 "ray_update_multi add addr %02x%02x%02x%02x%02x%02x\n",
1915 dmi->dmi_addr[0], dmi->dmi_addr[1], 1904 dmi->dmi_addr[0], dmi->dmi_addr[1],
1916 dmi->dmi_addr[2], dmi->dmi_addr[3], 1905 dmi->dmi_addr[2], dmi->dmi_addr[3],
@@ -1921,12 +1910,12 @@ static void ray_update_multi_list(struct net_device *dev, int all)
1921 if (i > 256 / ADDRLEN) 1910 if (i > 256 / ADDRLEN)
1922 i = 256 / ADDRLEN; 1911 i = 256 / ADDRLEN;
1923 writeb((UCHAR) i, &pccs->var); 1912 writeb((UCHAR) i, &pccs->var);
1924 DEBUG(1, "ray_cs update_multi %d addresses in list\n", i); 1913 dev_dbg(&link->dev, "ray_cs update_multi %d addresses in list\n", i);
1925 /* Interrupt the firmware to process the command */ 1914 /* Interrupt the firmware to process the command */
1926 local->num_multi = i; 1915 local->num_multi = i;
1927 } 1916 }
1928 if (interrupt_ecf(local, ccsindex)) { 1917 if (interrupt_ecf(local, ccsindex)) {
1929 DEBUG(1, 1918 dev_dbg(&link->dev,
1930 "ray_cs update_multi failed - ECF not ready for intr\n"); 1919 "ray_cs update_multi failed - ECF not ready for intr\n");
1931 writeb(CCS_BUFFER_FREE, &(pccs++)->buffer_status); 1920 writeb(CCS_BUFFER_FREE, &(pccs++)->buffer_status);
1932 } 1921 }
@@ -1938,11 +1927,11 @@ static void set_multicast_list(struct net_device *dev)
1938 ray_dev_t *local = netdev_priv(dev); 1927 ray_dev_t *local = netdev_priv(dev);
1939 UCHAR promisc; 1928 UCHAR promisc;
1940 1929
1941 DEBUG(2, "ray_cs set_multicast_list(%p)\n", dev); 1930 pr_debug("ray_cs set_multicast_list(%p)\n", dev);
1942 1931
1943 if (dev->flags & IFF_PROMISC) { 1932 if (dev->flags & IFF_PROMISC) {
1944 if (local->sparm.b5.a_promiscuous_mode == 0) { 1933 if (local->sparm.b5.a_promiscuous_mode == 0) {
1945 DEBUG(1, "ray_cs set_multicast_list promisc on\n"); 1934 pr_debug("ray_cs set_multicast_list promisc on\n");
1946 local->sparm.b5.a_promiscuous_mode = 1; 1935 local->sparm.b5.a_promiscuous_mode = 1;
1947 promisc = 1; 1936 promisc = 1;
1948 ray_update_parm(dev, OBJID_promiscuous_mode, 1937 ray_update_parm(dev, OBJID_promiscuous_mode,
@@ -1950,7 +1939,7 @@ static void set_multicast_list(struct net_device *dev)
1950 } 1939 }
1951 } else { 1940 } else {
1952 if (local->sparm.b5.a_promiscuous_mode == 1) { 1941 if (local->sparm.b5.a_promiscuous_mode == 1) {
1953 DEBUG(1, "ray_cs set_multicast_list promisc off\n"); 1942 pr_debug("ray_cs set_multicast_list promisc off\n");
1954 local->sparm.b5.a_promiscuous_mode = 0; 1943 local->sparm.b5.a_promiscuous_mode = 0;
1955 promisc = 0; 1944 promisc = 0;
1956 ray_update_parm(dev, OBJID_promiscuous_mode, 1945 ray_update_parm(dev, OBJID_promiscuous_mode,
@@ -1984,19 +1973,19 @@ static irqreturn_t ray_interrupt(int irq, void *dev_id)
1984 if (dev == NULL) /* Note that we want interrupts with dev->start == 0 */ 1973 if (dev == NULL) /* Note that we want interrupts with dev->start == 0 */
1985 return IRQ_NONE; 1974 return IRQ_NONE;
1986 1975
1987 DEBUG(4, "ray_cs: interrupt for *dev=%p\n", dev); 1976 pr_debug("ray_cs: interrupt for *dev=%p\n", dev);
1988 1977
1989 local = netdev_priv(dev); 1978 local = netdev_priv(dev);
1990 link = (struct pcmcia_device *)local->finder; 1979 link = (struct pcmcia_device *)local->finder;
1991 if (!pcmcia_dev_present(link)) { 1980 if (!pcmcia_dev_present(link)) {
1992 DEBUG(2, 1981 pr_debug(
1993 "ray_cs interrupt from device not present or suspended.\n"); 1982 "ray_cs interrupt from device not present or suspended.\n");
1994 return IRQ_NONE; 1983 return IRQ_NONE;
1995 } 1984 }
1996 rcsindex = readb(&((struct scb __iomem *)(local->sram))->rcs_index); 1985 rcsindex = readb(&((struct scb __iomem *)(local->sram))->rcs_index);
1997 1986
1998 if (rcsindex >= (NUMBER_OF_CCS + NUMBER_OF_RCS)) { 1987 if (rcsindex >= (NUMBER_OF_CCS + NUMBER_OF_RCS)) {
1999 DEBUG(1, "ray_cs interrupt bad rcsindex = 0x%x\n", rcsindex); 1988 dev_dbg(&link->dev, "ray_cs interrupt bad rcsindex = 0x%x\n", rcsindex);
2000 clear_interrupt(local); 1989 clear_interrupt(local);
2001 return IRQ_HANDLED; 1990 return IRQ_HANDLED;
2002 } 1991 }
@@ -2008,33 +1997,33 @@ static irqreturn_t ray_interrupt(int irq, void *dev_id)
2008 case CCS_DOWNLOAD_STARTUP_PARAMS: /* Happens in firmware someday */ 1997 case CCS_DOWNLOAD_STARTUP_PARAMS: /* Happens in firmware someday */
2009 del_timer(&local->timer); 1998 del_timer(&local->timer);
2010 if (status == CCS_COMMAND_COMPLETE) { 1999 if (status == CCS_COMMAND_COMPLETE) {
2011 DEBUG(1, 2000 dev_dbg(&link->dev,
2012 "ray_cs interrupt download_startup_parameters OK\n"); 2001 "ray_cs interrupt download_startup_parameters OK\n");
2013 } else { 2002 } else {
2014 DEBUG(1, 2003 dev_dbg(&link->dev,
2015 "ray_cs interrupt download_startup_parameters fail\n"); 2004 "ray_cs interrupt download_startup_parameters fail\n");
2016 } 2005 }
2017 break; 2006 break;
2018 case CCS_UPDATE_PARAMS: 2007 case CCS_UPDATE_PARAMS:
2019 DEBUG(1, "ray_cs interrupt update params done\n"); 2008 dev_dbg(&link->dev, "ray_cs interrupt update params done\n");
2020 if (status != CCS_COMMAND_COMPLETE) { 2009 if (status != CCS_COMMAND_COMPLETE) {
2021 tmp = 2010 tmp =
2022 readb(&pccs->var.update_param. 2011 readb(&pccs->var.update_param.
2023 failure_cause); 2012 failure_cause);
2024 DEBUG(0, 2013 dev_dbg(&link->dev,
2025 "ray_cs interrupt update params failed - reason %d\n", 2014 "ray_cs interrupt update params failed - reason %d\n",
2026 tmp); 2015 tmp);
2027 } 2016 }
2028 break; 2017 break;
2029 case CCS_REPORT_PARAMS: 2018 case CCS_REPORT_PARAMS:
2030 DEBUG(1, "ray_cs interrupt report params done\n"); 2019 dev_dbg(&link->dev, "ray_cs interrupt report params done\n");
2031 break; 2020 break;
2032 case CCS_UPDATE_MULTICAST_LIST: /* Note that this CCS isn't returned */ 2021 case CCS_UPDATE_MULTICAST_LIST: /* Note that this CCS isn't returned */
2033 DEBUG(1, 2022 dev_dbg(&link->dev,
2034 "ray_cs interrupt CCS Update Multicast List done\n"); 2023 "ray_cs interrupt CCS Update Multicast List done\n");
2035 break; 2024 break;
2036 case CCS_UPDATE_POWER_SAVINGS_MODE: 2025 case CCS_UPDATE_POWER_SAVINGS_MODE:
2037 DEBUG(1, 2026 dev_dbg(&link->dev,
2038 "ray_cs interrupt update power save mode done\n"); 2027 "ray_cs interrupt update power save mode done\n");
2039 break; 2028 break;
2040 case CCS_START_NETWORK: 2029 case CCS_START_NETWORK:
@@ -2043,11 +2032,11 @@ static irqreturn_t ray_interrupt(int irq, void *dev_id)
2043 if (readb 2032 if (readb
2044 (&pccs->var.start_network.net_initiated) == 2033 (&pccs->var.start_network.net_initiated) ==
2045 1) { 2034 1) {
2046 DEBUG(0, 2035 dev_dbg(&link->dev,
2047 "ray_cs interrupt network \"%s\" started\n", 2036 "ray_cs interrupt network \"%s\" started\n",
2048 local->sparm.b4.a_current_ess_id); 2037 local->sparm.b4.a_current_ess_id);
2049 } else { 2038 } else {
2050 DEBUG(0, 2039 dev_dbg(&link->dev,
2051 "ray_cs interrupt network \"%s\" joined\n", 2040 "ray_cs interrupt network \"%s\" joined\n",
2052 local->sparm.b4.a_current_ess_id); 2041 local->sparm.b4.a_current_ess_id);
2053 } 2042 }
@@ -2075,12 +2064,12 @@ static irqreturn_t ray_interrupt(int irq, void *dev_id)
2075 local->timer.expires = jiffies + HZ * 5; 2064 local->timer.expires = jiffies + HZ * 5;
2076 local->timer.data = (long)local; 2065 local->timer.data = (long)local;
2077 if (status == CCS_START_NETWORK) { 2066 if (status == CCS_START_NETWORK) {
2078 DEBUG(0, 2067 dev_dbg(&link->dev,
2079 "ray_cs interrupt network \"%s\" start failed\n", 2068 "ray_cs interrupt network \"%s\" start failed\n",
2080 local->sparm.b4.a_current_ess_id); 2069 local->sparm.b4.a_current_ess_id);
2081 local->timer.function = &start_net; 2070 local->timer.function = &start_net;
2082 } else { 2071 } else {
2083 DEBUG(0, 2072 dev_dbg(&link->dev,
2084 "ray_cs interrupt network \"%s\" join failed\n", 2073 "ray_cs interrupt network \"%s\" join failed\n",
2085 local->sparm.b4.a_current_ess_id); 2074 local->sparm.b4.a_current_ess_id);
2086 local->timer.function = &join_net; 2075 local->timer.function = &join_net;
@@ -2091,19 +2080,19 @@ static irqreturn_t ray_interrupt(int irq, void *dev_id)
2091 case CCS_START_ASSOCIATION: 2080 case CCS_START_ASSOCIATION:
2092 if (status == CCS_COMMAND_COMPLETE) { 2081 if (status == CCS_COMMAND_COMPLETE) {
2093 local->card_status = CARD_ASSOC_COMPLETE; 2082 local->card_status = CARD_ASSOC_COMPLETE;
2094 DEBUG(0, "ray_cs association successful\n"); 2083 dev_dbg(&link->dev, "ray_cs association successful\n");
2095 } else { 2084 } else {
2096 DEBUG(0, "ray_cs association failed,\n"); 2085 dev_dbg(&link->dev, "ray_cs association failed,\n");
2097 local->card_status = CARD_ASSOC_FAILED; 2086 local->card_status = CARD_ASSOC_FAILED;
2098 join_net((u_long) local); 2087 join_net((u_long) local);
2099 } 2088 }
2100 break; 2089 break;
2101 case CCS_TX_REQUEST: 2090 case CCS_TX_REQUEST:
2102 if (status == CCS_COMMAND_COMPLETE) { 2091 if (status == CCS_COMMAND_COMPLETE) {
2103 DEBUG(3, 2092 dev_dbg(&link->dev,
2104 "ray_cs interrupt tx request complete\n"); 2093 "ray_cs interrupt tx request complete\n");
2105 } else { 2094 } else {
2106 DEBUG(1, 2095 dev_dbg(&link->dev,
2107 "ray_cs interrupt tx request failed\n"); 2096 "ray_cs interrupt tx request failed\n");
2108 } 2097 }
2109 if (!sniffer) 2098 if (!sniffer)
@@ -2111,21 +2100,21 @@ static irqreturn_t ray_interrupt(int irq, void *dev_id)
2111 netif_wake_queue(dev); 2100 netif_wake_queue(dev);
2112 break; 2101 break;
2113 case CCS_TEST_MEMORY: 2102 case CCS_TEST_MEMORY:
2114 DEBUG(1, "ray_cs interrupt mem test done\n"); 2103 dev_dbg(&link->dev, "ray_cs interrupt mem test done\n");
2115 break; 2104 break;
2116 case CCS_SHUTDOWN: 2105 case CCS_SHUTDOWN:
2117 DEBUG(1, 2106 dev_dbg(&link->dev,
2118 "ray_cs interrupt Unexpected CCS returned - Shutdown\n"); 2107 "ray_cs interrupt Unexpected CCS returned - Shutdown\n");
2119 break; 2108 break;
2120 case CCS_DUMP_MEMORY: 2109 case CCS_DUMP_MEMORY:
2121 DEBUG(1, "ray_cs interrupt dump memory done\n"); 2110 dev_dbg(&link->dev, "ray_cs interrupt dump memory done\n");
2122 break; 2111 break;
2123 case CCS_START_TIMER: 2112 case CCS_START_TIMER:
2124 DEBUG(2, 2113 dev_dbg(&link->dev,
2125 "ray_cs interrupt DING - raylink timer expired\n"); 2114 "ray_cs interrupt DING - raylink timer expired\n");
2126 break; 2115 break;
2127 default: 2116 default:
2128 DEBUG(1, 2117 dev_dbg(&link->dev,
2129 "ray_cs interrupt Unexpected CCS 0x%x returned 0x%x\n", 2118 "ray_cs interrupt Unexpected CCS 0x%x returned 0x%x\n",
2130 rcsindex, cmd); 2119 rcsindex, cmd);
2131 } 2120 }
@@ -2139,7 +2128,7 @@ static irqreturn_t ray_interrupt(int irq, void *dev_id)
2139 ray_rx(dev, local, prcs); 2128 ray_rx(dev, local, prcs);
2140 break; 2129 break;
2141 case REJOIN_NET_COMPLETE: 2130 case REJOIN_NET_COMPLETE:
2142 DEBUG(1, "ray_cs interrupt rejoin net complete\n"); 2131 dev_dbg(&link->dev, "ray_cs interrupt rejoin net complete\n");
2143 local->card_status = CARD_ACQ_COMPLETE; 2132 local->card_status = CARD_ACQ_COMPLETE;
2144 /* do we need to clear tx buffers CCS's? */ 2133 /* do we need to clear tx buffers CCS's? */
2145 if (local->sparm.b4.a_network_type == ADHOC) { 2134 if (local->sparm.b4.a_network_type == ADHOC) {
@@ -2149,7 +2138,7 @@ static irqreturn_t ray_interrupt(int irq, void *dev_id)
2149 memcpy_fromio(&local->bss_id, 2138 memcpy_fromio(&local->bss_id,
2150 prcs->var.rejoin_net_complete. 2139 prcs->var.rejoin_net_complete.
2151 bssid, ADDRLEN); 2140 bssid, ADDRLEN);
2152 DEBUG(1, 2141 dev_dbg(&link->dev,
2153 "ray_cs new BSSID = %02x%02x%02x%02x%02x%02x\n", 2142 "ray_cs new BSSID = %02x%02x%02x%02x%02x%02x\n",
2154 local->bss_id[0], local->bss_id[1], 2143 local->bss_id[0], local->bss_id[1],
2155 local->bss_id[2], local->bss_id[3], 2144 local->bss_id[2], local->bss_id[3],
@@ -2159,15 +2148,15 @@ static irqreturn_t ray_interrupt(int irq, void *dev_id)
2159 } 2148 }
2160 break; 2149 break;
2161 case ROAMING_INITIATED: 2150 case ROAMING_INITIATED:
2162 DEBUG(1, "ray_cs interrupt roaming initiated\n"); 2151 dev_dbg(&link->dev, "ray_cs interrupt roaming initiated\n");
2163 netif_stop_queue(dev); 2152 netif_stop_queue(dev);
2164 local->card_status = CARD_DOING_ACQ; 2153 local->card_status = CARD_DOING_ACQ;
2165 break; 2154 break;
2166 case JAPAN_CALL_SIGN_RXD: 2155 case JAPAN_CALL_SIGN_RXD:
2167 DEBUG(1, "ray_cs interrupt japan call sign rx\n"); 2156 dev_dbg(&link->dev, "ray_cs interrupt japan call sign rx\n");
2168 break; 2157 break;
2169 default: 2158 default:
2170 DEBUG(1, 2159 dev_dbg(&link->dev,
2171 "ray_cs Unexpected interrupt for RCS 0x%x cmd = 0x%x\n", 2160 "ray_cs Unexpected interrupt for RCS 0x%x cmd = 0x%x\n",
2172 rcsindex, 2161 rcsindex,
2173 (unsigned int)readb(&prcs->interrupt_id)); 2162 (unsigned int)readb(&prcs->interrupt_id));
@@ -2186,7 +2175,7 @@ static void ray_rx(struct net_device *dev, ray_dev_t *local,
2186 int rx_len; 2175 int rx_len;
2187 unsigned int pkt_addr; 2176 unsigned int pkt_addr;
2188 void __iomem *pmsg; 2177 void __iomem *pmsg;
2189 DEBUG(4, "ray_rx process rx packet\n"); 2178 pr_debug("ray_rx process rx packet\n");
2190 2179
2191 /* Calculate address of packet within Rx buffer */ 2180 /* Calculate address of packet within Rx buffer */
2192 pkt_addr = ((readb(&prcs->var.rx_packet.rx_data_ptr[0]) << 8) 2181 pkt_addr = ((readb(&prcs->var.rx_packet.rx_data_ptr[0]) << 8)
@@ -2199,28 +2188,28 @@ static void ray_rx(struct net_device *dev, ray_dev_t *local,
2199 pmsg = local->rmem + pkt_addr; 2188 pmsg = local->rmem + pkt_addr;
2200 switch (readb(pmsg)) { 2189 switch (readb(pmsg)) {
2201 case DATA_TYPE: 2190 case DATA_TYPE:
2202 DEBUG(4, "ray_rx data type\n"); 2191 pr_debug("ray_rx data type\n");
2203 rx_data(dev, prcs, pkt_addr, rx_len); 2192 rx_data(dev, prcs, pkt_addr, rx_len);
2204 break; 2193 break;
2205 case AUTHENTIC_TYPE: 2194 case AUTHENTIC_TYPE:
2206 DEBUG(4, "ray_rx authentic type\n"); 2195 pr_debug("ray_rx authentic type\n");
2207 if (sniffer) 2196 if (sniffer)
2208 rx_data(dev, prcs, pkt_addr, rx_len); 2197 rx_data(dev, prcs, pkt_addr, rx_len);
2209 else 2198 else
2210 rx_authenticate(local, prcs, pkt_addr, rx_len); 2199 rx_authenticate(local, prcs, pkt_addr, rx_len);
2211 break; 2200 break;
2212 case DEAUTHENTIC_TYPE: 2201 case DEAUTHENTIC_TYPE:
2213 DEBUG(4, "ray_rx deauth type\n"); 2202 pr_debug("ray_rx deauth type\n");
2214 if (sniffer) 2203 if (sniffer)
2215 rx_data(dev, prcs, pkt_addr, rx_len); 2204 rx_data(dev, prcs, pkt_addr, rx_len);
2216 else 2205 else
2217 rx_deauthenticate(local, prcs, pkt_addr, rx_len); 2206 rx_deauthenticate(local, prcs, pkt_addr, rx_len);
2218 break; 2207 break;
2219 case NULL_MSG_TYPE: 2208 case NULL_MSG_TYPE:
2220 DEBUG(3, "ray_cs rx NULL msg\n"); 2209 pr_debug("ray_cs rx NULL msg\n");
2221 break; 2210 break;
2222 case BEACON_TYPE: 2211 case BEACON_TYPE:
2223 DEBUG(4, "ray_rx beacon type\n"); 2212 pr_debug("ray_rx beacon type\n");
2224 if (sniffer) 2213 if (sniffer)
2225 rx_data(dev, prcs, pkt_addr, rx_len); 2214 rx_data(dev, prcs, pkt_addr, rx_len);
2226 2215
@@ -2233,7 +2222,7 @@ static void ray_rx(struct net_device *dev, ray_dev_t *local,
2233 ray_get_stats(dev); 2222 ray_get_stats(dev);
2234 break; 2223 break;
2235 default: 2224 default:
2236 DEBUG(0, "ray_cs unknown pkt type %2x\n", 2225 pr_debug("ray_cs unknown pkt type %2x\n",
2237 (unsigned int)readb(pmsg)); 2226 (unsigned int)readb(pmsg));
2238 break; 2227 break;
2239 } 2228 }
@@ -2262,7 +2251,7 @@ static void rx_data(struct net_device *dev, struct rcs __iomem *prcs,
2262 rx_len > 2251 rx_len >
2263 (dev->mtu + RX_MAC_HEADER_LENGTH + ETH_HLEN + 2252 (dev->mtu + RX_MAC_HEADER_LENGTH + ETH_HLEN +
2264 FCS_LEN)) { 2253 FCS_LEN)) {
2265 DEBUG(0, 2254 pr_debug(
2266 "ray_cs invalid packet length %d received \n", 2255 "ray_cs invalid packet length %d received \n",
2267 rx_len); 2256 rx_len);
2268 return; 2257 return;
@@ -2273,17 +2262,17 @@ static void rx_data(struct net_device *dev, struct rcs __iomem *prcs,
2273 rx_len > 2262 rx_len >
2274 (dev->mtu + RX_MAC_HEADER_LENGTH + ETH_HLEN + 2263 (dev->mtu + RX_MAC_HEADER_LENGTH + ETH_HLEN +
2275 FCS_LEN)) { 2264 FCS_LEN)) {
2276 DEBUG(0, 2265 pr_debug(
2277 "ray_cs invalid packet length %d received \n", 2266 "ray_cs invalid packet length %d received \n",
2278 rx_len); 2267 rx_len);
2279 return; 2268 return;
2280 } 2269 }
2281 } 2270 }
2282 } 2271 }
2283 DEBUG(4, "ray_cs rx_data packet\n"); 2272 pr_debug("ray_cs rx_data packet\n");
2284 /* If fragmented packet, verify sizes of fragments add up */ 2273 /* If fragmented packet, verify sizes of fragments add up */
2285 if (readb(&prcs->var.rx_packet.next_frag_rcs_index) != 0xFF) { 2274 if (readb(&prcs->var.rx_packet.next_frag_rcs_index) != 0xFF) {
2286 DEBUG(1, "ray_cs rx'ed fragment\n"); 2275 pr_debug("ray_cs rx'ed fragment\n");
2287 tmp = (readb(&prcs->var.rx_packet.totalpacketlength[0]) << 8) 2276 tmp = (readb(&prcs->var.rx_packet.totalpacketlength[0]) << 8)
2288 + readb(&prcs->var.rx_packet.totalpacketlength[1]); 2277 + readb(&prcs->var.rx_packet.totalpacketlength[1]);
2289 total_len = tmp; 2278 total_len = tmp;
@@ -2301,7 +2290,7 @@ static void rx_data(struct net_device *dev, struct rcs __iomem *prcs,
2301 } while (1); 2290 } while (1);
2302 2291
2303 if (tmp < 0) { 2292 if (tmp < 0) {
2304 DEBUG(0, 2293 pr_debug(
2305 "ray_cs rx_data fragment lengths don't add up\n"); 2294 "ray_cs rx_data fragment lengths don't add up\n");
2306 local->stats.rx_dropped++; 2295 local->stats.rx_dropped++;
2307 release_frag_chain(local, prcs); 2296 release_frag_chain(local, prcs);
@@ -2313,7 +2302,7 @@ static void rx_data(struct net_device *dev, struct rcs __iomem *prcs,
2313 2302
2314 skb = dev_alloc_skb(total_len + 5); 2303 skb = dev_alloc_skb(total_len + 5);
2315 if (skb == NULL) { 2304 if (skb == NULL) {
2316 DEBUG(0, "ray_cs rx_data could not allocate skb\n"); 2305 pr_debug("ray_cs rx_data could not allocate skb\n");
2317 local->stats.rx_dropped++; 2306 local->stats.rx_dropped++;
2318 if (readb(&prcs->var.rx_packet.next_frag_rcs_index) != 0xFF) 2307 if (readb(&prcs->var.rx_packet.next_frag_rcs_index) != 0xFF)
2319 release_frag_chain(local, prcs); 2308 release_frag_chain(local, prcs);
@@ -2321,7 +2310,7 @@ static void rx_data(struct net_device *dev, struct rcs __iomem *prcs,
2321 } 2310 }
2322 skb_reserve(skb, 2); /* Align IP on 16 byte (TBD check this) */ 2311 skb_reserve(skb, 2); /* Align IP on 16 byte (TBD check this) */
2323 2312
2324 DEBUG(4, "ray_cs rx_data total_len = %x, rx_len = %x\n", total_len, 2313 pr_debug("ray_cs rx_data total_len = %x, rx_len = %x\n", total_len,
2325 rx_len); 2314 rx_len);
2326 2315
2327/************************/ 2316/************************/
@@ -2354,7 +2343,7 @@ static void rx_data(struct net_device *dev, struct rcs __iomem *prcs,
2354 tmp = 17; 2343 tmp = 17;
2355 if (readb(&prcs->var.rx_packet.next_frag_rcs_index) != 0xFF) { 2344 if (readb(&prcs->var.rx_packet.next_frag_rcs_index) != 0xFF) {
2356 prcslink = prcs; 2345 prcslink = prcs;
2357 DEBUG(1, "ray_cs rx_data in fragment loop\n"); 2346 pr_debug("ray_cs rx_data in fragment loop\n");
2358 do { 2347 do {
2359 prcslink = rcs_base(local) 2348 prcslink = rcs_base(local)
2360 + 2349 +
@@ -2426,8 +2415,8 @@ static void untranslate(ray_dev_t *local, struct sk_buff *skb, int len)
2426 memcpy(destaddr, ieee80211_get_DA(pmac), ADDRLEN); 2415 memcpy(destaddr, ieee80211_get_DA(pmac), ADDRLEN);
2427 memcpy(srcaddr, ieee80211_get_SA(pmac), ADDRLEN); 2416 memcpy(srcaddr, ieee80211_get_SA(pmac), ADDRLEN);
2428 2417
2429#ifdef PCMCIA_DEBUG 2418#if 0
2430 if (pc_debug > 3) { 2419 if {
2431 print_hex_dump(KERN_DEBUG, "skb->data before untranslate: ", 2420 print_hex_dump(KERN_DEBUG, "skb->data before untranslate: ",
2432 DUMP_PREFIX_NONE, 16, 1, 2421 DUMP_PREFIX_NONE, 16, 1,
2433 skb->data, 64, true); 2422 skb->data, 64, true);
@@ -2441,7 +2430,7 @@ static void untranslate(ray_dev_t *local, struct sk_buff *skb, int len)
2441 2430
2442 if (psnap->dsap != 0xaa || psnap->ssap != 0xaa || psnap->ctrl != 3) { 2431 if (psnap->dsap != 0xaa || psnap->ssap != 0xaa || psnap->ctrl != 3) {
2443 /* not a snap type so leave it alone */ 2432 /* not a snap type so leave it alone */
2444 DEBUG(3, "ray_cs untranslate NOT SNAP %02x %02x %02x\n", 2433 pr_debug("ray_cs untranslate NOT SNAP %02x %02x %02x\n",
2445 psnap->dsap, psnap->ssap, psnap->ctrl); 2434 psnap->dsap, psnap->ssap, psnap->ctrl);
2446 2435
2447 delta = RX_MAC_HEADER_LENGTH - ETH_HLEN; 2436 delta = RX_MAC_HEADER_LENGTH - ETH_HLEN;
@@ -2450,7 +2439,7 @@ static void untranslate(ray_dev_t *local, struct sk_buff *skb, int len)
2450 } else { /* Its a SNAP */ 2439 } else { /* Its a SNAP */
2451 if (memcmp(psnap->org, org_bridge, 3) == 0) { 2440 if (memcmp(psnap->org, org_bridge, 3) == 0) {
2452 /* EtherII and nuke the LLC */ 2441 /* EtherII and nuke the LLC */
2453 DEBUG(3, "ray_cs untranslate Bridge encap\n"); 2442 pr_debug("ray_cs untranslate Bridge encap\n");
2454 delta = RX_MAC_HEADER_LENGTH 2443 delta = RX_MAC_HEADER_LENGTH
2455 + sizeof(struct snaphdr_t) - ETH_HLEN; 2444 + sizeof(struct snaphdr_t) - ETH_HLEN;
2456 peth = (struct ethhdr *)(skb->data + delta); 2445 peth = (struct ethhdr *)(skb->data + delta);
@@ -2459,14 +2448,14 @@ static void untranslate(ray_dev_t *local, struct sk_buff *skb, int len)
2459 switch (ntohs(type)) { 2448 switch (ntohs(type)) {
2460 case ETH_P_IPX: 2449 case ETH_P_IPX:
2461 case ETH_P_AARP: 2450 case ETH_P_AARP:
2462 DEBUG(3, "ray_cs untranslate RFC IPX/AARP\n"); 2451 pr_debug("ray_cs untranslate RFC IPX/AARP\n");
2463 delta = RX_MAC_HEADER_LENGTH - ETH_HLEN; 2452 delta = RX_MAC_HEADER_LENGTH - ETH_HLEN;
2464 peth = (struct ethhdr *)(skb->data + delta); 2453 peth = (struct ethhdr *)(skb->data + delta);
2465 peth->h_proto = 2454 peth->h_proto =
2466 htons(len - RX_MAC_HEADER_LENGTH); 2455 htons(len - RX_MAC_HEADER_LENGTH);
2467 break; 2456 break;
2468 default: 2457 default:
2469 DEBUG(3, "ray_cs untranslate RFC default\n"); 2458 pr_debug("ray_cs untranslate RFC default\n");
2470 delta = RX_MAC_HEADER_LENGTH + 2459 delta = RX_MAC_HEADER_LENGTH +
2471 sizeof(struct snaphdr_t) - ETH_HLEN; 2460 sizeof(struct snaphdr_t) - ETH_HLEN;
2472 peth = (struct ethhdr *)(skb->data + delta); 2461 peth = (struct ethhdr *)(skb->data + delta);
@@ -2482,12 +2471,12 @@ static void untranslate(ray_dev_t *local, struct sk_buff *skb, int len)
2482 } 2471 }
2483/* TBD reserve skb_reserve(skb, delta); */ 2472/* TBD reserve skb_reserve(skb, delta); */
2484 skb_pull(skb, delta); 2473 skb_pull(skb, delta);
2485 DEBUG(3, "untranslate after skb_pull(%d), skb->data = %p\n", delta, 2474 pr_debug("untranslate after skb_pull(%d), skb->data = %p\n", delta,
2486 skb->data); 2475 skb->data);
2487 memcpy(peth->h_dest, destaddr, ADDRLEN); 2476 memcpy(peth->h_dest, destaddr, ADDRLEN);
2488 memcpy(peth->h_source, srcaddr, ADDRLEN); 2477 memcpy(peth->h_source, srcaddr, ADDRLEN);
2489#ifdef PCMCIA_DEBUG 2478#if 0
2490 if (pc_debug > 3) { 2479 {
2491 int i; 2480 int i;
2492 printk(KERN_DEBUG "skb->data after untranslate:"); 2481 printk(KERN_DEBUG "skb->data after untranslate:");
2493 for (i = 0; i < 64; i++) 2482 for (i = 0; i < 64; i++)
@@ -2529,7 +2518,7 @@ static void release_frag_chain(ray_dev_t *local, struct rcs __iomem *prcs)
2529 while (tmp--) { 2518 while (tmp--) {
2530 writeb(CCS_BUFFER_FREE, &prcslink->buffer_status); 2519 writeb(CCS_BUFFER_FREE, &prcslink->buffer_status);
2531 if (rcsindex >= (NUMBER_OF_CCS + NUMBER_OF_RCS)) { 2520 if (rcsindex >= (NUMBER_OF_CCS + NUMBER_OF_RCS)) {
2532 DEBUG(1, "ray_cs interrupt bad rcsindex = 0x%x\n", 2521 pr_debug("ray_cs interrupt bad rcsindex = 0x%x\n",
2533 rcsindex); 2522 rcsindex);
2534 break; 2523 break;
2535 } 2524 }
@@ -2543,9 +2532,9 @@ static void release_frag_chain(ray_dev_t *local, struct rcs __iomem *prcs)
2543static void authenticate(ray_dev_t *local) 2532static void authenticate(ray_dev_t *local)
2544{ 2533{
2545 struct pcmcia_device *link = local->finder; 2534 struct pcmcia_device *link = local->finder;
2546 DEBUG(0, "ray_cs Starting authentication.\n"); 2535 dev_dbg(&link->dev, "ray_cs Starting authentication.\n");
2547 if (!(pcmcia_dev_present(link))) { 2536 if (!(pcmcia_dev_present(link))) {
2548 DEBUG(2, "ray_cs authenticate - device not present\n"); 2537 dev_dbg(&link->dev, "ray_cs authenticate - device not present\n");
2549 return; 2538 return;
2550 } 2539 }
2551 2540
@@ -2573,11 +2562,11 @@ static void rx_authenticate(ray_dev_t *local, struct rcs __iomem *prcs,
2573 copy_from_rx_buff(local, buff, pkt_addr, rx_len & 0xff); 2562 copy_from_rx_buff(local, buff, pkt_addr, rx_len & 0xff);
2574 /* if we are trying to get authenticated */ 2563 /* if we are trying to get authenticated */
2575 if (local->sparm.b4.a_network_type == ADHOC) { 2564 if (local->sparm.b4.a_network_type == ADHOC) {
2576 DEBUG(1, "ray_cs rx_auth var= %02x %02x %02x %02x %02x %02x\n", 2565 pr_debug("ray_cs rx_auth var= %02x %02x %02x %02x %02x %02x\n",
2577 msg->var[0], msg->var[1], msg->var[2], msg->var[3], 2566 msg->var[0], msg->var[1], msg->var[2], msg->var[3],
2578 msg->var[4], msg->var[5]); 2567 msg->var[4], msg->var[5]);
2579 if (msg->var[2] == 1) { 2568 if (msg->var[2] == 1) {
2580 DEBUG(0, "ray_cs Sending authentication response.\n"); 2569 pr_debug("ray_cs Sending authentication response.\n");
2581 if (!build_auth_frame 2570 if (!build_auth_frame
2582 (local, msg->mac.addr_2, OPEN_AUTH_RESPONSE)) { 2571 (local, msg->mac.addr_2, OPEN_AUTH_RESPONSE)) {
2583 local->authentication_state = NEED_TO_AUTH; 2572 local->authentication_state = NEED_TO_AUTH;
@@ -2591,13 +2580,13 @@ static void rx_authenticate(ray_dev_t *local, struct rcs __iomem *prcs,
2591 /* Verify authentication sequence #2 and success */ 2580 /* Verify authentication sequence #2 and success */
2592 if (msg->var[2] == 2) { 2581 if (msg->var[2] == 2) {
2593 if ((msg->var[3] | msg->var[4]) == 0) { 2582 if ((msg->var[3] | msg->var[4]) == 0) {
2594 DEBUG(1, "Authentication successful\n"); 2583 pr_debug("Authentication successful\n");
2595 local->card_status = CARD_AUTH_COMPLETE; 2584 local->card_status = CARD_AUTH_COMPLETE;
2596 associate(local); 2585 associate(local);
2597 local->authentication_state = 2586 local->authentication_state =
2598 AUTHENTICATED; 2587 AUTHENTICATED;
2599 } else { 2588 } else {
2600 DEBUG(0, "Authentication refused\n"); 2589 pr_debug("Authentication refused\n");
2601 local->card_status = CARD_AUTH_REFUSED; 2590 local->card_status = CARD_AUTH_REFUSED;
2602 join_net((u_long) local); 2591 join_net((u_long) local);
2603 local->authentication_state = 2592 local->authentication_state =
@@ -2617,22 +2606,22 @@ static void associate(ray_dev_t *local)
2617 struct net_device *dev = link->priv; 2606 struct net_device *dev = link->priv;
2618 int ccsindex; 2607 int ccsindex;
2619 if (!(pcmcia_dev_present(link))) { 2608 if (!(pcmcia_dev_present(link))) {
2620 DEBUG(2, "ray_cs associate - device not present\n"); 2609 dev_dbg(&link->dev, "ray_cs associate - device not present\n");
2621 return; 2610 return;
2622 } 2611 }
2623 /* If no tx buffers available, return */ 2612 /* If no tx buffers available, return */
2624 if ((ccsindex = get_free_ccs(local)) < 0) { 2613 if ((ccsindex = get_free_ccs(local)) < 0) {
2625/* TBD should never be here but... what if we are? */ 2614/* TBD should never be here but... what if we are? */
2626 DEBUG(1, "ray_cs associate - No free ccs\n"); 2615 dev_dbg(&link->dev, "ray_cs associate - No free ccs\n");
2627 return; 2616 return;
2628 } 2617 }
2629 DEBUG(1, "ray_cs Starting association with access point\n"); 2618 dev_dbg(&link->dev, "ray_cs Starting association with access point\n");
2630 pccs = ccs_base(local) + ccsindex; 2619 pccs = ccs_base(local) + ccsindex;
2631 /* fill in the CCS */ 2620 /* fill in the CCS */
2632 writeb(CCS_START_ASSOCIATION, &pccs->cmd); 2621 writeb(CCS_START_ASSOCIATION, &pccs->cmd);
2633 /* Interrupt the firmware to process the command */ 2622 /* Interrupt the firmware to process the command */
2634 if (interrupt_ecf(local, ccsindex)) { 2623 if (interrupt_ecf(local, ccsindex)) {
2635 DEBUG(1, "ray_cs associate failed - ECF not ready for intr\n"); 2624 dev_dbg(&link->dev, "ray_cs associate failed - ECF not ready for intr\n");
2636 writeb(CCS_BUFFER_FREE, &(pccs++)->buffer_status); 2625 writeb(CCS_BUFFER_FREE, &(pccs++)->buffer_status);
2637 2626
2638 del_timer(&local->timer); 2627 del_timer(&local->timer);
@@ -2655,7 +2644,7 @@ static void rx_deauthenticate(ray_dev_t *local, struct rcs __iomem *prcs,
2655/* UCHAR buff[256]; 2644/* UCHAR buff[256];
2656 struct rx_msg *msg = (struct rx_msg *)buff; 2645 struct rx_msg *msg = (struct rx_msg *)buff;
2657*/ 2646*/
2658 DEBUG(0, "Deauthentication frame received\n"); 2647 pr_debug("Deauthentication frame received\n");
2659 local->authentication_state = UNAUTHENTICATED; 2648 local->authentication_state = UNAUTHENTICATED;
2660 /* Need to reauthenticate or rejoin depending on reason code */ 2649 /* Need to reauthenticate or rejoin depending on reason code */
2661/* copy_from_rx_buff(local, buff, pkt_addr, rx_len & 0xff); 2650/* copy_from_rx_buff(local, buff, pkt_addr, rx_len & 0xff);
@@ -2823,7 +2812,7 @@ static int build_auth_frame(ray_dev_t *local, UCHAR *dest, int auth_type)
2823 2812
2824 /* If no tx buffers available, return */ 2813 /* If no tx buffers available, return */
2825 if ((ccsindex = get_free_tx_ccs(local)) < 0) { 2814 if ((ccsindex = get_free_tx_ccs(local)) < 0) {
2826 DEBUG(1, "ray_cs send authenticate - No free tx ccs\n"); 2815 pr_debug("ray_cs send authenticate - No free tx ccs\n");
2827 return -1; 2816 return -1;
2828 } 2817 }
2829 2818
@@ -2855,7 +2844,7 @@ static int build_auth_frame(ray_dev_t *local, UCHAR *dest, int auth_type)
2855 2844
2856 /* Interrupt the firmware to process the command */ 2845 /* Interrupt the firmware to process the command */
2857 if (interrupt_ecf(local, ccsindex)) { 2846 if (interrupt_ecf(local, ccsindex)) {
2858 DEBUG(1, 2847 pr_debug(
2859 "ray_cs send authentication request failed - ECF not ready for intr\n"); 2848 "ray_cs send authentication request failed - ECF not ready for intr\n");
2860 writeb(CCS_BUFFER_FREE, &(pccs++)->buffer_status); 2849 writeb(CCS_BUFFER_FREE, &(pccs++)->buffer_status);
2861 return -1; 2850 return -1;
@@ -2942,9 +2931,9 @@ static int __init init_ray_cs(void)
2942{ 2931{
2943 int rc; 2932 int rc;
2944 2933
2945 DEBUG(1, "%s\n", rcsid); 2934 pr_debug("%s\n", rcsid);
2946 rc = pcmcia_register_driver(&ray_driver); 2935 rc = pcmcia_register_driver(&ray_driver);
2947 DEBUG(1, "raylink init_module register_pcmcia_driver returns 0x%x\n", 2936 pr_debug("raylink init_module register_pcmcia_driver returns 0x%x\n",
2948 rc); 2937 rc);
2949 2938
2950#ifdef CONFIG_PROC_FS 2939#ifdef CONFIG_PROC_FS
@@ -2964,7 +2953,7 @@ static int __init init_ray_cs(void)
2964 2953
2965static void __exit exit_ray_cs(void) 2954static void __exit exit_ray_cs(void)
2966{ 2955{
2967 DEBUG(0, "ray_cs: cleanup_module\n"); 2956 pr_debug("ray_cs: cleanup_module\n");
2968 2957
2969#ifdef CONFIG_PROC_FS 2958#ifdef CONFIG_PROC_FS
2970 remove_proc_entry("driver/ray_cs/ray_cs", NULL); 2959 remove_proc_entry("driver/ray_cs/ray_cs", NULL);
diff --git a/drivers/net/wireless/wavelan_cs.c b/drivers/net/wireless/wavelan_cs.c
index 431a20ec6db6..33918fd5b231 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
@@ -3894,24 +3876,18 @@ wv_pcmcia_config(struct pcmcia_device * link)
3894 req.Attributes = WIN_DATA_WIDTH_8|WIN_MEMORY_TYPE_AM|WIN_ENABLE; 3876 req.Attributes = WIN_DATA_WIDTH_8|WIN_MEMORY_TYPE_AM|WIN_ENABLE;
3895 req.Base = req.Size = 0; 3877 req.Base = req.Size = 0;
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;
3906 dev->mem_end = dev->mem_start + req.Size; 3885 dev->mem_end = dev->mem_start + req.Size;
3907 3886
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, 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;
@@ -3923,7 +3899,7 @@ wv_pcmcia_config(struct pcmcia_device * link)
3923 lp->mem, dev->irq, (u_int) dev->base_addr); 3899 lp->mem, dev->irq, (u_int) dev->base_addr);
3924#endif 3900#endif
3925 3901
3926 SET_NETDEV_DEV(dev, &handle_to_dev(link)); 3902 SET_NETDEV_DEV(dev, &link->dev);
3927 i = register_netdev(dev); 3903 i = register_netdev(dev);
3928 if(i != 0) 3904 if(i != 0)
3929 { 3905 {
@@ -4462,8 +4438,7 @@ wavelan_probe(struct pcmcia_device *p_dev)
4462 p_dev->io.IOAddrLines = 3; 4438 p_dev->io.IOAddrLines = 3;
4463 4439
4464 /* Interrupt setup */ 4440 /* Interrupt setup */
4465 p_dev->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING | IRQ_HANDLE_PRESENT; 4441 p_dev->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING;
4466 p_dev->irq.IRQInfo1 = IRQ_LEVEL_ID;
4467 p_dev->irq.Handler = wavelan_interrupt; 4442 p_dev->irq.Handler = wavelan_interrupt;
4468 4443
4469 /* General socket configuration */ 4444 /* General socket configuration */
@@ -4475,7 +4450,7 @@ wavelan_probe(struct pcmcia_device *p_dev)
4475 if (!dev) 4450 if (!dev)
4476 return -ENOMEM; 4451 return -ENOMEM;
4477 4452
4478 p_dev->priv = p_dev->irq.Instance = dev; 4453 p_dev->priv = dev;
4479 4454
4480 lp = netdev_priv(dev); 4455 lp = netdev_priv(dev);
4481 4456
diff --git a/drivers/net/wireless/wl3501_cs.c b/drivers/net/wireless/wl3501_cs.c
index 4f1e0cfe609b..5f0401a52cff 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,
@@ -1914,8 +1898,7 @@ static int wl3501_probe(struct pcmcia_device *p_dev)
1914 p_dev->io.IOAddrLines = 5; 1898 p_dev->io.IOAddrLines = 5;
1915 1899
1916 /* Interrupt setup */ 1900 /* Interrupt setup */
1917 p_dev->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING | IRQ_HANDLE_PRESENT; 1901 p_dev->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING;
1918 p_dev->irq.IRQInfo1 = IRQ_LEVEL_ID;
1919 p_dev->irq.Handler = wl3501_interrupt; 1902 p_dev->irq.Handler = wl3501_interrupt;
1920 1903
1921 /* General socket configuration */ 1904 /* General socket configuration */
@@ -1938,16 +1921,13 @@ static int wl3501_probe(struct pcmcia_device *p_dev)
1938 dev->wireless_handlers = &wl3501_handler_def; 1921 dev->wireless_handlers = &wl3501_handler_def;
1939 SET_ETHTOOL_OPS(dev, &ops); 1922 SET_ETHTOOL_OPS(dev, &ops);
1940 netif_stop_queue(dev); 1923 netif_stop_queue(dev);
1941 p_dev->priv = p_dev->irq.Instance = dev; 1924 p_dev->priv = dev;
1942 1925
1943 return wl3501_config(p_dev); 1926 return wl3501_config(p_dev);
1944out_link: 1927out_link:
1945 return -ENOMEM; 1928 return -ENOMEM;
1946} 1929}
1947 1930
1948#define CS_CHECK(fn, ret) \
1949do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0)
1950
1951/** 1931/**
1952 * wl3501_config - configure the PCMCIA socket and make eth device available 1932 * wl3501_config - configure the PCMCIA socket and make eth device available
1953 * @link - FILL_IN 1933 * @link - FILL_IN
@@ -1959,7 +1939,7 @@ do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0)
1959static int wl3501_config(struct pcmcia_device *link) 1939static int wl3501_config(struct pcmcia_device *link)
1960{ 1940{
1961 struct net_device *dev = link->priv; 1941 struct net_device *dev = link->priv;
1962 int i = 0, j, last_fn, last_ret; 1942 int i = 0, j, ret;
1963 struct wl3501_card *this; 1943 struct wl3501_card *this;
1964 1944
1965 /* Try allocating IO ports. This tries a few fixed addresses. If you 1945 /* Try allocating IO ports. This tries a few fixed addresses. If you
@@ -1975,24 +1955,26 @@ static int wl3501_config(struct pcmcia_device *link)
1975 if (i == 0) 1955 if (i == 0)
1976 break; 1956 break;
1977 } 1957 }
1978 if (i != 0) { 1958 if (i != 0)
1979 cs_error(link, RequestIO, i);
1980 goto failed; 1959 goto failed;
1981 }
1982 1960
1983 /* Now allocate an interrupt line. Note that this does not actually 1961 /* Now allocate an interrupt line. Note that this does not actually
1984 * assign a handler to the interrupt. */ 1962 * assign a handler to the interrupt. */
1985 1963
1986 CS_CHECK(RequestIRQ, pcmcia_request_irq(link, &link->irq)); 1964 ret = pcmcia_request_irq(link, &link->irq);
1965 if (ret)
1966 goto failed;
1987 1967
1988 /* This actually configures the PCMCIA socket -- setting up the I/O 1968 /* This actually configures the PCMCIA socket -- setting up the I/O
1989 * windows and the interrupt mapping. */ 1969 * windows and the interrupt mapping. */
1990 1970
1991 CS_CHECK(RequestConfiguration, pcmcia_request_configuration(link, &link->conf)); 1971 ret = pcmcia_request_configuration(link, &link->conf);
1972 if (ret)
1973 goto failed;
1992 1974
1993 dev->irq = link->irq.AssignedIRQ; 1975 dev->irq = link->irq.AssignedIRQ;
1994 dev->base_addr = link->io.BasePort1; 1976 dev->base_addr = link->io.BasePort1;
1995 SET_NETDEV_DEV(dev, &handle_to_dev(link)); 1977 SET_NETDEV_DEV(dev, &link->dev);
1996 if (register_netdev(dev)) { 1978 if (register_netdev(dev)) {
1997 printk(KERN_NOTICE "wl3501_cs: register_netdev() failed\n"); 1979 printk(KERN_NOTICE "wl3501_cs: register_netdev() failed\n");
1998 goto failed; 1980 goto failed;
@@ -2041,8 +2023,6 @@ static int wl3501_config(struct pcmcia_device *link)
2041 netif_start_queue(dev); 2023 netif_start_queue(dev);
2042 return 0; 2024 return 0;
2043 2025
2044cs_failed:
2045 cs_error(link, last_fn, last_ret);
2046failed: 2026failed:
2047 wl3501_release(link); 2027 wl3501_release(link);
2048 return -ENODEV; 2028 return -ENODEV;