diff options
author | Pavel Roskin <proski@gnu.org> | 2006-04-07 04:10:39 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2006-04-24 16:15:50 -0400 |
commit | 6b61626290900f12b7f3978f57f329da6811fb59 (patch) | |
tree | 2e1d9518d786bbca0e87ffec3f42a6f5794fe384 /drivers/net/wireless/hermes.c | |
parent | b34b867e944628418d587367276c9a82e03aba8c (diff) |
[PATCH] orinoco replace hermes_write_words() with hermes_write_bytes()
The new function can write an odd number of bytes, thus making padding
unnecessary.
Signed-off-by: Pavel Roskin <proski@gnu.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/hermes.c')
-rw-r--r-- | drivers/net/wireless/hermes.c | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/drivers/net/wireless/hermes.c b/drivers/net/wireless/hermes.c index 456d934caad8..be24f01ea469 100644 --- a/drivers/net/wireless/hermes.c +++ b/drivers/net/wireless/hermes.c | |||
@@ -400,8 +400,7 @@ int hermes_bap_pread(hermes_t *hw, int bap, void *buf, int len, | |||
400 | } | 400 | } |
401 | 401 | ||
402 | /* Write a block of data to the chip's buffer, via the | 402 | /* Write a block of data to the chip's buffer, via the |
403 | * BAP. Synchronization/serialization is the caller's problem. len | 403 | * BAP. Synchronization/serialization is the caller's problem. |
404 | * must be even. | ||
405 | * | 404 | * |
406 | * Returns: < 0 on internal failure (errno), 0 on success, > 0 on error from firmware | 405 | * Returns: < 0 on internal failure (errno), 0 on success, > 0 on error from firmware |
407 | */ | 406 | */ |
@@ -411,7 +410,7 @@ int hermes_bap_pwrite(hermes_t *hw, int bap, const void *buf, int len, | |||
411 | int dreg = bap ? HERMES_DATA1 : HERMES_DATA0; | 410 | int dreg = bap ? HERMES_DATA1 : HERMES_DATA0; |
412 | int err = 0; | 411 | int err = 0; |
413 | 412 | ||
414 | if ( (len < 0) || (len % 2) ) | 413 | if (len < 0) |
415 | return -EINVAL; | 414 | return -EINVAL; |
416 | 415 | ||
417 | err = hermes_bap_seek(hw, bap, id, offset); | 416 | err = hermes_bap_seek(hw, bap, id, offset); |
@@ -419,7 +418,7 @@ int hermes_bap_pwrite(hermes_t *hw, int bap, const void *buf, int len, | |||
419 | goto out; | 418 | goto out; |
420 | 419 | ||
421 | /* Actually do the transfer */ | 420 | /* Actually do the transfer */ |
422 | hermes_write_words(hw, dreg, buf, len/2); | 421 | hermes_write_bytes(hw, dreg, buf, len); |
423 | 422 | ||
424 | out: | 423 | out: |
425 | return err; | 424 | return err; |
@@ -427,7 +426,7 @@ int hermes_bap_pwrite(hermes_t *hw, int bap, const void *buf, int len, | |||
427 | 426 | ||
428 | /* Write a block of data to the chip's buffer with padding if | 427 | /* Write a block of data to the chip's buffer with padding if |
429 | * neccessary, via the BAP. Synchronization/serialization is the | 428 | * neccessary, via the BAP. Synchronization/serialization is the |
430 | * caller's problem. len must be even. | 429 | * caller's problem. |
431 | * | 430 | * |
432 | * Returns: < 0 on internal failure (errno), 0 on success, > 0 on error from firmware | 431 | * Returns: < 0 on internal failure (errno), 0 on success, > 0 on error from firmware |
433 | */ | 432 | */ |
@@ -437,7 +436,7 @@ int hermes_bap_pwrite_pad(hermes_t *hw, int bap, const void *buf, unsigned data_ | |||
437 | int dreg = bap ? HERMES_DATA1 : HERMES_DATA0; | 436 | int dreg = bap ? HERMES_DATA1 : HERMES_DATA0; |
438 | int err = 0; | 437 | int err = 0; |
439 | 438 | ||
440 | if (len < 0 || len % 2 || data_len > len) | 439 | if (len < 0 || data_len > len) |
441 | return -EINVAL; | 440 | return -EINVAL; |
442 | 441 | ||
443 | err = hermes_bap_seek(hw, bap, id, offset); | 442 | err = hermes_bap_seek(hw, bap, id, offset); |
@@ -445,13 +444,13 @@ int hermes_bap_pwrite_pad(hermes_t *hw, int bap, const void *buf, unsigned data_ | |||
445 | goto out; | 444 | goto out; |
446 | 445 | ||
447 | /* Transfer all the complete words of data */ | 446 | /* Transfer all the complete words of data */ |
448 | hermes_write_words(hw, dreg, buf, data_len/2); | 447 | hermes_write_bytes(hw, dreg, buf, data_len); |
449 | /* If there is an odd byte left over pad and transfer it */ | 448 | /* If there is an odd byte left over pad and transfer it */ |
450 | if (data_len & 1) { | 449 | if (data_len & 1) { |
451 | u8 end[2]; | 450 | u8 end[2]; |
452 | end[1] = 0; | 451 | end[1] = 0; |
453 | end[0] = ((unsigned char *)buf)[data_len - 1]; | 452 | end[0] = ((unsigned char *)buf)[data_len - 1]; |
454 | hermes_write_words(hw, dreg, end, 1); | 453 | hermes_write_bytes(hw, dreg, end, 2); |
455 | data_len ++; | 454 | data_len ++; |
456 | } | 455 | } |
457 | /* Now send zeros for the padding */ | 456 | /* Now send zeros for the padding */ |
@@ -534,7 +533,7 @@ int hermes_write_ltv(hermes_t *hw, int bap, u16 rid, | |||
534 | 533 | ||
535 | count = length - 1; | 534 | count = length - 1; |
536 | 535 | ||
537 | hermes_write_words(hw, dreg, value, count); | 536 | hermes_write_bytes(hw, dreg, value, count << 1); |
538 | 537 | ||
539 | err = hermes_docmd_wait(hw, HERMES_CMD_ACCESS | HERMES_CMD_WRITE, | 538 | err = hermes_docmd_wait(hw, HERMES_CMD_ACCESS | HERMES_CMD_WRITE, |
540 | rid, NULL); | 539 | rid, NULL); |