summaryrefslogtreecommitdiff
path: root/drivers/staging
diff options
context:
space:
mode:
authorKelley Nielsen <kelleynnn@gmail.com>2013-10-27 16:40:39 -0700
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-10-28 15:04:24 -0700
commiteb3836cefcc315c53ba25cb589f7b06aa962578b (patch)
tree9986395e561280019f00d6ec1cfd35ccb0d9c455 /drivers/staging
parent93b2a6c847d50a2bdcda880a8f32c462f012dca3 (diff)
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>
Diffstat (limited to 'drivers/staging')
-rw-r--r--drivers/staging/ft1000/ft1000-usb/ft1000_download.c46
1 files changed, 23 insertions, 23 deletions
diff --git a/drivers/staging/ft1000/ft1000-usb/ft1000_download.c b/drivers/staging/ft1000/ft1000-usb/ft1000_download.c
index bfffce5b1445..4ac92eea3896 100644
--- a/drivers/staging/ft1000/ft1000-usb/ft1000_download.c
+++ b/drivers/staging/ft1000/ft1000-usb/ft1000_download.c
@@ -554,6 +554,27 @@ static u32 write_blk_fifo(struct ft1000_usb *ft1000dev, u16 **pUsFile,
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 */
u16 scram_dnldr(struct ft1000_usb *ft1000dev, void *pFileStart,
u32 FileLength)
@@ -617,29 +638,8 @@ u16 scram_dnldr(struct ft1000_usb *ft1000dev, void *pFileStart,
while ((status == STATUS_SUCCESS) && (state != STATE_DONE_FILE)) {
switch (state) {
case STATE_START_DWNLD:
- DEBUG("FT1000:STATE_START_DWNLD\n");
- if (ft1000dev->usbboot)
- 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;
-
+ status = scram_start_dwnld(ft1000dev, &handshake,
+ &state);
break;
case STATE_BOOT_DWNLD: