staging: ft1000: function scram_start_dwnld extracted from scram_dnldr in ft1000_download.c

function scram_dnldr is over 500 lines long, with deep indents that
trigger checkpatch warnings for too many tabs. It mainly consists of a
switch statement with long, complicated cases. The first case has been
extracted to form the helper function scram_start_dwnld. Some style
issues in the extracted lines have been corrected as well.

Signed-off-by: Kelley Nielsen <kelleynnn@gmail.com>
Reviewed-by: Peter P Waskiewicz Jr <peter.p.waskiewicz.jr@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Kelley Nielsen 2013-10-27 16:40:39 -07:00 committed by Greg Kroah-Hartman
parent 93b2a6c847
commit eb3836cefc
1 changed files with 23 additions and 23 deletions

View File

@ -554,6 +554,27 @@ static u32 write_blk_fifo(struct ft1000_usb *ft1000dev, u16 **pUsFile,
return Status; return Status;
} }
static int scram_start_dwnld(struct ft1000_usb *ft1000dev, u16 *hshake,
u32 *state)
{
int status = STATUS_SUCCESS;
DEBUG("FT1000:STATE_START_DWNLD\n");
if (ft1000dev->usbboot)
*hshake = get_handshake_usb(ft1000dev, HANDSHAKE_DSP_BL_READY);
else
*hshake = get_handshake(ft1000dev, HANDSHAKE_DSP_BL_READY);
if (*hshake == HANDSHAKE_DSP_BL_READY) {
DEBUG("scram_dnldr: handshake is HANDSHAKE_DSP_BL_READY, call put_handshake(HANDSHAKE_DRIVER_READY)\n");
put_handshake(ft1000dev, HANDSHAKE_DRIVER_READY);
} else {
DEBUG("FT1000:download:Download error: Handshake failed\n");
status = STATUS_FAILURE;
}
*state = STATE_BOOT_DWNLD;
return status;
}
/* Scramble downloader for Harley based ASIC via USB interface */ /* Scramble downloader for Harley based ASIC via USB interface */
u16 scram_dnldr(struct ft1000_usb *ft1000dev, void *pFileStart, u16 scram_dnldr(struct ft1000_usb *ft1000dev, void *pFileStart,
u32 FileLength) u32 FileLength)
@ -617,29 +638,8 @@ u16 scram_dnldr(struct ft1000_usb *ft1000dev, void *pFileStart,
while ((status == STATUS_SUCCESS) && (state != STATE_DONE_FILE)) { while ((status == STATUS_SUCCESS) && (state != STATE_DONE_FILE)) {
switch (state) { switch (state) {
case STATE_START_DWNLD: case STATE_START_DWNLD:
DEBUG("FT1000:STATE_START_DWNLD\n"); status = scram_start_dwnld(ft1000dev, &handshake,
if (ft1000dev->usbboot) &state);
handshake =
get_handshake_usb(ft1000dev,
HANDSHAKE_DSP_BL_READY);
else
handshake =
get_handshake(ft1000dev,
HANDSHAKE_DSP_BL_READY);
if (handshake == HANDSHAKE_DSP_BL_READY) {
DEBUG
("scram_dnldr: handshake is HANDSHAKE_DSP_BL_READY, call put_handshake(HANDSHAKE_DRIVER_READY)\n");
put_handshake(ft1000dev,
HANDSHAKE_DRIVER_READY);
} else {
DEBUG
("FT1000:download:Download error: Handshake failed\n");
status = STATUS_FAILURE;
}
state = STATE_BOOT_DWNLD;
break; break;
case STATE_BOOT_DWNLD: case STATE_BOOT_DWNLD: