diff options
Diffstat (limited to 'drivers/net/wireless/orinoco/spectrum_cs.c')
-rw-r--r-- | drivers/net/wireless/orinoco/spectrum_cs.c | 54 |
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 c361310b885..700010e9e34 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; |