diff options
author | Dominik Brodowski <linux@dominikbrodowski.net> | 2009-10-24 09:53:36 -0400 |
---|---|---|
committer | Dominik Brodowski <linux@dominikbrodowski.net> | 2009-11-09 02:30:02 -0500 |
commit | 2caff14713d53abba273e6095495788e2720f756 (patch) | |
tree | d22eeea544d7a746a8c107322602d0da77450dff /drivers/net/wireless/orinoco | |
parent | 624dd66957e53e15cf40e937b50597c4d41f0e99 (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')
-rw-r--r-- | drivers/net/wireless/orinoco/orinoco_cs.c | 27 | ||||
-rw-r--r-- | drivers/net/wireless/orinoco/spectrum_cs.c | 54 |
2 files changed, 37 insertions, 44 deletions
diff --git a/drivers/net/wireless/orinoco/orinoco_cs.c b/drivers/net/wireless/orinoco/orinoco_cs.c index 38c1c9d2abb8..da626ec663d0 100644 --- a/drivers/net/wireless/orinoco/orinoco_cs.c +++ b/drivers/net/wireless/orinoco/orinoco_cs.c | |||
@@ -160,12 +160,6 @@ static void orinoco_cs_detach(struct pcmcia_device *link) | |||
160 | * device available to the system. | 160 | * device available to the system. |
161 | */ | 161 | */ |
162 | 162 | ||
163 | #define CS_CHECK(fn, ret) do { \ | ||
164 | last_fn = (fn); \ | ||
165 | if ((last_ret = (ret)) != 0) \ | ||
166 | goto cs_failed; \ | ||
167 | } while (0) | ||
168 | |||
169 | static int orinoco_cs_config_check(struct pcmcia_device *p_dev, | 163 | static int orinoco_cs_config_check(struct pcmcia_device *p_dev, |
170 | cistpl_cftable_entry_t *cfg, | 164 | cistpl_cftable_entry_t *cfg, |
171 | cistpl_cftable_entry_t *dflt, | 165 | cistpl_cftable_entry_t *dflt, |
@@ -240,7 +234,7 @@ orinoco_cs_config(struct pcmcia_device *link) | |||
240 | struct orinoco_private *priv = link->priv; | 234 | struct orinoco_private *priv = link->priv; |
241 | struct orinoco_pccard *card = priv->card; | 235 | struct orinoco_pccard *card = priv->card; |
242 | hermes_t *hw = &priv->hw; | 236 | hermes_t *hw = &priv->hw; |
243 | int last_fn, last_ret; | 237 | int ret; |
244 | void __iomem *mem; | 238 | void __iomem *mem; |
245 | 239 | ||
246 | /* | 240 | /* |
@@ -257,13 +251,12 @@ orinoco_cs_config(struct pcmcia_device *link) | |||
257 | * and most client drivers will only use the CIS to fill in | 251 | * and most client drivers will only use the CIS to fill in |
258 | * implementation-defined details. | 252 | * implementation-defined details. |
259 | */ | 253 | */ |
260 | last_ret = pcmcia_loop_config(link, orinoco_cs_config_check, NULL); | 254 | ret = pcmcia_loop_config(link, orinoco_cs_config_check, NULL); |
261 | if (last_ret) { | 255 | if (ret) { |
262 | if (!ignore_cis_vcc) | 256 | if (!ignore_cis_vcc) |
263 | printk(KERN_ERR PFX "GetNextTuple(): No matching " | 257 | printk(KERN_ERR PFX "GetNextTuple(): No matching " |
264 | "CIS configuration. Maybe you need the " | 258 | "CIS configuration. Maybe you need the " |
265 | "ignore_cis_vcc=1 parameter.\n"); | 259 | "ignore_cis_vcc=1 parameter.\n"); |
266 | cs_error(link, RequestIO, last_ret); | ||
267 | goto failed; | 260 | goto failed; |
268 | } | 261 | } |
269 | 262 | ||
@@ -272,14 +265,16 @@ orinoco_cs_config(struct pcmcia_device *link) | |||
272 | * a handler to the interrupt, unless the 'Handler' member of | 265 | * a handler to the interrupt, unless the 'Handler' member of |
273 | * the irq structure is initialized. | 266 | * the irq structure is initialized. |
274 | */ | 267 | */ |
275 | CS_CHECK(RequestIRQ, pcmcia_request_irq(link, &link->irq)); | 268 | ret = pcmcia_request_irq(link, &link->irq); |
269 | if (ret) | ||
270 | goto failed; | ||
276 | 271 | ||
277 | /* We initialize the hermes structure before completing PCMCIA | 272 | /* We initialize the hermes structure before completing PCMCIA |
278 | * configuration just in case the interrupt handler gets | 273 | * configuration just in case the interrupt handler gets |
279 | * called. */ | 274 | * called. */ |
280 | mem = ioport_map(link->io.BasePort1, link->io.NumPorts1); | 275 | mem = ioport_map(link->io.BasePort1, link->io.NumPorts1); |
281 | if (!mem) | 276 | if (!mem) |
282 | goto cs_failed; | 277 | goto failed; |
283 | 278 | ||
284 | hermes_struct_init(hw, mem, HERMES_16BIT_REGSPACING); | 279 | hermes_struct_init(hw, mem, HERMES_16BIT_REGSPACING); |
285 | 280 | ||
@@ -288,8 +283,9 @@ orinoco_cs_config(struct pcmcia_device *link) | |||
288 | * the I/O windows and the interrupt mapping, and putting the | 283 | * the I/O windows and the interrupt mapping, and putting the |
289 | * card and host interface into "Memory and IO" mode. | 284 | * card and host interface into "Memory and IO" mode. |
290 | */ | 285 | */ |
291 | CS_CHECK(RequestConfiguration, | 286 | ret = pcmcia_request_configuration(link, &link->conf); |
292 | pcmcia_request_configuration(link, &link->conf)); | 287 | if (ret) |
288 | goto failed; | ||
293 | 289 | ||
294 | /* Ok, we have the configuration, prepare to register the netdev */ | 290 | /* Ok, we have the configuration, prepare to register the netdev */ |
295 | card->node.major = card->node.minor = 0; | 291 | card->node.major = card->node.minor = 0; |
@@ -315,9 +311,6 @@ orinoco_cs_config(struct pcmcia_device *link) | |||
315 | * net_device has been registered */ | 311 | * net_device has been registered */ |
316 | return 0; | 312 | return 0; |
317 | 313 | ||
318 | cs_failed: | ||
319 | cs_error(link, last_fn, last_ret); | ||
320 | |||
321 | failed: | 314 | failed: |
322 | orinoco_cs_release(link); | 315 | orinoco_cs_release(link); |
323 | return -ENODEV; | 316 | return -ENODEV; |
diff --git a/drivers/net/wireless/orinoco/spectrum_cs.c b/drivers/net/wireless/orinoco/spectrum_cs.c index c361310b885d..700010e9e346 100644 --- a/drivers/net/wireless/orinoco/spectrum_cs.c +++ b/drivers/net/wireless/orinoco/spectrum_cs.c | |||
@@ -73,9 +73,6 @@ static void spectrum_cs_release(struct pcmcia_device *link); | |||
73 | #define HCR_MEM16 0x10 /* memory width bit, should be preserved */ | 73 | #define HCR_MEM16 0x10 /* memory width bit, should be preserved */ |
74 | 74 | ||
75 | 75 | ||
76 | #define CS_CHECK(fn, ret) \ | ||
77 | do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0) | ||
78 | |||
79 | /* | 76 | /* |
80 | * Reset the card using configuration registers COR and CCSR. | 77 | * Reset the card using configuration registers COR and CCSR. |
81 | * If IDLE is 1, stop the firmware, so that it can be safely rewritten. | 78 | * If IDLE is 1, stop the firmware, so that it can be safely rewritten. |
@@ -83,7 +80,7 @@ static void spectrum_cs_release(struct pcmcia_device *link); | |||
83 | static int | 80 | static int |
84 | spectrum_reset(struct pcmcia_device *link, int idle) | 81 | spectrum_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, ®); |
99 | pcmcia_access_configuration_register(link, ®)); | 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, ®); |
107 | pcmcia_access_configuration_register(link, ®)); | 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, ®); |
114 | pcmcia_access_configuration_register(link, ®)); | 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, ®); |
124 | pcmcia_access_configuration_register(link, ®)); | 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, ®); |
132 | pcmcia_access_configuration_register(link, ®)); | 133 | if (ret) |
134 | goto failed; | ||
133 | udelay(1000); | 135 | udelay(1000); |
134 | return 0; | 136 | return 0; |
135 | 137 | ||
136 | cs_failed: | 138 | failed: |
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; |