aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/atmel_cs.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/wireless/atmel_cs.c')
-rw-r--r--drivers/net/wireless/atmel_cs.c46
1 files changed, 15 insertions, 31 deletions
diff --git a/drivers/net/wireless/atmel_cs.c b/drivers/net/wireless/atmel_cs.c
index ddaa859c349..78385722a76 100644
--- a/drivers/net/wireless/atmel_cs.c
+++ b/drivers/net/wireless/atmel_cs.c
@@ -55,22 +55,6 @@
55 55
56#include "atmel.h" 56#include "atmel.h"
57 57
58/*
59 All the PCMCIA modules use PCMCIA_DEBUG to control debugging. If
60 you do not define PCMCIA_DEBUG at all, all the debug code will be
61 left out. If you compile with PCMCIA_DEBUG=0, the debug code will
62 be present but disabled -- but it can then be enabled for specific
63 modules at load time with a 'pc_debug=#' option to insmod.
64*/
65
66#ifdef PCMCIA_DEBUG
67static int pc_debug = PCMCIA_DEBUG;
68module_param(pc_debug, int, 0);
69static char *version = "$Revision: 1.2 $";
70#define DEBUG(n, args...) if (pc_debug>(n)) printk(KERN_DEBUG args);
71#else
72#define DEBUG(n, args...)
73#endif
74 58
75/*====================================================================*/ 59/*====================================================================*/
76 60
@@ -155,7 +139,7 @@ static int atmel_probe(struct pcmcia_device *p_dev)
155{ 139{
156 local_info_t *local; 140 local_info_t *local;
157 141
158 DEBUG(0, "atmel_attach()\n"); 142 dev_dbg(&p_dev->dev, "atmel_attach()\n");
159 143
160 /* Interrupt setup */ 144 /* Interrupt setup */
161 p_dev->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING; 145 p_dev->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING;
@@ -194,7 +178,7 @@ static int atmel_probe(struct pcmcia_device *p_dev)
194 178
195static void atmel_detach(struct pcmcia_device *link) 179static void atmel_detach(struct pcmcia_device *link)
196{ 180{
197 DEBUG(0, "atmel_detach(0x%p)\n", link); 181 dev_dbg(&link->dev, "atmel_detach\n");
198 182
199 atmel_release(link); 183 atmel_release(link);
200 184
@@ -209,9 +193,6 @@ static void atmel_detach(struct pcmcia_device *link)
209 193
210 ======================================================================*/ 194 ======================================================================*/
211 195
212#define CS_CHECK(fn, ret) \
213do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0)
214
215/* Call-back function to interrogate PCMCIA-specific information 196/* Call-back function to interrogate PCMCIA-specific information
216 about the current existance of the card */ 197 about the current existance of the card */
217static int card_present(void *arg) 198static int card_present(void *arg)
@@ -275,13 +256,13 @@ static int atmel_config_check(struct pcmcia_device *p_dev,
275static int atmel_config(struct pcmcia_device *link) 256static int atmel_config(struct pcmcia_device *link)
276{ 257{
277 local_info_t *dev; 258 local_info_t *dev;
278 int last_fn, last_ret; 259 int ret;
279 struct pcmcia_device_id *did; 260 struct pcmcia_device_id *did;
280 261
281 dev = link->priv; 262 dev = link->priv;
282 did = dev_get_drvdata(&handle_to_dev(link)); 263 did = dev_get_drvdata(&handle_to_dev(link));
283 264
284 DEBUG(0, "atmel_config(0x%p)\n", link); 265 dev_dbg(&link->dev, "atmel_config\n");
285 266
286 /* 267 /*
287 In this loop, we scan the CIS for configuration table entries, 268 In this loop, we scan the CIS for configuration table entries,
@@ -303,20 +284,25 @@ static int atmel_config(struct pcmcia_device *link)
303 handler to the interrupt, unless the 'Handler' member of the 284 handler to the interrupt, unless the 'Handler' member of the
304 irq structure is initialized. 285 irq structure is initialized.
305 */ 286 */
306 if (link->conf.Attributes & CONF_ENABLE_IRQ) 287 if (link->conf.Attributes & CONF_ENABLE_IRQ) {
307 CS_CHECK(RequestIRQ, pcmcia_request_irq(link, &link->irq)); 288 ret = pcmcia_request_irq(link, &link->irq);
289 if (ret)
290 goto failed;
291 }
308 292
309 /* 293 /*
310 This actually configures the PCMCIA socket -- setting up 294 This actually configures the PCMCIA socket -- setting up
311 the I/O windows and the interrupt mapping, and putting the 295 the I/O windows and the interrupt mapping, and putting the
312 card and host interface into "Memory and IO" mode. 296 card and host interface into "Memory and IO" mode.
313 */ 297 */
314 CS_CHECK(RequestConfiguration, pcmcia_request_configuration(link, &link->conf)); 298 ret = pcmcia_request_configuration(link, &link->conf);
299 if (ret)
300 goto failed;
315 301
316 if (link->irq.AssignedIRQ == 0) { 302 if (link->irq.AssignedIRQ == 0) {
317 printk(KERN_ALERT 303 printk(KERN_ALERT
318 "atmel: cannot assign IRQ: check that CONFIG_ISA is set in kernel config."); 304 "atmel: cannot assign IRQ: check that CONFIG_ISA is set in kernel config.");
319 goto cs_failed; 305 goto failed;
320 } 306 }
321 307
322 ((local_info_t*)link->priv)->eth_dev = 308 ((local_info_t*)link->priv)->eth_dev =
@@ -327,7 +313,7 @@ static int atmel_config(struct pcmcia_device *link)
327 card_present, 313 card_present,
328 link); 314 link);
329 if (!((local_info_t*)link->priv)->eth_dev) 315 if (!((local_info_t*)link->priv)->eth_dev)
330 goto cs_failed; 316 goto failed;
331 317
332 318
333 /* 319 /*
@@ -340,8 +326,6 @@ static int atmel_config(struct pcmcia_device *link)
340 326
341 return 0; 327 return 0;
342 328
343 cs_failed:
344 cs_error(link, last_fn, last_ret);
345 failed: 329 failed:
346 atmel_release(link); 330 atmel_release(link);
347 return -ENODEV; 331 return -ENODEV;
@@ -359,7 +343,7 @@ static void atmel_release(struct pcmcia_device *link)
359{ 343{
360 struct net_device *dev = ((local_info_t*)link->priv)->eth_dev; 344 struct net_device *dev = ((local_info_t*)link->priv)->eth_dev;
361 345
362 DEBUG(0, "atmel_release(0x%p)\n", link); 346 dev_dbg(&link->dev, "atmel_release\n");
363 347
364 if (dev) 348 if (dev)
365 stop_atmel_card(dev); 349 stop_atmel_card(dev);