staging: ft1000: style issues fixed in write_blk
authorKelley Nielsen <kelleynnn@gmail.com>
Tue, 29 Oct 2013 15:07:40 +0000 (08:07 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 29 Oct 2013 15:36:17 +0000 (08:36 -0700)
function write_blk, in ft1000_download.c, contains many coding style
issues. It has indentations of 3 spaces, long lines, C99 comments, and
extra whitespace. It also has a return type of u32, and changing the
returned variable in the function triggers a checkpatch leading spaces
warning. Indentation should be fixed throughout the file for
consistency.

This patch fixes those issues, in preparation for correcting the status
return type throughout the file. The variable Status has been changed
from u32 to int and renamed status.

Signed-off-by: Kelley Nielsen <kelleynnn@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/ft1000/ft1000-usb/ft1000_download.c

index e5281b97775be3816d59b34539af36ef93326917..57bd87b91e3c02e77ec6841614cf3272dc3830ef 100644 (file)
@@ -450,75 +450,66 @@ static int write_dpram32_and_check(struct ft1000_usb *ft1000dev,
  *              u8  **pUcFile - DSP image file pointer in u8
  *              long word_length - length of the buffer to be written to DPRAM
  */
-static u32 write_blk (struct ft1000_usb *ft1000dev, u16 **pUsFile, u8 **pUcFile, long word_length)
+static int write_blk(struct ft1000_usb *ft1000dev, u16 **pUsFile, u8 **pUcFile,
+               long word_length)
 {
-   u32 Status = STATUS_SUCCESS;
-   u16 dpram;
-   int loopcnt, i;
-   u16 tempword;
-   u16 tempbuffer[64];
-
-   //DEBUG("FT1000:download:start word_length = %d\n",(int)word_length);
-   dpram = (u16)DWNLD_MAG1_PS_HDR_LOC;
-   tempword = *(*pUsFile);
-   (*pUsFile)++;
-   Status = ft1000_write_dpram16(ft1000dev, dpram, tempword, 0);
-   tempword = *(*pUsFile);
-   (*pUsFile)++;
-   Status = ft1000_write_dpram16(ft1000dev, dpram++, tempword, 1);
-
-   *pUcFile = *pUcFile + 4;
-   word_length--;
-   tempword = (u16)word_length;
-   word_length = (word_length / 16) + 1;
-   for (; word_length > 0; word_length--) /* In words */
-   {
-          loopcnt = 0;
-
-             for (i=0; i<32; i++)
-             {
-                      if (tempword != 0)
-                      {
-                          tempbuffer[i++] = *(*pUsFile);
-                          (*pUsFile)++;
-                          tempbuffer[i] = *(*pUsFile);
-                          (*pUsFile)++;
-                          *pUcFile = *pUcFile + 4;
-                          loopcnt++;
-                          tempword--;
-                      }
-                      else
-                      {
-                          tempbuffer[i++] = 0;
-                          tempbuffer[i] = 0;
-                       }
-             }
-
-              //DEBUG("write_blk: loopcnt is %d\n", loopcnt);
-              //DEBUG("write_blk: bootmode = %d\n", bootmode);
-              //DEBUG("write_blk: dpram = %x\n", dpram);
-             if (ft1000dev->bootmode == 0)
-             {
-                if (dpram >= 0x3F4)
-                     Status = ft1000_write_dpram32 (ft1000dev, dpram, (u8 *)&tempbuffer[0], 8);
-                else
-                    Status = ft1000_write_dpram32 (ft1000dev, dpram, (u8 *)&tempbuffer[0], 64);
-             }
-             else
-             {
-                     Status = write_dpram32_and_check(ft1000dev, tempbuffer,
-                                     dpram);
-               if (Status != STATUS_SUCCESS)
-               {
-                    DEBUG("FT1000:download:Write failed tempbuffer[31] = 0x%x\n", tempbuffer[31]);
-                   break;
+       int status = STATUS_SUCCESS;
+       u16 dpram;
+       int loopcnt, i;
+       u16 tempword;
+       u16 tempbuffer[64];
+
+       /*DEBUG("FT1000:download:start word_length = %d\n",(int)word_length); */
+       dpram = (u16)DWNLD_MAG1_PS_HDR_LOC;
+       tempword = *(*pUsFile);
+       (*pUsFile)++;
+       status = ft1000_write_dpram16(ft1000dev, dpram, tempword, 0);
+       tempword = *(*pUsFile);
+       (*pUsFile)++;
+       status = ft1000_write_dpram16(ft1000dev, dpram++, tempword, 1);
+
+       *pUcFile = *pUcFile + 4;
+       word_length--;
+       tempword = (u16)word_length;
+       word_length = (word_length / 16) + 1;
+       for (; word_length > 0; word_length--) { /* In words */
+               loopcnt = 0;
+               for (i = 0; i < 32; i++) {
+                       if (tempword != 0) {
+                               tempbuffer[i++] = *(*pUsFile);
+                               (*pUsFile)++;
+                               tempbuffer[i] = *(*pUsFile);
+                               (*pUsFile)++;
+                               *pUcFile = *pUcFile + 4;
+                               loopcnt++;
+                               tempword--;
+                       } else {
+                               tempbuffer[i++] = 0;
+                               tempbuffer[i] = 0;
+                       }
                }
 
-            }
-            dpram = dpram + loopcnt;
-   }
-
-   return Status;
+               /*DEBUG("write_blk: loopcnt is %d\n", loopcnt); */
+               /*DEBUG("write_blk: bootmode = %d\n", bootmode); */
+               /*DEBUG("write_blk: dpram = %x\n", dpram); */
+               if (ft1000dev->bootmode == 0) {
+                       if (dpram >= 0x3F4)
+                               status = ft1000_write_dpram32(ft1000dev, dpram,
+                                               (u8 *)&tempbuffer[0], 8);
+                       else
+                               status = ft1000_write_dpram32(ft1000dev, dpram,
+                                               (u8 *)&tempbuffer[0], 64);
+               } else {
+                       status = write_dpram32_and_check(ft1000dev, tempbuffer,
+                                       dpram);
+                       if (status != STATUS_SUCCESS) {
+                               DEBUG("FT1000:download:Write failed tempbuffer[31] = 0x%x\n", tempbuffer[31]);
+                               break;
+                       }
+               }
+               dpram = dpram + loopcnt;
+       }
+       return status;
 }
 
 static void usb_dnld_complete (struct urb *urb)