aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char/pcmcia
diff options
context:
space:
mode:
authorDominik Brodowski <linux@dominikbrodowski.net>2009-10-24 09:47:29 -0400
committerDominik Brodowski <linux@dominikbrodowski.net>2009-11-09 02:29:48 -0500
commitcbf624f0e18c4a05219855663a3e5f9fe8f2d876 (patch)
tree8aac18761959b45a29faaca79926966b46ac57d1 /drivers/char/pcmcia
parent9ac3e58ceff0b7b8b981c09c38a28742270eea12 (diff)
pcmcia: use dynamic debug infrastructure, deprecate CS_CHECK (char)
Convert PCMCIA drivers to use the dynamic debug infrastructure, instead of requiring manual settings of PCMCIA_DEBUG. Only some rare extra debug checks in cm4000_cs.c cm4040_cs.c are now hidden behind a "#ifdef CM4000_DEBUG" or "#ifdef CM4040_DEBUG". Also, remove all usages of the CS_CHECK macro and replace them with proper Linux style calling and return value checking. The extra error reporting may be dropped, as the PCMCIA core already complains about any (non-driver-author) errors. CC: Harald Welte <laforge@gnumonks.org> CC: Jiri Kosina <jkosina@suse.cz> CC: David Sterba <dsterba@suse.cz> Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
Diffstat (limited to 'drivers/char/pcmcia')
-rw-r--r--drivers/char/pcmcia/cm4000_cs.c71
-rw-r--r--drivers/char/pcmcia/cm4040_cs.c42
-rw-r--r--drivers/char/pcmcia/ipwireless/main.c34
-rw-r--r--drivers/char/pcmcia/synclink_cs.c23
4 files changed, 63 insertions, 107 deletions
diff --git a/drivers/char/pcmcia/cm4000_cs.c b/drivers/char/pcmcia/cm4000_cs.c
index c250a31efa53..1611c4fe97fc 100644
--- a/drivers/char/pcmcia/cm4000_cs.c
+++ b/drivers/char/pcmcia/cm4000_cs.c
@@ -23,8 +23,6 @@
23 * All rights reserved. Licensed under dual BSD/GPL license. 23 * All rights reserved. Licensed under dual BSD/GPL license.
24 */ 24 */
25 25
26/* #define PCMCIA_DEBUG 6 */
27
28#include <linux/kernel.h> 26#include <linux/kernel.h>
29#include <linux/module.h> 27#include <linux/module.h>
30#include <linux/slab.h> 28#include <linux/slab.h>
@@ -47,18 +45,17 @@
47 45
48/* #define ATR_CSUM */ 46/* #define ATR_CSUM */
49 47
50#ifdef PCMCIA_DEBUG
51#define reader_to_dev(x) (&handle_to_dev(x->p_dev)) 48#define reader_to_dev(x) (&handle_to_dev(x->p_dev))
52static int pc_debug = PCMCIA_DEBUG; 49
53module_param(pc_debug, int, 0600); 50/* n (debug level) is ignored */
54#define DEBUGP(n, rdr, x, args...) do { \ 51/* additional debug output may be enabled by re-compiling with
55 if (pc_debug >= (n)) \ 52 * CM4000_DEBUG set */
56 dev_printk(KERN_DEBUG, reader_to_dev(rdr), "%s:" x, \ 53/* #define CM4000_DEBUG */
57 __func__ , ## args); \ 54#define DEBUGP(n, rdr, x, args...) do { \
55 dev_dbg(reader_to_dev(rdr), "%s:" x, \
56 __func__ , ## args); \
58 } while (0) 57 } while (0)
59#else 58
60#define DEBUGP(n, rdr, x, args...)
61#endif
62static char *version = "cm4000_cs.c v2.4.0gm6 - All bugs added by Harald Welte"; 59static char *version = "cm4000_cs.c v2.4.0gm6 - All bugs added by Harald Welte";
63 60
64#define T_1SEC (HZ) 61#define T_1SEC (HZ)
@@ -174,14 +171,13 @@ static unsigned char fi_di_table[10][14] = {
174/* 9 */ {0x09,0x19,0x29,0x39,0x49,0x59,0x69,0x11,0x11,0x99,0xA9,0xB9,0xC9,0xD9} 171/* 9 */ {0x09,0x19,0x29,0x39,0x49,0x59,0x69,0x11,0x11,0x99,0xA9,0xB9,0xC9,0xD9}
175}; 172};
176 173
177#ifndef PCMCIA_DEBUG 174#ifndef CM4000_DEBUG
178#define xoutb outb 175#define xoutb outb
179#define xinb inb 176#define xinb inb
180#else 177#else
181static inline void xoutb(unsigned char val, unsigned short port) 178static inline void xoutb(unsigned char val, unsigned short port)
182{ 179{
183 if (pc_debug >= 7) 180 pr_debug("outb(val=%.2x,port=%.4x)\n", val, port);
184 printk(KERN_DEBUG "outb(val=%.2x,port=%.4x)\n", val, port);
185 outb(val, port); 181 outb(val, port);
186} 182}
187static inline unsigned char xinb(unsigned short port) 183static inline unsigned char xinb(unsigned short port)
@@ -189,8 +185,7 @@ static inline unsigned char xinb(unsigned short port)
189 unsigned char val; 185 unsigned char val;
190 186
191 val = inb(port); 187 val = inb(port);
192 if (pc_debug >= 7) 188 pr_debug("%.2x=inb(%.4x)\n", val, port);
193 printk(KERN_DEBUG "%.2x=inb(%.4x)\n", val, port);
194 189
195 return val; 190 return val;
196} 191}
@@ -514,12 +509,10 @@ static int set_protocol(struct cm4000_dev *dev, struct ptsreq *ptsreq)
514 for (i = 0; i < 4; i++) { 509 for (i = 0; i < 4; i++) {
515 xoutb(i, REG_BUF_ADDR(iobase)); 510 xoutb(i, REG_BUF_ADDR(iobase));
516 xoutb(dev->pts[i], REG_BUF_DATA(iobase)); /* buf data */ 511 xoutb(dev->pts[i], REG_BUF_DATA(iobase)); /* buf data */
517#ifdef PCMCIA_DEBUG 512#ifdef CM4000_DEBUG
518 if (pc_debug >= 5) 513 pr_debug("0x%.2x ", dev->pts[i]);
519 printk("0x%.2x ", dev->pts[i]);
520 } 514 }
521 if (pc_debug >= 5) 515 pr_debug("\n");
522 printk("\n");
523#else 516#else
524 } 517 }
525#endif 518#endif
@@ -579,14 +572,13 @@ static int set_protocol(struct cm4000_dev *dev, struct ptsreq *ptsreq)
579 pts_reply[i] = inb(REG_BUF_DATA(iobase)); 572 pts_reply[i] = inb(REG_BUF_DATA(iobase));
580 } 573 }
581 574
582#ifdef PCMCIA_DEBUG 575#ifdef CM4000_DEBUG
583 DEBUGP(2, dev, "PTSreply: "); 576 DEBUGP(2, dev, "PTSreply: ");
584 for (i = 0; i < num_bytes_read; i++) { 577 for (i = 0; i < num_bytes_read; i++) {
585 if (pc_debug >= 5) 578 pr_debug("0x%.2x ", pts_reply[i]);
586 printk("0x%.2x ", pts_reply[i]);
587 } 579 }
588 printk("\n"); 580 pr_debug("\n");
589#endif /* PCMCIA_DEBUG */ 581#endif /* CM4000_DEBUG */
590 582
591 DEBUGP(5, dev, "Clear Tactive in Flags1\n"); 583 DEBUGP(5, dev, "Clear Tactive in Flags1\n");
592 xoutb(0x20, REG_FLAGS1(iobase)); 584 xoutb(0x20, REG_FLAGS1(iobase));
@@ -655,7 +647,7 @@ static void terminate_monitor(struct cm4000_dev *dev)
655 647
656 DEBUGP(5, dev, "Delete timer\n"); 648 DEBUGP(5, dev, "Delete timer\n");
657 del_timer_sync(&dev->timer); 649 del_timer_sync(&dev->timer);
658#ifdef PCMCIA_DEBUG 650#ifdef CM4000_DEBUG
659 dev->monitor_running = 0; 651 dev->monitor_running = 0;
660#endif 652#endif
661 653
@@ -898,7 +890,7 @@ static void monitor_card(unsigned long p)
898 DEBUGP(4, dev, "ATR checksum (0x%.2x, should " 890 DEBUGP(4, dev, "ATR checksum (0x%.2x, should "
899 "be zero) failed\n", dev->atr_csum); 891 "be zero) failed\n", dev->atr_csum);
900 } 892 }
901#ifdef PCMCIA_DEBUG 893#ifdef CM4000_DEBUG
902 else if (test_bit(IS_BAD_LENGTH, &dev->flags)) { 894 else if (test_bit(IS_BAD_LENGTH, &dev->flags)) {
903 DEBUGP(4, dev, "ATR length error\n"); 895 DEBUGP(4, dev, "ATR length error\n");
904 } else { 896 } else {
@@ -1415,7 +1407,7 @@ static long cmm_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
1415 int size; 1407 int size;
1416 int rc; 1408 int rc;
1417 void __user *argp = (void __user *)arg; 1409 void __user *argp = (void __user *)arg;
1418#ifdef PCMCIA_DEBUG 1410#ifdef CM4000_DEBUG
1419 char *ioctl_names[CM_IOC_MAXNR + 1] = { 1411 char *ioctl_names[CM_IOC_MAXNR + 1] = {
1420 [_IOC_NR(CM_IOCGSTATUS)] "CM_IOCGSTATUS", 1412 [_IOC_NR(CM_IOCGSTATUS)] "CM_IOCGSTATUS",
1421 [_IOC_NR(CM_IOCGATR)] "CM_IOCGATR", 1413 [_IOC_NR(CM_IOCGATR)] "CM_IOCGATR",
@@ -1423,9 +1415,9 @@ static long cmm_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
1423 [_IOC_NR(CM_IOCSPTS)] "CM_IOCSPTS", 1415 [_IOC_NR(CM_IOCSPTS)] "CM_IOCSPTS",
1424 [_IOC_NR(CM_IOSDBGLVL)] "CM4000_DBGLVL", 1416 [_IOC_NR(CM_IOSDBGLVL)] "CM4000_DBGLVL",
1425 }; 1417 };
1426#endif
1427 DEBUGP(3, dev, "cmm_ioctl(device=%d.%d) %s\n", imajor(inode), 1418 DEBUGP(3, dev, "cmm_ioctl(device=%d.%d) %s\n", imajor(inode),
1428 iminor(inode), ioctl_names[_IOC_NR(cmd)]); 1419 iminor(inode), ioctl_names[_IOC_NR(cmd)]);
1420#endif
1429 1421
1430 lock_kernel(); 1422 lock_kernel();
1431 rc = -ENODEV; 1423 rc = -ENODEV;
@@ -1523,7 +1515,7 @@ static long cmm_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
1523 } 1515 }
1524 case CM_IOCARDOFF: 1516 case CM_IOCARDOFF:
1525 1517
1526#ifdef PCMCIA_DEBUG 1518#ifdef CM4000_DEBUG
1527 DEBUGP(4, dev, "... in CM_IOCARDOFF\n"); 1519 DEBUGP(4, dev, "... in CM_IOCARDOFF\n");
1528 if (dev->flags0 & 0x01) { 1520 if (dev->flags0 & 0x01) {
1529 DEBUGP(4, dev, " Card inserted\n"); 1521 DEBUGP(4, dev, " Card inserted\n");
@@ -1625,18 +1617,9 @@ static long cmm_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
1625 1617
1626 } 1618 }
1627 break; 1619 break;
1628#ifdef PCMCIA_DEBUG 1620#ifdef CM4000_DEBUG
1629 case CM_IOSDBGLVL: /* set debug log level */ 1621 case CM_IOSDBGLVL:
1630 { 1622 rc = -ENOTTY;
1631 int old_pc_debug = 0;
1632
1633 old_pc_debug = pc_debug;
1634 if (copy_from_user(&pc_debug, argp, sizeof(int)))
1635 rc = -EFAULT;
1636 else if (old_pc_debug != pc_debug)
1637 DEBUGP(0, dev, "Changed debug log level "
1638 "to %i\n", pc_debug);
1639 }
1640 break; 1623 break;
1641#endif 1624#endif
1642 default: 1625 default:
diff --git a/drivers/char/pcmcia/cm4040_cs.c b/drivers/char/pcmcia/cm4040_cs.c
index 4f0723b07974..0001ad2e58bd 100644
--- a/drivers/char/pcmcia/cm4040_cs.c
+++ b/drivers/char/pcmcia/cm4040_cs.c
@@ -17,8 +17,6 @@
17 * All rights reserved, Dual BSD/GPL Licensed. 17 * All rights reserved, Dual BSD/GPL Licensed.
18 */ 18 */
19 19
20/* #define PCMCIA_DEBUG 6 */
21
22#include <linux/kernel.h> 20#include <linux/kernel.h>
23#include <linux/module.h> 21#include <linux/module.h>
24#include <linux/slab.h> 22#include <linux/slab.h>
@@ -41,18 +39,16 @@
41#include "cm4040_cs.h" 39#include "cm4040_cs.h"
42 40
43 41
44#ifdef PCMCIA_DEBUG
45#define reader_to_dev(x) (&handle_to_dev(x->p_dev)) 42#define reader_to_dev(x) (&handle_to_dev(x->p_dev))
46static int pc_debug = PCMCIA_DEBUG; 43
47module_param(pc_debug, int, 0600); 44/* n (debug level) is ignored */
48#define DEBUGP(n, rdr, x, args...) do { \ 45/* additional debug output may be enabled by re-compiling with
49 if (pc_debug >= (n)) \ 46 * CM4040_DEBUG set */
50 dev_printk(KERN_DEBUG, reader_to_dev(rdr), "%s:" x, \ 47/* #define CM4040_DEBUG */
51 __func__ , ##args); \ 48#define DEBUGP(n, rdr, x, args...) do { \
49 dev_dbg(reader_to_dev(rdr), "%s:" x, \
50 __func__ , ## args); \
52 } while (0) 51 } while (0)
53#else
54#define DEBUGP(n, rdr, x, args...)
55#endif
56 52
57static char *version = 53static char *version =
58"OMNIKEY CardMan 4040 v1.1.0gm5 - All bugs added by Harald Welte"; 54"OMNIKEY CardMan 4040 v1.1.0gm5 - All bugs added by Harald Welte";
@@ -90,14 +86,13 @@ struct reader_dev {
90 86
91static struct pcmcia_device *dev_table[CM_MAX_DEV]; 87static struct pcmcia_device *dev_table[CM_MAX_DEV];
92 88
93#ifndef PCMCIA_DEBUG 89#ifndef CM4040_DEBUG
94#define xoutb outb 90#define xoutb outb
95#define xinb inb 91#define xinb inb
96#else 92#else
97static inline void xoutb(unsigned char val, unsigned short port) 93static inline void xoutb(unsigned char val, unsigned short port)
98{ 94{
99 if (pc_debug >= 7) 95 pr_debug("outb(val=%.2x,port=%.4x)\n", val, port);
100 printk(KERN_DEBUG "outb(val=%.2x,port=%.4x)\n", val, port);
101 outb(val, port); 96 outb(val, port);
102} 97}
103 98
@@ -106,8 +101,7 @@ static inline unsigned char xinb(unsigned short port)
106 unsigned char val; 101 unsigned char val;
107 102
108 val = inb(port); 103 val = inb(port);
109 if (pc_debug >= 7) 104 pr_debug("%.2x=inb(%.4x)\n", val, port);
110 printk(KERN_DEBUG "%.2x=inb(%.4x)\n", val, port);
111 return val; 105 return val;
112} 106}
113#endif 107#endif
@@ -260,11 +254,10 @@ static ssize_t cm4040_read(struct file *filp, char __user *buf,
260 return -EIO; 254 return -EIO;
261 } 255 }
262 dev->r_buf[i] = xinb(iobase + REG_OFFSET_BULK_IN); 256 dev->r_buf[i] = xinb(iobase + REG_OFFSET_BULK_IN);
263#ifdef PCMCIA_DEBUG 257#ifdef CM4040_DEBUG
264 if (pc_debug >= 6) 258 pr_debug("%lu:%2x ", i, dev->r_buf[i]);
265 printk(KERN_DEBUG "%lu:%2x ", i, dev->r_buf[i]);
266 } 259 }
267 printk("\n"); 260 pr_debug("\n");
268#else 261#else
269 } 262 }
270#endif 263#endif
@@ -288,11 +281,10 @@ static ssize_t cm4040_read(struct file *filp, char __user *buf,
288 return -EIO; 281 return -EIO;
289 } 282 }
290 dev->r_buf[i+5] = xinb(iobase + REG_OFFSET_BULK_IN); 283 dev->r_buf[i+5] = xinb(iobase + REG_OFFSET_BULK_IN);
291#ifdef PCMCIA_DEBUG 284#ifdef CM4040_DEBUG
292 if (pc_debug >= 6) 285 pr_debug("%lu:%2x ", i, dev->r_buf[i]);
293 printk(KERN_DEBUG "%lu:%2x ", i, dev->r_buf[i]);
294 } 286 }
295 printk("\n"); 287 pr_debug("\n");
296#else 288#else
297 } 289 }
298#endif 290#endif
diff --git a/drivers/char/pcmcia/ipwireless/main.c b/drivers/char/pcmcia/ipwireless/main.c
index 0f4674959917..24bffa4ece49 100644
--- a/drivers/char/pcmcia/ipwireless/main.c
+++ b/drivers/char/pcmcia/ipwireless/main.c
@@ -65,10 +65,7 @@ static void signalled_reboot_work(struct work_struct *work_reboot)
65 struct ipw_dev *ipw = container_of(work_reboot, struct ipw_dev, 65 struct ipw_dev *ipw = container_of(work_reboot, struct ipw_dev,
66 work_reboot); 66 work_reboot);
67 struct pcmcia_device *link = ipw->link; 67 struct pcmcia_device *link = ipw->link;
68 int ret = pcmcia_reset_card(link->socket); 68 pcmcia_reset_card(link->socket);
69
70 if (ret != 0)
71 cs_error(link, ResetCard, ret);
72} 69}
73 70
74static void signalled_reboot_callback(void *callback_data) 71static void signalled_reboot_callback(void *callback_data)
@@ -122,10 +119,8 @@ static int ipwireless_probe(struct pcmcia_device *p_dev,
122 ret = pcmcia_request_window(&p_dev, &ipw->request_common_memory, 119 ret = pcmcia_request_window(&p_dev, &ipw->request_common_memory,
123 &ipw->handle_common_memory); 120 &ipw->handle_common_memory);
124 121
125 if (ret != 0) { 122 if (ret != 0)
126 cs_error(p_dev, RequestWindow, ret);
127 goto exit1; 123 goto exit1;
128 }
129 124
130 memreq_common_memory.CardOffset = cfg->mem.win[0].card_addr; 125 memreq_common_memory.CardOffset = cfg->mem.win[0].card_addr;
131 memreq_common_memory.Page = 0; 126 memreq_common_memory.Page = 0;
@@ -133,10 +128,8 @@ static int ipwireless_probe(struct pcmcia_device *p_dev,
133 ret = pcmcia_map_mem_page(ipw->handle_common_memory, 128 ret = pcmcia_map_mem_page(ipw->handle_common_memory,
134 &memreq_common_memory); 129 &memreq_common_memory);
135 130
136 if (ret != 0) { 131 if (ret != 0)
137 cs_error(p_dev, MapMemPage, ret);
138 goto exit2; 132 goto exit2;
139 }
140 133
141 ipw->is_v2_card = cfg->mem.win[0].len == 0x100; 134 ipw->is_v2_card = cfg->mem.win[0].len == 0x100;
142 135
@@ -155,10 +148,8 @@ static int ipwireless_probe(struct pcmcia_device *p_dev,
155 ret = pcmcia_request_window(&p_dev, &ipw->request_attr_memory, 148 ret = pcmcia_request_window(&p_dev, &ipw->request_attr_memory,
156 &ipw->handle_attr_memory); 149 &ipw->handle_attr_memory);
157 150
158 if (ret != 0) { 151 if (ret != 0)
159 cs_error(p_dev, RequestWindow, ret);
160 goto exit2; 152 goto exit2;
161 }
162 153
163 memreq_attr_memory.CardOffset = 0; 154 memreq_attr_memory.CardOffset = 0;
164 memreq_attr_memory.Page = 0; 155 memreq_attr_memory.Page = 0;
@@ -166,10 +157,8 @@ static int ipwireless_probe(struct pcmcia_device *p_dev,
166 ret = pcmcia_map_mem_page(ipw->handle_attr_memory, 157 ret = pcmcia_map_mem_page(ipw->handle_attr_memory,
167 &memreq_attr_memory); 158 &memreq_attr_memory);
168 159
169 if (ret != 0) { 160 if (ret != 0)
170 cs_error(p_dev, MapMemPage, ret);
171 goto exit3; 161 goto exit3;
172 }
173 162
174 ipw->attr_memory = ioremap(ipw->request_attr_memory.Base, 163 ipw->attr_memory = ioremap(ipw->request_attr_memory.Base,
175 ipw->request_attr_memory.Size); 164 ipw->request_attr_memory.Size);
@@ -202,10 +191,8 @@ static int config_ipwireless(struct ipw_dev *ipw)
202 ipw->is_v2_card = 0; 191 ipw->is_v2_card = 0;
203 192
204 ret = pcmcia_loop_config(link, ipwireless_probe, ipw); 193 ret = pcmcia_loop_config(link, ipwireless_probe, ipw);
205 if (ret != 0) { 194 if (ret != 0)
206 cs_error(link, RequestIO, ret);
207 return ret; 195 return ret;
208 }
209 196
210 link->conf.Attributes = CONF_ENABLE_IRQ; 197 link->conf.Attributes = CONF_ENABLE_IRQ;
211 link->conf.IntType = INT_MEMORY_AND_IO; 198 link->conf.IntType = INT_MEMORY_AND_IO;
@@ -223,10 +210,8 @@ static int config_ipwireless(struct ipw_dev *ipw)
223 210
224 ret = pcmcia_request_irq(link, &link->irq); 211 ret = pcmcia_request_irq(link, &link->irq);
225 212
226 if (ret != 0) { 213 if (ret != 0)
227 cs_error(link, RequestIRQ, ret);
228 goto exit; 214 goto exit;
229 }
230 215
231 printk(KERN_INFO IPWIRELESS_PCCARD_NAME ": Card type %s\n", 216 printk(KERN_INFO IPWIRELESS_PCCARD_NAME ": Card type %s\n",
232 ipw->is_v2_card ? "V2/V3" : "V1"); 217 ipw->is_v2_card ? "V2/V3" : "V1");
@@ -263,10 +248,8 @@ static int config_ipwireless(struct ipw_dev *ipw)
263 */ 248 */
264 ret = pcmcia_request_configuration(link, &link->conf); 249 ret = pcmcia_request_configuration(link, &link->conf);
265 250
266 if (ret != 0) { 251 if (ret != 0)
267 cs_error(link, RequestConfiguration, ret);
268 goto exit; 252 goto exit;
269 }
270 253
271 link->dev_node = &ipw->nodes[0]; 254 link->dev_node = &ipw->nodes[0];
272 255
@@ -347,7 +330,6 @@ static int ipwireless_attach(struct pcmcia_device *link)
347 ret = config_ipwireless(ipw); 330 ret = config_ipwireless(ipw);
348 331
349 if (ret != 0) { 332 if (ret != 0) {
350 cs_error(link, RegisterClient, ret);
351 ipwireless_detach(link); 333 ipwireless_detach(link);
352 return ret; 334 return ret;
353 } 335 }
diff --git a/drivers/char/pcmcia/synclink_cs.c b/drivers/char/pcmcia/synclink_cs.c
index 429b7313119b..09b2590adb8b 100644
--- a/drivers/char/pcmcia/synclink_cs.c
+++ b/drivers/char/pcmcia/synclink_cs.c
@@ -572,9 +572,6 @@ static int mgslpc_probe(struct pcmcia_device *link)
572/* Card has been inserted. 572/* Card has been inserted.
573 */ 573 */
574 574
575#define CS_CHECK(fn, ret) \
576do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0)
577
578static int mgslpc_ioprobe(struct pcmcia_device *p_dev, 575static int mgslpc_ioprobe(struct pcmcia_device *p_dev,
579 cistpl_cftable_entry_t *cfg, 576 cistpl_cftable_entry_t *cfg,
580 cistpl_cftable_entry_t *dflt, 577 cistpl_cftable_entry_t *dflt,
@@ -598,15 +595,14 @@ static int mgslpc_ioprobe(struct pcmcia_device *p_dev,
598static int mgslpc_config(struct pcmcia_device *link) 595static int mgslpc_config(struct pcmcia_device *link)
599{ 596{
600 MGSLPC_INFO *info = link->priv; 597 MGSLPC_INFO *info = link->priv;
601 int last_fn = RequestIO; 598 int ret;
602 int last_ret;
603 599
604 if (debug_level >= DEBUG_LEVEL_INFO) 600 if (debug_level >= DEBUG_LEVEL_INFO)
605 printk("mgslpc_config(0x%p)\n", link); 601 printk("mgslpc_config(0x%p)\n", link);
606 602
607 last_ret = pcmcia_loop_config(link, mgslpc_ioprobe, NULL); 603 ret = pcmcia_loop_config(link, mgslpc_ioprobe, NULL);
608 if (last_ret != 0) 604 if (ret != 0)
609 goto cs_failed; 605 goto failed;
610 606
611 link->conf.Attributes = CONF_ENABLE_IRQ; 607 link->conf.Attributes = CONF_ENABLE_IRQ;
612 link->conf.IntType = INT_MEMORY_AND_IO; 608 link->conf.IntType = INT_MEMORY_AND_IO;
@@ -616,9 +612,13 @@ static int mgslpc_config(struct pcmcia_device *link)
616 link->irq.Attributes |= IRQ_HANDLE_PRESENT; 612 link->irq.Attributes |= IRQ_HANDLE_PRESENT;
617 link->irq.Handler = mgslpc_isr; 613 link->irq.Handler = mgslpc_isr;
618 link->irq.Instance = info; 614 link->irq.Instance = info;
619 CS_CHECK(RequestIRQ, pcmcia_request_irq(link, &link->irq));
620 615
621 CS_CHECK(RequestConfiguration, pcmcia_request_configuration(link, &link->conf)); 616 ret = pcmcia_request_irq(link, &link->irq);
617 if (ret)
618 goto failed;
619 ret = pcmcia_request_configuration(link, &link->conf);
620 if (ret)
621 goto failed;
622 622
623 info->io_base = link->io.BasePort1; 623 info->io_base = link->io.BasePort1;
624 info->irq_level = link->irq.AssignedIRQ; 624 info->irq_level = link->irq.AssignedIRQ;
@@ -638,8 +638,7 @@ static int mgslpc_config(struct pcmcia_device *link)
638 printk("\n"); 638 printk("\n");
639 return 0; 639 return 0;
640 640
641cs_failed: 641failed:
642 cs_error(link, last_fn, last_ret);
643 mgslpc_release((u_long)link); 642 mgslpc_release((u_long)link);
644 return -ENODEV; 643 return -ENODEV;
645} 644}