aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/net/wireless/orinoco/airport.c35
-rw-r--r--drivers/net/wireless/orinoco/hermes.c102
-rw-r--r--drivers/net/wireless/orinoco/hermes.h35
-rw-r--r--drivers/net/wireless/orinoco/orinoco.h17
-rw-r--r--drivers/net/wireless/orinoco/orinoco_cs.c31
-rw-r--r--drivers/net/wireless/orinoco/orinoco_nortel.c7
-rw-r--r--drivers/net/wireless/orinoco/orinoco_pci.c5
-rw-r--r--drivers/net/wireless/orinoco/orinoco_pci.h10
-rw-r--r--drivers/net/wireless/orinoco/orinoco_plx.c3
-rw-r--r--drivers/net/wireless/orinoco/orinoco_tmd.c2
-rw-r--r--drivers/net/wireless/orinoco/spectrum_cs.c15
11 files changed, 143 insertions, 119 deletions
diff --git a/drivers/net/wireless/orinoco/airport.c b/drivers/net/wireless/orinoco/airport.c
index 28f1cae48439..5582dca9f7f5 100644
--- a/drivers/net/wireless/orinoco/airport.c
+++ b/drivers/net/wireless/orinoco/airport.c
@@ -4,9 +4,9 @@
4 * card. 4 * card.
5 * 5 *
6 * Copyright notice & release notes in file orinoco.c 6 * Copyright notice & release notes in file orinoco.c
7 * 7 *
8 * Note specific to airport stub: 8 * Note specific to airport stub:
9 * 9 *
10 * 0.05 : first version of the new split driver 10 * 0.05 : first version of the new split driver
11 * 0.06 : fix possible hang on powerup, add sleep support 11 * 0.06 : fix possible hang on powerup, add sleep support
12 */ 12 */
@@ -60,7 +60,8 @@ airport_suspend(struct macio_dev *mdev, pm_message_t state)
60 orinoco_unlock(priv, &flags); 60 orinoco_unlock(priv, &flags);
61 61
62 disable_irq(dev->irq); 62 disable_irq(dev->irq);
63 pmac_call_feature(PMAC_FTR_AIRPORT_ENABLE, macio_get_of_node(mdev), 0, 0); 63 pmac_call_feature(PMAC_FTR_AIRPORT_ENABLE,
64 macio_get_of_node(mdev), 0, 0);
64 65
65 return 0; 66 return 0;
66} 67}
@@ -75,7 +76,8 @@ airport_resume(struct macio_dev *mdev)
75 76
76 printk(KERN_DEBUG "%s: Airport waking up\n", dev->name); 77 printk(KERN_DEBUG "%s: Airport waking up\n", dev->name);
77 78
78 pmac_call_feature(PMAC_FTR_AIRPORT_ENABLE, macio_get_of_node(mdev), 0, 1); 79 pmac_call_feature(PMAC_FTR_AIRPORT_ENABLE,
80 macio_get_of_node(mdev), 0, 1);
79 msleep(200); 81 msleep(200);
80 82
81 enable_irq(dev->irq); 83 enable_irq(dev->irq);
@@ -93,7 +95,7 @@ airport_resume(struct macio_dev *mdev)
93 95
94 priv->hw_unavailable--; 96 priv->hw_unavailable--;
95 97
96 if (priv->open && (! priv->hw_unavailable)) { 98 if (priv->open && (!priv->hw_unavailable)) {
97 err = __orinoco_up(dev); 99 err = __orinoco_up(dev);
98 if (err) 100 if (err)
99 printk(KERN_ERR "%s: Error %d restarting card on PBOOK_WAKE\n", 101 printk(KERN_ERR "%s: Error %d restarting card on PBOOK_WAKE\n",
@@ -127,7 +129,8 @@ airport_detach(struct macio_dev *mdev)
127 129
128 macio_release_resource(mdev, 0); 130 macio_release_resource(mdev, 0);
129 131
130 pmac_call_feature(PMAC_FTR_AIRPORT_ENABLE, macio_get_of_node(mdev), 0, 0); 132 pmac_call_feature(PMAC_FTR_AIRPORT_ENABLE,
133 macio_get_of_node(mdev), 0, 0);
131 ssleep(1); 134 ssleep(1);
132 135
133 macio_set_drvdata(mdev, NULL); 136 macio_set_drvdata(mdev, NULL);
@@ -153,9 +156,11 @@ static int airport_hard_reset(struct orinoco_private *priv)
153 * off. */ 156 * off. */
154 disable_irq(dev->irq); 157 disable_irq(dev->irq);
155 158
156 pmac_call_feature(PMAC_FTR_AIRPORT_ENABLE, macio_get_of_node(card->mdev), 0, 0); 159 pmac_call_feature(PMAC_FTR_AIRPORT_ENABLE,
160 macio_get_of_node(card->mdev), 0, 0);
157 ssleep(1); 161 ssleep(1);
158 pmac_call_feature(PMAC_FTR_AIRPORT_ENABLE, macio_get_of_node(card->mdev), 0, 1); 162 pmac_call_feature(PMAC_FTR_AIRPORT_ENABLE,
163 macio_get_of_node(card->mdev), 0, 1);
159 ssleep(1); 164 ssleep(1);
160 165
161 enable_irq(dev->irq); 166 enable_irq(dev->irq);
@@ -182,7 +187,7 @@ airport_attach(struct macio_dev *mdev, const struct of_device_id *match)
182 /* Allocate space for private device-specific data */ 187 /* Allocate space for private device-specific data */
183 dev = alloc_orinocodev(sizeof(*card), &mdev->ofdev.dev, 188 dev = alloc_orinocodev(sizeof(*card), &mdev->ofdev.dev,
184 airport_hard_reset, NULL); 189 airport_hard_reset, NULL);
185 if (! dev) { 190 if (!dev) {
186 printk(KERN_ERR PFX "Cannot allocate network device\n"); 191 printk(KERN_ERR PFX "Cannot allocate network device\n");
187 return -ENODEV; 192 return -ENODEV;
188 } 193 }
@@ -214,9 +219,10 @@ airport_attach(struct macio_dev *mdev, const struct of_device_id *match)
214 } 219 }
215 220
216 hermes_struct_init(hw, card->vaddr, HERMES_16BIT_REGSPACING); 221 hermes_struct_init(hw, card->vaddr, HERMES_16BIT_REGSPACING);
217 222
218 /* Power up card */ 223 /* Power up card */
219 pmac_call_feature(PMAC_FTR_AIRPORT_ENABLE, macio_get_of_node(mdev), 0, 1); 224 pmac_call_feature(PMAC_FTR_AIRPORT_ENABLE,
225 macio_get_of_node(mdev), 0, 1);
220 ssleep(1); 226 ssleep(1);
221 227
222 /* Reset it before we get the interrupt */ 228 /* Reset it before we get the interrupt */
@@ -248,7 +254,7 @@ MODULE_AUTHOR("Benjamin Herrenschmidt <benh@kernel.crashing.org>");
248MODULE_DESCRIPTION("Driver for the Apple Airport wireless card."); 254MODULE_DESCRIPTION("Driver for the Apple Airport wireless card.");
249MODULE_LICENSE("Dual MPL/GPL"); 255MODULE_LICENSE("Dual MPL/GPL");
250 256
251static struct of_device_id airport_match[] = 257static struct of_device_id airport_match[] =
252{ 258{
253 { 259 {
254 .name = "radio", 260 .name = "radio",
@@ -256,10 +262,9 @@ static struct of_device_id airport_match[] =
256 {}, 262 {},
257}; 263};
258 264
259MODULE_DEVICE_TABLE (of, airport_match); 265MODULE_DEVICE_TABLE(of, airport_match);
260 266
261static struct macio_driver airport_driver = 267static struct macio_driver airport_driver = {
262{
263 .name = DRIVER_NAME, 268 .name = DRIVER_NAME,
264 .match_table = airport_match, 269 .match_table = airport_match,
265 .probe = airport_attach, 270 .probe = airport_attach,
diff --git a/drivers/net/wireless/orinoco/hermes.c b/drivers/net/wireless/orinoco/hermes.c
index bfa375369df3..f48358fed9f7 100644
--- a/drivers/net/wireless/orinoco/hermes.c
+++ b/drivers/net/wireless/orinoco/hermes.c
@@ -15,7 +15,7 @@
15 * 15 *
16 * Copyright (C) 2000, David Gibson, Linuxcare Australia. 16 * Copyright (C) 2000, David Gibson, Linuxcare Australia.
17 * (C) Copyright David Gibson, IBM Corp. 2001-2003. 17 * (C) Copyright David Gibson, IBM Corp. 2001-2003.
18 * 18 *
19 * The contents of this file are subject to the Mozilla Public License 19 * The contents of this file are subject to the Mozilla Public License
20 * Version 1.1 (the "License"); you may not use this file except in 20 * Version 1.1 (the "License"); you may not use this file except in
21 * compliance with the License. You may obtain a copy of the License 21 * compliance with the License. You may obtain a copy of the License
@@ -45,7 +45,8 @@
45 45
46#include "hermes.h" 46#include "hermes.h"
47 47
48MODULE_DESCRIPTION("Low-level driver helper for Lucent Hermes chipset and Prism II HFA384x wireless MAC controller"); 48MODULE_DESCRIPTION("Low-level driver helper for Lucent Hermes chipset"
49 " and Prism II HFA384x wireless MAC controller");
49MODULE_AUTHOR("Pavel Roskin <proski@gnu.org>" 50MODULE_AUTHOR("Pavel Roskin <proski@gnu.org>"
50 " & David Gibson <hermes@gibson.dropbear.id.au>"); 51 " & David Gibson <hermes@gibson.dropbear.id.au>");
51MODULE_LICENSE("Dual MPL/GPL"); 52MODULE_LICENSE("Dual MPL/GPL");
@@ -61,13 +62,13 @@ MODULE_LICENSE("Dual MPL/GPL");
61 */ 62 */
62 63
63#define DMSG(stuff...) do {printk(KERN_DEBUG "hermes @ %p: " , hw->iobase); \ 64#define DMSG(stuff...) do {printk(KERN_DEBUG "hermes @ %p: " , hw->iobase); \
64 printk(stuff);} while (0) 65 printk(stuff); } while (0)
65 66
66#undef HERMES_DEBUG 67#undef HERMES_DEBUG
67#ifdef HERMES_DEBUG 68#ifdef HERMES_DEBUG
68#include <stdarg.h> 69#include <stdarg.h>
69 70
70#define DEBUG(lvl, stuff...) if ( (lvl) <= HERMES_DEBUG) DMSG(stuff) 71#define DEBUG(lvl, stuff...) if ((lvl) <= HERMES_DEBUG) DMSG(stuff)
71 72
72#else /* ! HERMES_DEBUG */ 73#else /* ! HERMES_DEBUG */
73 74
@@ -95,20 +96,19 @@ static int hermes_issue_cmd(hermes_t *hw, u16 cmd, u16 param0,
95 96
96 /* First wait for the command register to unbusy */ 97 /* First wait for the command register to unbusy */
97 reg = hermes_read_regn(hw, CMD); 98 reg = hermes_read_regn(hw, CMD);
98 while ( (reg & HERMES_CMD_BUSY) && k ) { 99 while ((reg & HERMES_CMD_BUSY) && k) {
99 k--; 100 k--;
100 udelay(1); 101 udelay(1);
101 reg = hermes_read_regn(hw, CMD); 102 reg = hermes_read_regn(hw, CMD);
102 } 103 }
103 if (reg & HERMES_CMD_BUSY) { 104 if (reg & HERMES_CMD_BUSY)
104 return -EBUSY; 105 return -EBUSY;
105 }
106 106
107 hermes_write_regn(hw, PARAM2, param2); 107 hermes_write_regn(hw, PARAM2, param2);
108 hermes_write_regn(hw, PARAM1, param1); 108 hermes_write_regn(hw, PARAM1, param1);
109 hermes_write_regn(hw, PARAM0, param0); 109 hermes_write_regn(hw, PARAM0, param0);
110 hermes_write_regn(hw, CMD, cmd); 110 hermes_write_regn(hw, CMD, cmd);
111 111
112 return 0; 112 return 0;
113} 113}
114 114
@@ -191,23 +191,23 @@ int hermes_init(hermes_t *hw)
191 hermes_write_regn(hw, EVACK, 0xffff); 191 hermes_write_regn(hw, EVACK, 0xffff);
192 192
193 /* Normally it's a "can't happen" for the command register to 193 /* Normally it's a "can't happen" for the command register to
194 be busy when we go to issue a command because we are 194 be busy when we go to issue a command because we are
195 serializing all commands. However we want to have some 195 serializing all commands. However we want to have some
196 chance of resetting the card even if it gets into a stupid 196 chance of resetting the card even if it gets into a stupid
197 state, so we actually wait to see if the command register 197 state, so we actually wait to see if the command register
198 will unbusy itself here. */ 198 will unbusy itself here. */
199 k = CMD_BUSY_TIMEOUT; 199 k = CMD_BUSY_TIMEOUT;
200 reg = hermes_read_regn(hw, CMD); 200 reg = hermes_read_regn(hw, CMD);
201 while (k && (reg & HERMES_CMD_BUSY)) { 201 while (k && (reg & HERMES_CMD_BUSY)) {
202 if (reg == 0xffff) /* Special case - the card has probably been removed, 202 if (reg == 0xffff) /* Special case - the card has probably been
203 so don't wait for the timeout */ 203 removed, so don't wait for the timeout */
204 return -ENODEV; 204 return -ENODEV;
205 205
206 k--; 206 k--;
207 udelay(1); 207 udelay(1);
208 reg = hermes_read_regn(hw, CMD); 208 reg = hermes_read_regn(hw, CMD);
209 } 209 }
210 210
211 /* No need to explicitly handle the timeout - if we've timed 211 /* No need to explicitly handle the timeout - if we've timed
212 out hermes_issue_cmd() will probably return -EBUSY below */ 212 out hermes_issue_cmd() will probably return -EBUSY below */
213 213
@@ -228,7 +228,10 @@ EXPORT_SYMBOL(hermes_init);
228/* Issue a command to the chip, and (busy!) wait for it to 228/* Issue a command to the chip, and (busy!) wait for it to
229 * complete. 229 * complete.
230 * 230 *
231 * Returns: < 0 on internal error, 0 on success, > 0 on error returned by the firmware 231 * Returns:
232 * < 0 on internal error
233 * 0 on success
234 * > 0 on error returned by the firmware
232 * 235 *
233 * Callable from any context, but locking is your problem. */ 236 * Callable from any context, but locking is your problem. */
234int hermes_docmd_wait(hermes_t *hw, u16 cmd, u16 parm0, 237int hermes_docmd_wait(hermes_t *hw, u16 cmd, u16 parm0,
@@ -241,13 +244,13 @@ int hermes_docmd_wait(hermes_t *hw, u16 cmd, u16 parm0,
241 244
242 err = hermes_issue_cmd(hw, cmd, parm0, 0, 0); 245 err = hermes_issue_cmd(hw, cmd, parm0, 0, 0);
243 if (err) { 246 if (err) {
244 if (! hermes_present(hw)) { 247 if (!hermes_present(hw)) {
245 if (net_ratelimit()) 248 if (net_ratelimit())
246 printk(KERN_WARNING "hermes @ %p: " 249 printk(KERN_WARNING "hermes @ %p: "
247 "Card removed while issuing command " 250 "Card removed while issuing command "
248 "0x%04x.\n", hw->iobase, cmd); 251 "0x%04x.\n", hw->iobase, cmd);
249 err = -ENODEV; 252 err = -ENODEV;
250 } else 253 } else
251 if (net_ratelimit()) 254 if (net_ratelimit())
252 printk(KERN_ERR "hermes @ %p: " 255 printk(KERN_ERR "hermes @ %p: "
253 "Error %d issuing command 0x%04x.\n", 256 "Error %d issuing command 0x%04x.\n",
@@ -257,21 +260,21 @@ int hermes_docmd_wait(hermes_t *hw, u16 cmd, u16 parm0,
257 260
258 reg = hermes_read_regn(hw, EVSTAT); 261 reg = hermes_read_regn(hw, EVSTAT);
259 k = CMD_COMPL_TIMEOUT; 262 k = CMD_COMPL_TIMEOUT;
260 while ( (! (reg & HERMES_EV_CMD)) && k) { 263 while ((!(reg & HERMES_EV_CMD)) && k) {
261 k--; 264 k--;
262 udelay(10); 265 udelay(10);
263 reg = hermes_read_regn(hw, EVSTAT); 266 reg = hermes_read_regn(hw, EVSTAT);
264 } 267 }
265 268
266 if (! hermes_present(hw)) { 269 if (!hermes_present(hw)) {
267 printk(KERN_WARNING "hermes @ %p: Card removed " 270 printk(KERN_WARNING "hermes @ %p: Card removed "
268 "while waiting for command 0x%04x completion.\n", 271 "while waiting for command 0x%04x completion.\n",
269 hw->iobase, cmd); 272 hw->iobase, cmd);
270 err = -ENODEV; 273 err = -ENODEV;
271 goto out; 274 goto out;
272 } 275 }
273 276
274 if (! (reg & HERMES_EV_CMD)) { 277 if (!(reg & HERMES_EV_CMD)) {
275 printk(KERN_ERR "hermes @ %p: Timeout waiting for " 278 printk(KERN_ERR "hermes @ %p: Timeout waiting for "
276 "command 0x%04x completion.\n", hw->iobase, cmd); 279 "command 0x%04x completion.\n", hw->iobase, cmd);
277 err = -ETIMEDOUT; 280 err = -ETIMEDOUT;
@@ -301,31 +304,30 @@ int hermes_allocate(hermes_t *hw, u16 size, u16 *fid)
301 int err = 0; 304 int err = 0;
302 int k; 305 int k;
303 u16 reg; 306 u16 reg;
304 307
305 if ( (size < HERMES_ALLOC_LEN_MIN) || (size > HERMES_ALLOC_LEN_MAX) ) 308 if ((size < HERMES_ALLOC_LEN_MIN) || (size > HERMES_ALLOC_LEN_MAX))
306 return -EINVAL; 309 return -EINVAL;
307 310
308 err = hermes_docmd_wait(hw, HERMES_CMD_ALLOC, size, NULL); 311 err = hermes_docmd_wait(hw, HERMES_CMD_ALLOC, size, NULL);
309 if (err) { 312 if (err)
310 return err; 313 return err;
311 }
312 314
313 reg = hermes_read_regn(hw, EVSTAT); 315 reg = hermes_read_regn(hw, EVSTAT);
314 k = ALLOC_COMPL_TIMEOUT; 316 k = ALLOC_COMPL_TIMEOUT;
315 while ( (! (reg & HERMES_EV_ALLOC)) && k) { 317 while ((!(reg & HERMES_EV_ALLOC)) && k) {
316 k--; 318 k--;
317 udelay(10); 319 udelay(10);
318 reg = hermes_read_regn(hw, EVSTAT); 320 reg = hermes_read_regn(hw, EVSTAT);
319 } 321 }
320 322
321 if (! hermes_present(hw)) { 323 if (!hermes_present(hw)) {
322 printk(KERN_WARNING "hermes @ %p: " 324 printk(KERN_WARNING "hermes @ %p: "
323 "Card removed waiting for frame allocation.\n", 325 "Card removed waiting for frame allocation.\n",
324 hw->iobase); 326 hw->iobase);
325 return -ENODEV; 327 return -ENODEV;
326 } 328 }
327 329
328 if (! (reg & HERMES_EV_ALLOC)) { 330 if (!(reg & HERMES_EV_ALLOC)) {
329 printk(KERN_ERR "hermes @ %p: " 331 printk(KERN_ERR "hermes @ %p: "
330 "Timeout waiting for frame allocation\n", 332 "Timeout waiting for frame allocation\n",
331 hw->iobase); 333 hw->iobase);
@@ -334,14 +336,17 @@ int hermes_allocate(hermes_t *hw, u16 size, u16 *fid)
334 336
335 *fid = hermes_read_regn(hw, ALLOCFID); 337 *fid = hermes_read_regn(hw, ALLOCFID);
336 hermes_write_regn(hw, EVACK, HERMES_EV_ALLOC); 338 hermes_write_regn(hw, EVACK, HERMES_EV_ALLOC);
337 339
338 return 0; 340 return 0;
339} 341}
340EXPORT_SYMBOL(hermes_allocate); 342EXPORT_SYMBOL(hermes_allocate);
341 343
342/* Set up a BAP to read a particular chunk of data from card's internal buffer. 344/* Set up a BAP to read a particular chunk of data from card's internal buffer.
343 * 345 *
344 * Returns: < 0 on internal failure (errno), 0 on success, >0 on error 346 * Returns:
347 * < 0 on internal failure (errno)
348 * 0 on success
349 * > 0 on error
345 * from firmware 350 * from firmware
346 * 351 *
347 * Callable from any context */ 352 * Callable from any context */
@@ -353,7 +358,7 @@ static int hermes_bap_seek(hermes_t *hw, int bap, u16 id, u16 offset)
353 u16 reg; 358 u16 reg;
354 359
355 /* Paranoia.. */ 360 /* Paranoia.. */
356 if ( (offset > HERMES_BAP_OFFSET_MAX) || (offset % 2) ) 361 if ((offset > HERMES_BAP_OFFSET_MAX) || (offset % 2))
357 return -EINVAL; 362 return -EINVAL;
358 363
359 k = HERMES_BAP_BUSY_TIMEOUT; 364 k = HERMES_BAP_BUSY_TIMEOUT;
@@ -374,7 +379,7 @@ static int hermes_bap_seek(hermes_t *hw, int bap, u16 id, u16 offset)
374 /* Wait for the BAP to be ready */ 379 /* Wait for the BAP to be ready */
375 k = HERMES_BAP_BUSY_TIMEOUT; 380 k = HERMES_BAP_BUSY_TIMEOUT;
376 reg = hermes_read_reg(hw, oreg); 381 reg = hermes_read_reg(hw, oreg);
377 while ( (reg & (HERMES_OFFSET_BUSY | HERMES_OFFSET_ERR)) && k) { 382 while ((reg & (HERMES_OFFSET_BUSY | HERMES_OFFSET_ERR)) && k) {
378 k--; 383 k--;
379 udelay(1); 384 udelay(1);
380 reg = hermes_read_reg(hw, oreg); 385 reg = hermes_read_reg(hw, oreg);
@@ -386,9 +391,8 @@ static int hermes_bap_seek(hermes_t *hw, int bap, u16 id, u16 offset)
386 (reg & HERMES_OFFSET_BUSY) ? "timeout" : "error", 391 (reg & HERMES_OFFSET_BUSY) ? "timeout" : "error",
387 reg, id, offset); 392 reg, id, offset);
388 393
389 if (reg & HERMES_OFFSET_BUSY) { 394 if (reg & HERMES_OFFSET_BUSY)
390 return -ETIMEDOUT; 395 return -ETIMEDOUT;
391 }
392 396
393 return -EIO; /* error or wrong offset */ 397 return -EIO; /* error or wrong offset */
394 } 398 }
@@ -400,7 +404,10 @@ static int hermes_bap_seek(hermes_t *hw, int bap, u16 id, u16 offset)
400 * BAP. Synchronization/serialization is the caller's problem. len 404 * BAP. Synchronization/serialization is the caller's problem. len
401 * must be even. 405 * must be even.
402 * 406 *
403 * Returns: < 0 on internal failure (errno), 0 on success, > 0 on error from firmware 407 * Returns:
408 * < 0 on internal failure (errno)
409 * 0 on success
410 * > 0 on error from firmware
404 */ 411 */
405int hermes_bap_pread(hermes_t *hw, int bap, void *buf, int len, 412int hermes_bap_pread(hermes_t *hw, int bap, void *buf, int len,
406 u16 id, u16 offset) 413 u16 id, u16 offset)
@@ -408,7 +415,7 @@ int hermes_bap_pread(hermes_t *hw, int bap, void *buf, int len,
408 int dreg = bap ? HERMES_DATA1 : HERMES_DATA0; 415 int dreg = bap ? HERMES_DATA1 : HERMES_DATA0;
409 int err = 0; 416 int err = 0;
410 417
411 if ( (len < 0) || (len % 2) ) 418 if ((len < 0) || (len % 2))
412 return -EINVAL; 419 return -EINVAL;
413 420
414 err = hermes_bap_seek(hw, bap, id, offset); 421 err = hermes_bap_seek(hw, bap, id, offset);
@@ -426,7 +433,10 @@ EXPORT_SYMBOL(hermes_bap_pread);
426/* Write a block of data to the chip's buffer, via the 433/* Write a block of data to the chip's buffer, via the
427 * BAP. Synchronization/serialization is the caller's problem. 434 * BAP. Synchronization/serialization is the caller's problem.
428 * 435 *
429 * Returns: < 0 on internal failure (errno), 0 on success, > 0 on error from firmware 436 * Returns:
437 * < 0 on internal failure (errno)
438 * 0 on success
439 * > 0 on error from firmware
430 */ 440 */
431int hermes_bap_pwrite(hermes_t *hw, int bap, const void *buf, int len, 441int hermes_bap_pwrite(hermes_t *hw, int bap, const void *buf, int len,
432 u16 id, u16 offset) 442 u16 id, u16 offset)
@@ -440,11 +450,11 @@ int hermes_bap_pwrite(hermes_t *hw, int bap, const void *buf, int len,
440 err = hermes_bap_seek(hw, bap, id, offset); 450 err = hermes_bap_seek(hw, bap, id, offset);
441 if (err) 451 if (err)
442 goto out; 452 goto out;
443 453
444 /* Actually do the transfer */ 454 /* Actually do the transfer */
445 hermes_write_bytes(hw, dreg, buf, len); 455 hermes_write_bytes(hw, dreg, buf, len);
446 456
447 out: 457 out:
448 return err; 458 return err;
449} 459}
450EXPORT_SYMBOL(hermes_bap_pwrite); 460EXPORT_SYMBOL(hermes_bap_pwrite);
@@ -465,7 +475,7 @@ int hermes_read_ltv(hermes_t *hw, int bap, u16 rid, unsigned bufsize,
465 u16 rlength, rtype; 475 u16 rlength, rtype;
466 unsigned nwords; 476 unsigned nwords;
467 477
468 if ( (bufsize < 0) || (bufsize % 2) ) 478 if ((bufsize < 0) || (bufsize % 2))
469 return -EINVAL; 479 return -EINVAL;
470 480
471 err = hermes_docmd_wait(hw, HERMES_CMD_ACCESS, rid, NULL); 481 err = hermes_docmd_wait(hw, HERMES_CMD_ACCESS, rid, NULL);
@@ -478,7 +488,7 @@ int hermes_read_ltv(hermes_t *hw, int bap, u16 rid, unsigned bufsize,
478 488
479 rlength = hermes_read_reg(hw, dreg); 489 rlength = hermes_read_reg(hw, dreg);
480 490
481 if (! rlength) 491 if (!rlength)
482 return -ENODATA; 492 return -ENODATA;
483 493
484 rtype = hermes_read_reg(hw, dreg); 494 rtype = hermes_read_reg(hw, dreg);
@@ -503,7 +513,7 @@ int hermes_read_ltv(hermes_t *hw, int bap, u16 rid, unsigned bufsize,
503} 513}
504EXPORT_SYMBOL(hermes_read_ltv); 514EXPORT_SYMBOL(hermes_read_ltv);
505 515
506int hermes_write_ltv(hermes_t *hw, int bap, u16 rid, 516int hermes_write_ltv(hermes_t *hw, int bap, u16 rid,
507 u16 length, const void *value) 517 u16 length, const void *value)
508{ 518{
509 int dreg = bap ? HERMES_DATA1 : HERMES_DATA0; 519 int dreg = bap ? HERMES_DATA1 : HERMES_DATA0;
diff --git a/drivers/net/wireless/orinoco/hermes.h b/drivers/net/wireless/orinoco/hermes.h
index 8b13c8fef3dc..c78c442a02c8 100644
--- a/drivers/net/wireless/orinoco/hermes.h
+++ b/drivers/net/wireless/orinoco/hermes.h
@@ -15,7 +15,8 @@
15 * Copyright (C) 2000, David Gibson, Linuxcare Australia. 15 * Copyright (C) 2000, David Gibson, Linuxcare Australia.
16 * (C) Copyright David Gibson, IBM Corp. 2001-2003. 16 * (C) Copyright David Gibson, IBM Corp. 2001-2003.
17 * 17 *
18 * Portions taken from hfa384x.h, Copyright (C) 1999 AbsoluteValue Systems, Inc. All Rights Reserved. 18 * Portions taken from hfa384x.h.
19 * Copyright (C) 1999 AbsoluteValue Systems, Inc. All Rights Reserved.
19 * 20 *
20 * This file distributed under the GPL, version 2. 21 * This file distributed under the GPL, version 2.
21 */ 22 */
@@ -31,7 +32,7 @@
31*/ 32*/
32 33
33#include <linux/if_ether.h> 34#include <linux/if_ether.h>
34#include <asm/io.h> 35#include <linux/io.h>
35 36
36/* 37/*
37 * Limits and constants 38 * Limits and constants
@@ -203,7 +204,7 @@ struct hermes_tx_descriptor {
203 __le32 sw_support; 204 __le32 sw_support;
204 u8 retry_count; 205 u8 retry_count;
205 u8 tx_rate; 206 u8 tx_rate;
206 __le16 tx_control; 207 __le16 tx_control;
207} __attribute__ ((packed)); 208} __attribute__ ((packed));
208 209
209#define HERMES_TXSTAT_RETRYERR (0x0001) 210#define HERMES_TXSTAT_RETRYERR (0x0001)
@@ -298,7 +299,7 @@ struct symbol_scan_apinfo {
298 /* bits: 0-ess, 1-ibss, 4-privacy [wep] */ 299 /* bits: 0-ess, 1-ibss, 4-privacy [wep] */
299 __le16 essid_len; /* ESSID length */ 300 __le16 essid_len; /* ESSID length */
300 u8 essid[32]; /* ESSID of the network */ 301 u8 essid[32]; /* ESSID of the network */
301 __le16 rates[5]; /* Bit rate supported */ 302 __le16 rates[5]; /* Bit rate supported */
302 __le16 basic_rates; /* Basic rates bitmask */ 303 __le16 basic_rates; /* Basic rates bitmask */
303 u8 unknown2[6]; /* Always FF:FF:FF:FF:00:00 */ 304 u8 unknown2[6]; /* Always FF:FF:FF:FF:00:00 */
304 u8 unknown3[8]; /* Always 0, appeared in f/w 3.91-68 */ 305 u8 unknown3[8]; /* Always 0, appeared in f/w 3.91-68 */
@@ -344,14 +345,14 @@ struct agere_ext_scan_info {
344 u8 data[316]; 345 u8 data[316];
345} __attribute__ ((packed)); 346} __attribute__ ((packed));
346 347
347#define HERMES_LINKSTATUS_NOT_CONNECTED (0x0000) 348#define HERMES_LINKSTATUS_NOT_CONNECTED (0x0000)
348#define HERMES_LINKSTATUS_CONNECTED (0x0001) 349#define HERMES_LINKSTATUS_CONNECTED (0x0001)
349#define HERMES_LINKSTATUS_DISCONNECTED (0x0002) 350#define HERMES_LINKSTATUS_DISCONNECTED (0x0002)
350#define HERMES_LINKSTATUS_AP_CHANGE (0x0003) 351#define HERMES_LINKSTATUS_AP_CHANGE (0x0003)
351#define HERMES_LINKSTATUS_AP_OUT_OF_RANGE (0x0004) 352#define HERMES_LINKSTATUS_AP_OUT_OF_RANGE (0x0004)
352#define HERMES_LINKSTATUS_AP_IN_RANGE (0x0005) 353#define HERMES_LINKSTATUS_AP_IN_RANGE (0x0005)
353#define HERMES_LINKSTATUS_ASSOC_FAILED (0x0006) 354#define HERMES_LINKSTATUS_ASSOC_FAILED (0x0006)
354 355
355struct hermes_linkstatus { 356struct hermes_linkstatus {
356 __le16 linkstatus; /* Link status */ 357 __le16 linkstatus; /* Link status */
357} __attribute__ ((packed)); 358} __attribute__ ((packed));
@@ -384,11 +385,12 @@ typedef struct hermes {
384 385
385/* Register access convenience macros */ 386/* Register access convenience macros */
386#define hermes_read_reg(hw, off) \ 387#define hermes_read_reg(hw, off) \
387 (ioread16((hw)->iobase + ( (off) << (hw)->reg_spacing ))) 388 (ioread16((hw)->iobase + ((off) << (hw)->reg_spacing)))
388#define hermes_write_reg(hw, off, val) \ 389#define hermes_write_reg(hw, off, val) \
389 (iowrite16((val), (hw)->iobase + ((off) << (hw)->reg_spacing))) 390 (iowrite16((val), (hw)->iobase + ((off) << (hw)->reg_spacing)))
390#define hermes_read_regn(hw, name) hermes_read_reg((hw), HERMES_##name) 391#define hermes_read_regn(hw, name) hermes_read_reg((hw), HERMES_##name)
391#define hermes_write_regn(hw, name, val) hermes_write_reg((hw), HERMES_##name, (val)) 392#define hermes_write_regn(hw, name, val) \
393 hermes_write_reg((hw), HERMES_##name, (val))
392 394
393/* Function prototypes */ 395/* Function prototypes */
394void hermes_struct_init(hermes_t *hw, void __iomem *address, int reg_spacing); 396void hermes_struct_init(hermes_t *hw, void __iomem *address, int reg_spacing);
@@ -430,7 +432,7 @@ static inline int hermes_enable_port(hermes_t *hw, int port)
430 432
431static inline int hermes_disable_port(hermes_t *hw, int port) 433static inline int hermes_disable_port(hermes_t *hw, int port)
432{ 434{
433 return hermes_docmd_wait(hw, HERMES_CMD_DISABLE | (port << 8), 435 return hermes_docmd_wait(hw, HERMES_CMD_DISABLE | (port << 8),
434 0, NULL); 436 0, NULL);
435} 437}
436 438
@@ -441,11 +443,12 @@ static inline int hermes_inquire(hermes_t *hw, u16 rid)
441 return hermes_docmd_wait(hw, HERMES_CMD_INQUIRE, rid, NULL); 443 return hermes_docmd_wait(hw, HERMES_CMD_INQUIRE, rid, NULL);
442} 444}
443 445
444#define HERMES_BYTES_TO_RECLEN(n) ( (((n)+1)/2) + 1 ) 446#define HERMES_BYTES_TO_RECLEN(n) ((((n)+1)/2) + 1)
445#define HERMES_RECLEN_TO_BYTES(n) ( ((n)-1) * 2 ) 447#define HERMES_RECLEN_TO_BYTES(n) (((n)-1) * 2)
446 448
447/* Note that for the next two, the count is in 16-bit words, not bytes */ 449/* Note that for the next two, the count is in 16-bit words, not bytes */
448static inline void hermes_read_words(struct hermes *hw, int off, void *buf, unsigned count) 450static inline void hermes_read_words(struct hermes *hw, int off,
451 void *buf, unsigned count)
449{ 452{
450 off = off << hw->reg_spacing; 453 off = off << hw->reg_spacing;
451 ioread16_rep(hw->iobase + off, buf, count); 454 ioread16_rep(hw->iobase + off, buf, count);
@@ -460,7 +463,8 @@ static inline void hermes_write_bytes(struct hermes *hw, int off,
460 iowrite8(buf[count - 1], hw->iobase + off); 463 iowrite8(buf[count - 1], hw->iobase + off);
461} 464}
462 465
463static inline void hermes_clear_words(struct hermes *hw, int off, unsigned count) 466static inline void hermes_clear_words(struct hermes *hw, int off,
467 unsigned count)
464{ 468{
465 unsigned i; 469 unsigned i;
466 470
@@ -471,9 +475,10 @@ static inline void hermes_clear_words(struct hermes *hw, int off, unsigned count
471} 475}
472 476
473#define HERMES_READ_RECORD(hw, bap, rid, buf) \ 477#define HERMES_READ_RECORD(hw, bap, rid, buf) \
474 (hermes_read_ltv((hw),(bap),(rid), sizeof(*buf), NULL, (buf))) 478 (hermes_read_ltv((hw), (bap), (rid), sizeof(*buf), NULL, (buf)))
475#define HERMES_WRITE_RECORD(hw, bap, rid, buf) \ 479#define HERMES_WRITE_RECORD(hw, bap, rid, buf) \
476 (hermes_write_ltv((hw),(bap),(rid),HERMES_BYTES_TO_RECLEN(sizeof(*buf)),(buf))) 480 (hermes_write_ltv((hw), (bap), (rid), \
481 HERMES_BYTES_TO_RECLEN(sizeof(*buf)), (buf)))
477 482
478static inline int hermes_read_wordrec(hermes_t *hw, int bap, u16 rid, u16 *word) 483static inline int hermes_read_wordrec(hermes_t *hw, int bap, u16 rid, u16 *word)
479{ 484{
diff --git a/drivers/net/wireless/orinoco/orinoco.h b/drivers/net/wireless/orinoco/orinoco.h
index c653816ef5fe..f3f94b28ce6d 100644
--- a/drivers/net/wireless/orinoco/orinoco.h
+++ b/drivers/net/wireless/orinoco/orinoco.h
@@ -1,5 +1,5 @@
1/* orinoco.h 1/* orinoco.h
2 * 2 *
3 * Common definitions to all pieces of the various orinoco 3 * Common definitions to all pieces of the various orinoco
4 * drivers 4 * drivers
5 */ 5 */
@@ -18,9 +18,9 @@
18#include "hermes.h" 18#include "hermes.h"
19 19
20/* To enable debug messages */ 20/* To enable debug messages */
21//#define ORINOCO_DEBUG 3 21/*#define ORINOCO_DEBUG 3*/
22 22
23#define WIRELESS_SPY // enable iwspy support 23#define WIRELESS_SPY /* enable iwspy support */
24 24
25#define MAX_SCAN_LEN 4096 25#define MAX_SCAN_LEN 4096
26 26
@@ -121,7 +121,7 @@ struct orinoco_private {
121 u16 encode_alg, wep_restrict, tx_key; 121 u16 encode_alg, wep_restrict, tx_key;
122 struct orinoco_key keys[ORINOCO_MAX_KEYS]; 122 struct orinoco_key keys[ORINOCO_MAX_KEYS];
123 int bitratemode; 123 int bitratemode;
124 char nick[IW_ESSID_MAX_SIZE+1]; 124 char nick[IW_ESSID_MAX_SIZE+1];
125 char desired_essid[IW_ESSID_MAX_SIZE+1]; 125 char desired_essid[IW_ESSID_MAX_SIZE+1];
126 char desired_bssid[ETH_ALEN]; 126 char desired_bssid[ETH_ALEN];
127 int bssid_fixed; 127 int bssid_fixed;
@@ -131,7 +131,7 @@ struct orinoco_private {
131 u16 pm_on, pm_mcast, pm_period, pm_timeout; 131 u16 pm_on, pm_mcast, pm_period, pm_timeout;
132 u16 preamble; 132 u16 preamble;
133#ifdef WIRELESS_SPY 133#ifdef WIRELESS_SPY
134 struct iw_spy_data spy_data; /* iwspy support */ 134 struct iw_spy_data spy_data; /* iwspy support */
135 struct iw_public_data wireless_data; 135 struct iw_public_data wireless_data;
136#endif 136#endif
137 137
@@ -168,7 +168,10 @@ struct orinoco_private {
168 168
169#ifdef ORINOCO_DEBUG 169#ifdef ORINOCO_DEBUG
170extern int orinoco_debug; 170extern int orinoco_debug;
171#define DEBUG(n, args...) do { if (orinoco_debug>(n)) printk(KERN_DEBUG args); } while(0) 171#define DEBUG(n, args...) do { \
172 if (orinoco_debug > (n)) \
173 printk(KERN_DEBUG args); \
174} while (0)
172#else 175#else
173#define DEBUG(n, args...) do { } while (0) 176#define DEBUG(n, args...) do { } while (0)
174#endif /* ORINOCO_DEBUG */ 177#endif /* ORINOCO_DEBUG */
@@ -185,7 +188,7 @@ extern void free_orinocodev(struct net_device *dev);
185extern int __orinoco_up(struct net_device *dev); 188extern int __orinoco_up(struct net_device *dev);
186extern int __orinoco_down(struct net_device *dev); 189extern int __orinoco_down(struct net_device *dev);
187extern int orinoco_reinit_firmware(struct net_device *dev); 190extern int orinoco_reinit_firmware(struct net_device *dev);
188extern irqreturn_t orinoco_interrupt(int irq, void * dev_id); 191extern irqreturn_t orinoco_interrupt(int irq, void *dev_id);
189 192
190/********************************************************************/ 193/********************************************************************/
191/* Locking and synchronization functions */ 194/* Locking and synchronization functions */
diff --git a/drivers/net/wireless/orinoco/orinoco_cs.c b/drivers/net/wireless/orinoco/orinoco_cs.c
index 0b32215d3f5d..d194b3e0311d 100644
--- a/drivers/net/wireless/orinoco/orinoco_cs.c
+++ b/drivers/net/wireless/orinoco/orinoco_cs.c
@@ -6,7 +6,7 @@
6 * It should also be usable on various Prism II based cards such as the 6 * It should also be usable on various Prism II based cards such as the
7 * Linksys, D-Link and Farallon Skyline. It should also work on Symbol 7 * Linksys, D-Link and Farallon Skyline. It should also work on Symbol
8 * cards such as the 3Com AirConnect and Ericsson WLAN. 8 * cards such as the 3Com AirConnect and Ericsson WLAN.
9 * 9 *
10 * Copyright notice & release notes in file orinoco.c 10 * Copyright notice & release notes in file orinoco.c
11 */ 11 */
12 12
@@ -30,7 +30,8 @@
30/********************************************************************/ 30/********************************************************************/
31 31
32MODULE_AUTHOR("David Gibson <hermes@gibson.dropbear.id.au>"); 32MODULE_AUTHOR("David Gibson <hermes@gibson.dropbear.id.au>");
33MODULE_DESCRIPTION("Driver for PCMCIA Lucent Orinoco, Prism II based and similar wireless cards"); 33MODULE_DESCRIPTION("Driver for PCMCIA Lucent Orinoco,"
34 " Prism II based and similar wireless cards");
34MODULE_LICENSE("Dual MPL/GPL"); 35MODULE_LICENSE("Dual MPL/GPL");
35 36
36/* Module parameters */ 37/* Module parameters */
@@ -53,8 +54,8 @@ struct orinoco_pccard {
53 54
54 /* Used to handle hard reset */ 55 /* Used to handle hard reset */
55 /* yuck, we need this hack to work around the insanity of the 56 /* yuck, we need this hack to work around the insanity of the
56 * PCMCIA layer */ 57 * PCMCIA layer */
57 unsigned long hard_reset_in_progress; 58 unsigned long hard_reset_in_progress;
58}; 59};
59 60
60 61
@@ -98,7 +99,7 @@ orinoco_cs_hard_reset(struct orinoco_private *priv)
98 * This creates an "instance" of the driver, allocating local data 99 * This creates an "instance" of the driver, allocating local data
99 * structures for one device. The device is registered with Card 100 * structures for one device. The device is registered with Card
100 * Services. 101 * Services.
101 * 102 *
102 * The dev_link structure is initialized, but we don't actually 103 * The dev_link structure is initialized, but we don't actually
103 * configure the card at this point -- we wait until we receive a card 104 * configure the card at this point -- we wait until we receive a card
104 * insertion event. */ 105 * insertion event. */
@@ -111,7 +112,7 @@ orinoco_cs_probe(struct pcmcia_device *link)
111 112
112 dev = alloc_orinocodev(sizeof(*card), &handle_to_dev(link), 113 dev = alloc_orinocodev(sizeof(*card), &handle_to_dev(link),
113 orinoco_cs_hard_reset, NULL); 114 orinoco_cs_hard_reset, NULL);
114 if (! dev) 115 if (!dev)
115 return -ENOMEM; 116 return -ENOMEM;
116 priv = netdev_priv(dev); 117 priv = netdev_priv(dev);
117 card = priv->card; 118 card = priv->card;
@@ -124,7 +125,7 @@ orinoco_cs_probe(struct pcmcia_device *link)
124 link->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING | IRQ_HANDLE_PRESENT; 125 link->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING | IRQ_HANDLE_PRESENT;
125 link->irq.IRQInfo1 = IRQ_LEVEL_ID; 126 link->irq.IRQInfo1 = IRQ_LEVEL_ID;
126 link->irq.Handler = orinoco_interrupt; 127 link->irq.Handler = orinoco_interrupt;
127 link->irq.Instance = dev; 128 link->irq.Instance = dev;
128 129
129 /* General socket configuration defaults can go here. In this 130 /* General socket configuration defaults can go here. In this
130 * client, we assume very little, and rely on the CIS for 131 * client, we assume very little, and rely on the CIS for
@@ -162,8 +163,10 @@ static void orinoco_cs_detach(struct pcmcia_device *link)
162 */ 163 */
163 164
164#define CS_CHECK(fn, ret) do { \ 165#define CS_CHECK(fn, ret) do { \
165 last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; \ 166 last_fn = (fn); \
166 } while (0) 167 if ((last_ret = (ret)) != 0) \
168 goto cs_failed; \
169} while (0)
167 170
168static int orinoco_cs_config_check(struct pcmcia_device *p_dev, 171static int orinoco_cs_config_check(struct pcmcia_device *p_dev,
169 cistpl_cftable_entry_t *cfg, 172 cistpl_cftable_entry_t *cfg,
@@ -307,8 +310,8 @@ orinoco_cs_config(struct pcmcia_device *link)
307 * initialized and arranged in a linked list at link->dev_node. */ 310 * initialized and arranged in a linked list at link->dev_node. */
308 strcpy(card->node.dev_name, dev->name); 311 strcpy(card->node.dev_name, dev->name);
309 link->dev_node = &card->node; /* link->dev_node being non-NULL is also 312 link->dev_node = &card->node; /* link->dev_node being non-NULL is also
310 used to indicate that the 313 * used to indicate that the
311 net_device has been registered */ 314 * net_device has been registered */
312 315
313 /* Finally, report what we've done */ 316 /* Finally, report what we've done */
314 printk(KERN_DEBUG "%s: " DRIVER_NAME " at %s, irq %d, io " 317 printk(KERN_DEBUG "%s: " DRIVER_NAME " at %s, irq %d, io "
@@ -359,7 +362,7 @@ static int orinoco_cs_suspend(struct pcmcia_device *link)
359 /* This is probably racy, but I can't think of 362 /* This is probably racy, but I can't think of
360 a better way, short of rewriting the PCMCIA 363 a better way, short of rewriting the PCMCIA
361 layer to not suck :-( */ 364 layer to not suck :-( */
362 if (! test_bit(0, &card->hard_reset_in_progress)) { 365 if (!test_bit(0, &card->hard_reset_in_progress)) {
363 spin_lock_irqsave(&priv->lock, flags); 366 spin_lock_irqsave(&priv->lock, flags);
364 367
365 err = __orinoco_down(dev); 368 err = __orinoco_down(dev);
@@ -384,7 +387,7 @@ static int orinoco_cs_resume(struct pcmcia_device *link)
384 int err = 0; 387 int err = 0;
385 unsigned long flags; 388 unsigned long flags;
386 389
387 if (! test_bit(0, &card->hard_reset_in_progress)) { 390 if (!test_bit(0, &card->hard_reset_in_progress)) {
388 err = orinoco_reinit_firmware(dev); 391 err = orinoco_reinit_firmware(dev);
389 if (err) { 392 if (err) {
390 printk(KERN_ERR "%s: Error %d re-initializing firmware\n", 393 printk(KERN_ERR "%s: Error %d re-initializing firmware\n",
@@ -397,7 +400,7 @@ static int orinoco_cs_resume(struct pcmcia_device *link)
397 netif_device_attach(dev); 400 netif_device_attach(dev);
398 priv->hw_unavailable--; 401 priv->hw_unavailable--;
399 402
400 if (priv->open && ! priv->hw_unavailable) { 403 if (priv->open && !priv->hw_unavailable) {
401 err = __orinoco_up(dev); 404 err = __orinoco_up(dev);
402 if (err) 405 if (err)
403 printk(KERN_ERR "%s: Error %d restarting card\n", 406 printk(KERN_ERR "%s: Error %d restarting card\n",
diff --git a/drivers/net/wireless/orinoco/orinoco_nortel.c b/drivers/net/wireless/orinoco/orinoco_nortel.c
index 2fc86596302e..b01726255c6f 100644
--- a/drivers/net/wireless/orinoco/orinoco_nortel.c
+++ b/drivers/net/wireless/orinoco/orinoco_nortel.c
@@ -9,12 +9,12 @@
9 * 9 *
10 * Some of this code is borrowed from orinoco_plx.c 10 * Some of this code is borrowed from orinoco_plx.c
11 * Copyright (C) 2001 Daniel Barlow 11 * Copyright (C) 2001 Daniel Barlow
12 * Some of this code is borrowed from orinoco_pci.c 12 * Some of this code is borrowed from orinoco_pci.c
13 * Copyright (C) 2001 Jean Tourrilhes 13 * Copyright (C) 2001 Jean Tourrilhes
14 * Some of this code is "inspired" by linux-wlan-ng-0.1.10, but nothing 14 * Some of this code is "inspired" by linux-wlan-ng-0.1.10, but nothing
15 * has been copied from it. linux-wlan-ng-0.1.10 is originally : 15 * has been copied from it. linux-wlan-ng-0.1.10 is originally :
16 * Copyright (C) 1999 AbsoluteValue Systems, Inc. All Rights Reserved. 16 * Copyright (C) 1999 AbsoluteValue Systems, Inc. All Rights Reserved.
17 * 17 *
18 * The contents of this file are subject to the Mozilla Public License 18 * The contents of this file are subject to the Mozilla Public License
19 * Version 1.1 (the "License"); you may not use this file except in 19 * Version 1.1 (the "License"); you may not use this file except in
20 * compliance with the License. You may obtain a copy of the License 20 * compliance with the License. You may obtain a copy of the License
@@ -103,9 +103,8 @@ static int orinoco_nortel_hw_init(struct orinoco_pci_card *card)
103 iowrite16(0x8, card->bridge_io + 2); 103 iowrite16(0x8, card->bridge_io + 2);
104 for (i = 0; i < 30; i++) { 104 for (i = 0; i < 30; i++) {
105 mdelay(30); 105 mdelay(30);
106 if (ioread16(card->bridge_io) & 0x10) { 106 if (ioread16(card->bridge_io) & 0x10)
107 break; 107 break;
108 }
109 } 108 }
110 if (i == 30) { 109 if (i == 30) {
111 printk(KERN_ERR PFX "brg1 timed out\n"); 110 printk(KERN_ERR PFX "brg1 timed out\n");
diff --git a/drivers/net/wireless/orinoco/orinoco_pci.c b/drivers/net/wireless/orinoco/orinoco_pci.c
index 4ebd638a073e..78cafff1fb2e 100644
--- a/drivers/net/wireless/orinoco/orinoco_pci.c
+++ b/drivers/net/wireless/orinoco/orinoco_pci.c
@@ -1,5 +1,5 @@
1/* orinoco_pci.c 1/* orinoco_pci.c
2 * 2 *
3 * Driver for Prism 2.5/3 devices that have a direct PCI interface 3 * Driver for Prism 2.5/3 devices that have a direct PCI interface
4 * (i.e. these are not PCMCIA cards in a PCMCIA-to-PCI bridge). 4 * (i.e. these are not PCMCIA cards in a PCMCIA-to-PCI bridge).
5 * The card contains only one PCI region, which contains all the usual 5 * The card contains only one PCI region, which contains all the usual
@@ -237,7 +237,8 @@ static char version[] __initdata = DRIVER_NAME " " DRIVER_VERSION
237 " (Pavel Roskin <proski@gnu.org>," 237 " (Pavel Roskin <proski@gnu.org>,"
238 " David Gibson <hermes@gibson.dropbear.id.au> &" 238 " David Gibson <hermes@gibson.dropbear.id.au> &"
239 " Jean Tourrilhes <jt@hpl.hp.com>)"; 239 " Jean Tourrilhes <jt@hpl.hp.com>)";
240MODULE_AUTHOR("Pavel Roskin <proski@gnu.org> & David Gibson <hermes@gibson.dropbear.id.au>"); 240MODULE_AUTHOR("Pavel Roskin <proski@gnu.org> &"
241 " David Gibson <hermes@gibson.dropbear.id.au>");
241MODULE_DESCRIPTION("Driver for wireless LAN cards using direct PCI interface"); 242MODULE_DESCRIPTION("Driver for wireless LAN cards using direct PCI interface");
242MODULE_LICENSE("Dual MPL/GPL"); 243MODULE_LICENSE("Dual MPL/GPL");
243 244
diff --git a/drivers/net/wireless/orinoco/orinoco_pci.h b/drivers/net/wireless/orinoco/orinoco_pci.h
index f4e5e06760c1..88df3ee98078 100644
--- a/drivers/net/wireless/orinoco/orinoco_pci.h
+++ b/drivers/net/wireless/orinoco/orinoco_pci.h
@@ -1,5 +1,5 @@
1/* orinoco_pci.h 1/* orinoco_pci.h
2 * 2 *
3 * Common code for all Orinoco drivers for PCI devices, including 3 * Common code for all Orinoco drivers for PCI devices, including
4 * both native PCI and PCMCIA-to-PCI bridges. 4 * both native PCI and PCMCIA-to-PCI bridges.
5 * 5 *
@@ -37,11 +37,11 @@ static int orinoco_pci_suspend(struct pci_dev *pdev, pm_message_t state)
37 if (err) 37 if (err)
38 printk(KERN_WARNING "%s: error %d bringing interface down " 38 printk(KERN_WARNING "%s: error %d bringing interface down "
39 "for suspend\n", dev->name, err); 39 "for suspend\n", dev->name, err);
40 40
41 netif_device_detach(dev); 41 netif_device_detach(dev);
42 42
43 priv->hw_unavailable++; 43 priv->hw_unavailable++;
44 44
45 orinoco_unlock(priv, &flags); 45 orinoco_unlock(priv, &flags);
46 46
47 free_irq(pdev->irq, dev); 47 free_irq(pdev->irq, dev);
@@ -90,13 +90,13 @@ static int orinoco_pci_resume(struct pci_dev *pdev)
90 90
91 priv->hw_unavailable--; 91 priv->hw_unavailable--;
92 92
93 if (priv->open && (! priv->hw_unavailable)) { 93 if (priv->open && (!priv->hw_unavailable)) {
94 err = __orinoco_up(dev); 94 err = __orinoco_up(dev);
95 if (err) 95 if (err)
96 printk(KERN_ERR "%s: Error %d restarting card on resume\n", 96 printk(KERN_ERR "%s: Error %d restarting card on resume\n",
97 dev->name, err); 97 dev->name, err);
98 } 98 }
99 99
100 spin_unlock_irqrestore(&priv->lock, flags); 100 spin_unlock_irqrestore(&priv->lock, flags);
101 101
102 return 0; 102 return 0;
diff --git a/drivers/net/wireless/orinoco/orinoco_plx.c b/drivers/net/wireless/orinoco/orinoco_plx.c
index ef761857bb38..a2a4471c0337 100644
--- a/drivers/net/wireless/orinoco/orinoco_plx.c
+++ b/drivers/net/wireless/orinoco/orinoco_plx.c
@@ -146,9 +146,8 @@ static int orinoco_plx_hw_init(struct orinoco_pci_card *card)
146 }; 146 };
147 147
148 printk(KERN_DEBUG PFX "CIS: "); 148 printk(KERN_DEBUG PFX "CIS: ");
149 for (i = 0; i < 16; i++) { 149 for (i = 0; i < 16; i++)
150 printk("%02X:", ioread8(card->attr_io + (i << 1))); 150 printk("%02X:", ioread8(card->attr_io + (i << 1)));
151 }
152 printk("\n"); 151 printk("\n");
153 152
154 /* Verify whether a supported PC card is present */ 153 /* Verify whether a supported PC card is present */
diff --git a/drivers/net/wireless/orinoco/orinoco_tmd.c b/drivers/net/wireless/orinoco/orinoco_tmd.c
index ede24ec309c0..e77c4042d43a 100644
--- a/drivers/net/wireless/orinoco/orinoco_tmd.c
+++ b/drivers/net/wireless/orinoco/orinoco_tmd.c
@@ -1,7 +1,7 @@
1/* orinoco_tmd.c 1/* orinoco_tmd.c
2 * 2 *
3 * Driver for Prism II devices which would usually be driven by orinoco_cs, 3 * Driver for Prism II devices which would usually be driven by orinoco_cs,
4 * but are connected to the PCI bus by a TMD7160. 4 * but are connected to the PCI bus by a TMD7160.
5 * 5 *
6 * Copyright (C) 2003 Joerg Dorchain <joerg AT dorchain.net> 6 * Copyright (C) 2003 Joerg Dorchain <joerg AT dorchain.net>
7 * based heavily upon orinoco_plx.c Copyright (C) 2001 Daniel Barlow 7 * based heavily upon orinoco_plx.c Copyright (C) 2001 Daniel Barlow
diff --git a/drivers/net/wireless/orinoco/spectrum_cs.c b/drivers/net/wireless/orinoco/spectrum_cs.c
index b2ca2e39c2cb..9aefe19dbac2 100644
--- a/drivers/net/wireless/orinoco/spectrum_cs.c
+++ b/drivers/net/wireless/orinoco/spectrum_cs.c
@@ -133,7 +133,7 @@ spectrum_reset(struct pcmcia_device *link, int idle)
133 udelay(1000); 133 udelay(1000);
134 return 0; 134 return 0;
135 135
136 cs_failed: 136cs_failed:
137 cs_error(link, last_fn, last_ret); 137 cs_error(link, last_fn, last_ret);
138 return -ENODEV; 138 return -ENODEV;
139} 139}
@@ -171,7 +171,7 @@ spectrum_cs_stop_firmware(struct orinoco_private *priv, int idle)
171 * This creates an "instance" of the driver, allocating local data 171 * This creates an "instance" of the driver, allocating local data
172 * structures for one device. The device is registered with Card 172 * structures for one device. The device is registered with Card
173 * Services. 173 * Services.
174 * 174 *
175 * The dev_link structure is initialized, but we don't actually 175 * The dev_link structure is initialized, but we don't actually
176 * configure the card at this point -- we wait until we receive a card 176 * configure the card at this point -- we wait until we receive a card
177 * insertion event. */ 177 * insertion event. */
@@ -185,7 +185,7 @@ spectrum_cs_probe(struct pcmcia_device *link)
185 dev = alloc_orinocodev(sizeof(*card), &handle_to_dev(link), 185 dev = alloc_orinocodev(sizeof(*card), &handle_to_dev(link),
186 spectrum_cs_hard_reset, 186 spectrum_cs_hard_reset,
187 spectrum_cs_stop_firmware); 187 spectrum_cs_stop_firmware);
188 if (! dev) 188 if (!dev)
189 return -ENOMEM; 189 return -ENOMEM;
190 priv = netdev_priv(dev); 190 priv = netdev_priv(dev);
191 card = priv->card; 191 card = priv->card;
@@ -198,7 +198,7 @@ spectrum_cs_probe(struct pcmcia_device *link)
198 link->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING | IRQ_HANDLE_PRESENT; 198 link->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING | IRQ_HANDLE_PRESENT;
199 link->irq.IRQInfo1 = IRQ_LEVEL_ID; 199 link->irq.IRQInfo1 = IRQ_LEVEL_ID;
200 link->irq.Handler = orinoco_interrupt; 200 link->irq.Handler = orinoco_interrupt;
201 link->irq.Instance = dev; 201 link->irq.Instance = dev;
202 202
203 /* General socket configuration defaults can go here. In this 203 /* General socket configuration defaults can go here. In this
204 * client, we assume very little, and rely on the CIS for 204 * client, we assume very little, and rely on the CIS for
@@ -367,9 +367,8 @@ spectrum_cs_config(struct pcmcia_device *link)
367 card->node.major = card->node.minor = 0; 367 card->node.major = card->node.minor = 0;
368 368
369 /* Reset card */ 369 /* Reset card */
370 if (spectrum_cs_hard_reset(priv) != 0) { 370 if (spectrum_cs_hard_reset(priv) != 0)
371 goto failed; 371 goto failed;
372 }
373 372
374 SET_NETDEV_DEV(dev, &handle_to_dev(link)); 373 SET_NETDEV_DEV(dev, &handle_to_dev(link));
375 /* Tell the stack we exist */ 374 /* Tell the stack we exist */
@@ -382,8 +381,8 @@ spectrum_cs_config(struct pcmcia_device *link)
382 * initialized and arranged in a linked list at link->dev_node. */ 381 * initialized and arranged in a linked list at link->dev_node. */
383 strcpy(card->node.dev_name, dev->name); 382 strcpy(card->node.dev_name, dev->name);
384 link->dev_node = &card->node; /* link->dev_node being non-NULL is also 383 link->dev_node = &card->node; /* link->dev_node being non-NULL is also
385 used to indicate that the 384 * used to indicate that the
386 net_device has been registered */ 385 * net_device has been registered */
387 386
388 /* Finally, report what we've done */ 387 /* Finally, report what we've done */
389 printk(KERN_DEBUG "%s: " DRIVER_NAME " at %s, irq %d, io " 388 printk(KERN_DEBUG "%s: " DRIVER_NAME " at %s, irq %d, io "