aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/orinoco/spectrum_cs.c
diff options
context:
space:
mode:
authorDominik Brodowski <linux@dominikbrodowski.net>2009-10-24 09:53:36 -0400
committerDominik Brodowski <linux@dominikbrodowski.net>2009-11-09 02:30:02 -0500
commit2caff14713d53abba273e6095495788e2720f756 (patch)
treed22eeea544d7a746a8c107322602d0da77450dff /drivers/net/wireless/orinoco/spectrum_cs.c
parent624dd66957e53e15cf40e937b50597c4d41f0e99 (diff)
pcmcia: use dynamic debug infrastructure, deprecate CS_CHECK (wireless)
Convert PCMCIA drivers to use the dynamic debug infrastructure, instead of requiring manual settings of PCMCIA_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: linux-wireless@vger.kernel.org CC: netdev@vger.kernel.org Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
Diffstat (limited to 'drivers/net/wireless/orinoco/spectrum_cs.c')
-rw-r--r--drivers/net/wireless/orinoco/spectrum_cs.c54
1 files changed, 27 insertions, 27 deletions
diff --git a/drivers/net/wireless/orinoco/spectrum_cs.c b/drivers/net/wireless/orinoco/spectrum_cs.c
index c361310b885d..700010e9e346 100644
--- a/drivers/net/wireless/orinoco/spectrum_cs.c
+++ b/drivers/net/wireless/orinoco/spectrum_cs.c
@@ -73,9 +73,6 @@ static void spectrum_cs_release(struct pcmcia_device *link);
73#define HCR_MEM16 0x10 /* memory width bit, should be preserved */ 73#define HCR_MEM16 0x10 /* memory width bit, should be preserved */
74 74
75 75
76#define CS_CHECK(fn, ret) \
77 do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0)
78
79/* 76/*
80 * Reset the card using configuration registers COR and CCSR. 77 * Reset the card using configuration registers COR and CCSR.
81 * If IDLE is 1, stop the firmware, so that it can be safely rewritten. 78 * If IDLE is 1, stop the firmware, so that it can be safely rewritten.
@@ -83,7 +80,7 @@ static void spectrum_cs_release(struct pcmcia_device *link);
83static int 80static int
84spectrum_reset(struct pcmcia_device *link, int idle) 81spectrum_reset(struct pcmcia_device *link, int idle)
85{ 82{
86 int last_ret, last_fn; 83 int ret;
87 conf_reg_t reg; 84 conf_reg_t reg;
88 u_int save_cor; 85 u_int save_cor;
89 86
@@ -95,23 +92,26 @@ spectrum_reset(struct pcmcia_device *link, int idle)
95 reg.Function = 0; 92 reg.Function = 0;
96 reg.Action = CS_READ; 93 reg.Action = CS_READ;
97 reg.Offset = CISREG_COR; 94 reg.Offset = CISREG_COR;
98 CS_CHECK(AccessConfigurationRegister, 95 ret = pcmcia_access_configuration_register(link, &reg);
99 pcmcia_access_configuration_register(link, &reg)); 96 if (ret)
97 goto failed;
100 save_cor = reg.Value; 98 save_cor = reg.Value;
101 99
102 /* Soft-Reset card */ 100 /* Soft-Reset card */
103 reg.Action = CS_WRITE; 101 reg.Action = CS_WRITE;
104 reg.Offset = CISREG_COR; 102 reg.Offset = CISREG_COR;
105 reg.Value = (save_cor | COR_SOFT_RESET); 103 reg.Value = (save_cor | COR_SOFT_RESET);
106 CS_CHECK(AccessConfigurationRegister, 104 ret = pcmcia_access_configuration_register(link, &reg);
107 pcmcia_access_configuration_register(link, &reg)); 105 if (ret)
106 goto failed;
108 udelay(1000); 107 udelay(1000);
109 108
110 /* Read CCSR */ 109 /* Read CCSR */
111 reg.Action = CS_READ; 110 reg.Action = CS_READ;
112 reg.Offset = CISREG_CCSR; 111 reg.Offset = CISREG_CCSR;
113 CS_CHECK(AccessConfigurationRegister, 112 ret = pcmcia_access_configuration_register(link, &reg);
114 pcmcia_access_configuration_register(link, &reg)); 113 if (ret)
114 goto failed;
115 115
116 /* 116 /*
117 * Start or stop the firmware. Memory width bit should be 117 * Start or stop the firmware. Memory width bit should be
@@ -120,21 +120,22 @@ spectrum_reset(struct pcmcia_device *link, int idle)
120 reg.Action = CS_WRITE; 120 reg.Action = CS_WRITE;
121 reg.Offset = CISREG_CCSR; 121 reg.Offset = CISREG_CCSR;
122 reg.Value = (idle ? HCR_IDLE : HCR_RUN) | (reg.Value & HCR_MEM16); 122 reg.Value = (idle ? HCR_IDLE : HCR_RUN) | (reg.Value & HCR_MEM16);
123 CS_CHECK(AccessConfigurationRegister, 123 ret = pcmcia_access_configuration_register(link, &reg);
124 pcmcia_access_configuration_register(link, &reg)); 124 if (ret)
125 goto failed;
125 udelay(1000); 126 udelay(1000);
126 127
127 /* Restore original COR configuration index */ 128 /* Restore original COR configuration index */
128 reg.Action = CS_WRITE; 129 reg.Action = CS_WRITE;
129 reg.Offset = CISREG_COR; 130 reg.Offset = CISREG_COR;
130 reg.Value = (save_cor & ~COR_SOFT_RESET); 131 reg.Value = (save_cor & ~COR_SOFT_RESET);
131 CS_CHECK(AccessConfigurationRegister, 132 ret = pcmcia_access_configuration_register(link, &reg);
132 pcmcia_access_configuration_register(link, &reg)); 133 if (ret)
134 goto failed;
133 udelay(1000); 135 udelay(1000);
134 return 0; 136 return 0;
135 137
136cs_failed: 138failed:
137 cs_error(link, last_fn, last_ret);
138 return -ENODEV; 139 return -ENODEV;
139} 140}
140 141
@@ -307,7 +308,7 @@ spectrum_cs_config(struct pcmcia_device *link)
307 struct orinoco_private *priv = link->priv; 308 struct orinoco_private *priv = link->priv;
308 struct orinoco_pccard *card = priv->card; 309 struct orinoco_pccard *card = priv->card;
309 hermes_t *hw = &priv->hw; 310 hermes_t *hw = &priv->hw;
310 int last_fn, last_ret; 311 int ret;
311 void __iomem *mem; 312 void __iomem *mem;
312 313
313 /* 314 /*
@@ -324,13 +325,12 @@ spectrum_cs_config(struct pcmcia_device *link)
324 * and most client drivers will only use the CIS to fill in 325 * and most client drivers will only use the CIS to fill in
325 * implementation-defined details. 326 * implementation-defined details.
326 */ 327 */
327 last_ret = pcmcia_loop_config(link, spectrum_cs_config_check, NULL); 328 ret = pcmcia_loop_config(link, spectrum_cs_config_check, NULL);
328 if (last_ret) { 329 if (ret) {
329 if (!ignore_cis_vcc) 330 if (!ignore_cis_vcc)
330 printk(KERN_ERR PFX "GetNextTuple(): No matching " 331 printk(KERN_ERR PFX "GetNextTuple(): No matching "
331 "CIS configuration. Maybe you need the " 332 "CIS configuration. Maybe you need the "
332 "ignore_cis_vcc=1 parameter.\n"); 333 "ignore_cis_vcc=1 parameter.\n");
333 cs_error(link, RequestIO, last_ret);
334 goto failed; 334 goto failed;
335 } 335 }
336 336
@@ -339,14 +339,16 @@ spectrum_cs_config(struct pcmcia_device *link)
339 * a handler to the interrupt, unless the 'Handler' member of 339 * a handler to the interrupt, unless the 'Handler' member of
340 * the irq structure is initialized. 340 * the irq structure is initialized.
341 */ 341 */
342 CS_CHECK(RequestIRQ, pcmcia_request_irq(link, &link->irq)); 342 ret = pcmcia_request_irq(link, &link->irq);
343 if (ret)
344 goto failed;
343 345
344 /* We initialize the hermes structure before completing PCMCIA 346 /* We initialize the hermes structure before completing PCMCIA
345 * configuration just in case the interrupt handler gets 347 * configuration just in case the interrupt handler gets
346 * called. */ 348 * called. */
347 mem = ioport_map(link->io.BasePort1, link->io.NumPorts1); 349 mem = ioport_map(link->io.BasePort1, link->io.NumPorts1);
348 if (!mem) 350 if (!mem)
349 goto cs_failed; 351 goto failed;
350 352
351 hermes_struct_init(hw, mem, HERMES_16BIT_REGSPACING); 353 hermes_struct_init(hw, mem, HERMES_16BIT_REGSPACING);
352 354
@@ -355,8 +357,9 @@ spectrum_cs_config(struct pcmcia_device *link)
355 * the I/O windows and the interrupt mapping, and putting the 357 * the I/O windows and the interrupt mapping, and putting the
356 * card and host interface into "Memory and IO" mode. 358 * card and host interface into "Memory and IO" mode.
357 */ 359 */
358 CS_CHECK(RequestConfiguration, 360 ret = pcmcia_request_configuration(link, &link->conf);
359 pcmcia_request_configuration(link, &link->conf)); 361 if (ret)
362 goto failed;
360 363
361 /* Ok, we have the configuration, prepare to register the netdev */ 364 /* Ok, we have the configuration, prepare to register the netdev */
362 card->node.major = card->node.minor = 0; 365 card->node.major = card->node.minor = 0;
@@ -386,9 +389,6 @@ spectrum_cs_config(struct pcmcia_device *link)
386 * net_device has been registered */ 389 * net_device has been registered */
387 return 0; 390 return 0;
388 391
389 cs_failed:
390 cs_error(link, last_fn, last_ret);
391
392 failed: 392 failed:
393 spectrum_cs_release(link); 393 spectrum_cs_release(link);
394 return -ENODEV; 394 return -ENODEV;