diff options
author | Kelley Nielsen <kelleynnn@gmail.com> | 2013-10-29 19:06:36 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-10-29 20:11:36 -0400 |
commit | b1bdd4d3ed3b501063d81618be547be0cfe61b0f (patch) | |
tree | 8357b15cccb299a45c8a5e6704f96a56cb02b285 | |
parent | 43fc69b1122b8a3e540b9d6ab36dc9840fa918ff (diff) |
staging: ft1000: return values corrected in scram_start_dwnld
The ft1000 usb driver ignores expected Linux error codes, and uses two
values defined in ft1000_usb.h: STATUS_SUCCESS 0, and STATUS_FAILURE
0x1001; and sometimes -1. This patch changes the return values of the
function scram_start_dwnld to match the status of the handshake returned
by its helper functions, get_handshake and get_handshake_usb. If the
handshake fails, -ENETRESET is returned instead of the inappropriate
STATUS_FAILURE. Also, a new test has been added to differentiate failure
due to timeout from failure due to net reset (the default). -ETIMEDOUT
is returned in this case. Finally, 0 is returned on success instead of
STATUS_SUCCESS.
Signed-off-by: Kelley Nielsen <kelleynnn@gmail.com>
Suggested-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | drivers/staging/ft1000/ft1000-usb/ft1000_download.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/staging/ft1000/ft1000-usb/ft1000_download.c b/drivers/staging/ft1000/ft1000-usb/ft1000_download.c index 72f3cfc95aa1..68ded17c0f5c 100644 --- a/drivers/staging/ft1000/ft1000-usb/ft1000_download.c +++ b/drivers/staging/ft1000/ft1000-usb/ft1000_download.c | |||
@@ -554,7 +554,7 @@ static int write_blk_fifo(struct ft1000_usb *ft1000dev, u16 **pUsFile, | |||
554 | static int scram_start_dwnld(struct ft1000_usb *ft1000dev, u16 *hshake, | 554 | static int scram_start_dwnld(struct ft1000_usb *ft1000dev, u16 *hshake, |
555 | u32 *state) | 555 | u32 *state) |
556 | { | 556 | { |
557 | int status = STATUS_SUCCESS; | 557 | int status = 0; |
558 | 558 | ||
559 | DEBUG("FT1000:STATE_START_DWNLD\n"); | 559 | DEBUG("FT1000:STATE_START_DWNLD\n"); |
560 | if (ft1000dev->usbboot) | 560 | if (ft1000dev->usbboot) |
@@ -564,9 +564,11 @@ static int scram_start_dwnld(struct ft1000_usb *ft1000dev, u16 *hshake, | |||
564 | if (*hshake == HANDSHAKE_DSP_BL_READY) { | 564 | if (*hshake == HANDSHAKE_DSP_BL_READY) { |
565 | DEBUG("scram_dnldr: handshake is HANDSHAKE_DSP_BL_READY, call put_handshake(HANDSHAKE_DRIVER_READY)\n"); | 565 | DEBUG("scram_dnldr: handshake is HANDSHAKE_DSP_BL_READY, call put_handshake(HANDSHAKE_DRIVER_READY)\n"); |
566 | put_handshake(ft1000dev, HANDSHAKE_DRIVER_READY); | 566 | put_handshake(ft1000dev, HANDSHAKE_DRIVER_READY); |
567 | } else if (*hshake == HANDSHAKE_TIMEOUT_VALUE) { | ||
568 | status = -ETIMEDOUT; | ||
567 | } else { | 569 | } else { |
568 | DEBUG("FT1000:download:Download error: Handshake failed\n"); | 570 | DEBUG("FT1000:download:Download error: Handshake failed\n"); |
569 | status = STATUS_FAILURE; | 571 | status = -ENETRESET; |
570 | } | 572 | } |
571 | *state = STATE_BOOT_DWNLD; | 573 | *state = STATE_BOOT_DWNLD; |
572 | return status; | 574 | return status; |