diff options
author | Andrey Borzenkov <arvidjaar@mail.ru> | 2009-01-25 15:08:43 -0500 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2009-02-09 15:03:32 -0500 |
commit | d14c7c1d6aef1175625ea72938b07cee072723dc (patch) | |
tree | 95022428783c802a21fcbe27d216e4c4d869b62f /drivers/net/wireless/orinoco/hermes.c | |
parent | aa6320d336971171df1d13c1c284facf10804881 (diff) |
orinoco: checkpatch cleanup
Fix errors and obvious warnings reported by checkpatch in all files
except orinoco.c. Orinoco.c is part of different patch series of Dave.
Signed-off-by: Andrey Borzenkov <arvidjaar@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/orinoco/hermes.c')
-rw-r--r-- | drivers/net/wireless/orinoco/hermes.c | 102 |
1 files changed, 56 insertions, 46 deletions
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 | ||
48 | MODULE_DESCRIPTION("Low-level driver helper for Lucent Hermes chipset and Prism II HFA384x wireless MAC controller"); | 48 | MODULE_DESCRIPTION("Low-level driver helper for Lucent Hermes chipset" |
49 | " and Prism II HFA384x wireless MAC controller"); | ||
49 | MODULE_AUTHOR("Pavel Roskin <proski@gnu.org>" | 50 | MODULE_AUTHOR("Pavel Roskin <proski@gnu.org>" |
50 | " & David Gibson <hermes@gibson.dropbear.id.au>"); | 51 | " & David Gibson <hermes@gibson.dropbear.id.au>"); |
51 | MODULE_LICENSE("Dual MPL/GPL"); | 52 | MODULE_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. */ |
234 | int hermes_docmd_wait(hermes_t *hw, u16 cmd, u16 parm0, | 237 | int 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 | } |
340 | EXPORT_SYMBOL(hermes_allocate); | 342 | EXPORT_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 | */ |
405 | int hermes_bap_pread(hermes_t *hw, int bap, void *buf, int len, | 412 | int 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 | */ |
431 | int hermes_bap_pwrite(hermes_t *hw, int bap, const void *buf, int len, | 441 | int 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 | } |
450 | EXPORT_SYMBOL(hermes_bap_pwrite); | 460 | EXPORT_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 | } |
504 | EXPORT_SYMBOL(hermes_read_ltv); | 514 | EXPORT_SYMBOL(hermes_read_ltv); |
505 | 515 | ||
506 | int hermes_write_ltv(hermes_t *hw, int bap, u16 rid, | 516 | int 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; |