linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 00/11] staging: ft1000: Various coding style cleanups.
@ 2011-01-25 13:04 Marek Belisko
  2011-01-25 13:04 ` [PATCH v2 01/11] staging: ft1000: Remove dead code Marek Belisko
                   ` (11 more replies)
  0 siblings, 12 replies; 14+ messages in thread
From: Marek Belisko @ 2011-01-25 13:04 UTC (permalink / raw)
  To: gregkh; +Cc: devel, linux-kernel, Marek Belisko

Changes from v1..v2:
- remove patch - staging: ft1000: Use common return point
- fix various alignment problems in patches:
Fix coding style in get_handshake_usb() function.
Fix coding style in get_request_type() function.
Fix coding style in get_request_type_usb() function.
Fix coding style in get_request_value() function.

Marek Belisko (11):
  staging: ft1000: Remove dead code.
  staging: ft1000: Fix coding style in check_usb_db() function.
  staging: ft1000: Fix coding style in put_handshake() function.
  staging: ft1000: Fix coding style in get_handshake_usb() function.
  staging: ft1000: Fix coding style in put_handshake_usb() function.
  staging: ft1000: Fix coding style in get_request_type() function.
  staging: ft1000: Fix coding style in get_request_type_usb() function.
  staging: ft1000: Fix coding style in get_request_value() function.
  staging: ft1000: Fix coding style in put_request_value() function.
  staging: ft1000: Fix coding style in hdr_checksum() function.
  staging: ft1000: Fix coding style in get_handshake() function.

 .../staging/ft1000/ft1000-usb/ft1000_download.c    |  487 ++++++++------------
 1 files changed, 204 insertions(+), 283 deletions(-)


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [PATCH v2 01/11] staging: ft1000: Remove dead code.
  2011-01-25 13:04 [PATCH v2 00/11] staging: ft1000: Various coding style cleanups Marek Belisko
@ 2011-01-25 13:04 ` Marek Belisko
  2011-01-25 13:04 ` [PATCH v2 02/11] staging: ft1000: Fix coding style in check_usb_db() function Marek Belisko
                   ` (10 subsequent siblings)
  11 siblings, 0 replies; 14+ messages in thread
From: Marek Belisko @ 2011-01-25 13:04 UTC (permalink / raw)
  To: gregkh; +Cc: devel, linux-kernel, Marek Belisko

Remove code which was under #if 0.

Signed-off-by: Marek Belisko <marek.belisko@open-nandra.com>
---
 .../staging/ft1000/ft1000-usb/ft1000_download.c    |   63 +-------------------
 1 files changed, 1 insertions(+), 62 deletions(-)

diff --git a/drivers/staging/ft1000/ft1000-usb/ft1000_download.c b/drivers/staging/ft1000/ft1000-usb/ft1000_download.c
index 17546d8..0ee80b5 100644
--- a/drivers/staging/ft1000/ft1000-usb/ft1000_download.c
+++ b/drivers/staging/ft1000/ft1000-usb/ft1000_download.c
@@ -168,18 +168,6 @@ static u32 check_usb_db (struct ft1000_device *ft1000dev)
          DEBUG("check_usb_db: door bell is cleared, return 0\n");
          return 0;
       }
-#if 0
-      // Check if Card is present
-      status = ft1000_read_register (ft1000dev, &temp, FT1000_REG_SUP_IMASK);
-      if (temp == 0x0000) {
-          break;
-      }
-
-      status = ft1000_read_register (ft1000dev, &temp, FT1000_REG_ASIC_ID);
-      if (temp == 0xffff) {
-         break;
-      }
-#endif
    }
 
    return HANDSHAKE_MAG_TIMEOUT_VALUE;
@@ -446,34 +434,6 @@ static long get_request_value(struct ft1000_device *ft1000dev)
 
 }
 
-#if 0
-static long get_request_value_usb(struct ft1000_device *ft1000dev)
-{
-   u32     value;
-   u16   tempword;
-   u32    status;
-   struct ft1000_info * pft1000info = netdev_priv(ft1000dev->net);
-
-       if (pft1000info->usbboot == 2) {
-          value = pft1000info->tempbuf[4];
-          tempword = pft1000info->tempbuf[5];
-       }
-       else {
-          value = 0;
-          status = ft1000_read_dpram16(ft1000dev, DWNLD_MAG1_SIZE_LOC, (u8 *)&tempword, 1);
-       }
-
-       value |= (tempword << 16);
-       value = ntohl(value);
-
-   if (pft1000info->usbboot == 1)
-       pft1000info->usbboot = 2;
-
-   //DEBUG("get_request_value_usb: value is %x\n", value);
-   return value;
-
-}
-#endif
 
 //---------------------------------------------------------------------------
 // Function:    put_request_value
@@ -723,22 +683,7 @@ static u32 write_blk_fifo (struct ft1000_device *ft1000dev, u16 **pUsFile, u8 **
    if (byte_length < 64)
        byte_length = 68;
 
-#if 0
-   pblk = kzalloc(byte_length, GFP_KERNEL);
-   memcpy (pblk, *pUcFile, byte_length);
-
-   pipe = usb_sndbulkpipe (ft1000dev->dev, ft1000dev->bulk_out_endpointAddr);
 
-   Status = usb_bulk_msg (ft1000dev->dev,
-                          pipe,
-                          pblk,
-                          byte_length,
-                          &cnt,
-                          10);
-   DEBUG("write_blk_fifo Status = 0x%8x Bytes Transfer = %d Data = 0x%x\n", Status, cnt, *pblk);
-
-   kfree(pblk);
-#else
     usb_init_urb(ft1000dev->tx_urb);
     memcpy (ft1000dev->tx_buf, *pUcFile, byte_length);
     usb_fill_bulk_urb(ft1000dev->tx_urb,
@@ -750,7 +695,6 @@ static u32 write_blk_fifo (struct ft1000_device *ft1000dev, u16 **pUsFile, u8 **
                       (void*)ft1000dev);
 
     usb_submit_urb(ft1000dev->tx_urb, GFP_ATOMIC);
-#endif
 
    *pUsFile = *pUsFile + (word_length << 1);
    *pUcFile = *pUcFile + (word_length << 2);
@@ -1000,15 +944,10 @@ u16 scram_dnldr(struct ft1000_device *ft1000dev, void *pFileStart, u32  FileLeng
                   status = STATUS_FAILURE;
                   break;
                }
-#if 0
-               word_length = get_request_value_usb(ft1000dev);
-               //DEBUG("FT1000:download:word_length = %d\n", (int)word_length);
-               if (word_length > MAX_LENGTH/2)
-#else
+
                word_length = get_request_value(ft1000dev);
                //DEBUG("FT1000:download:word_length = %d\n", (int)word_length);
                if (word_length > MAX_LENGTH)
-#endif
                {
                   DEBUG("FT1000:download:Download error: Max length exceeded\n");
                   status = STATUS_FAILURE;
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH v2 02/11] staging: ft1000: Fix coding style in check_usb_db() function.
  2011-01-25 13:04 [PATCH v2 00/11] staging: ft1000: Various coding style cleanups Marek Belisko
  2011-01-25 13:04 ` [PATCH v2 01/11] staging: ft1000: Remove dead code Marek Belisko
@ 2011-01-25 13:04 ` Marek Belisko
  2011-01-25 13:04 ` [PATCH v2 03/11] staging: ft1000: Fix coding style in put_handshake() function Marek Belisko
                   ` (9 subsequent siblings)
  11 siblings, 0 replies; 14+ messages in thread
From: Marek Belisko @ 2011-01-25 13:04 UTC (permalink / raw)
  To: gregkh; +Cc: devel, linux-kernel, Marek Belisko

Signed-off-by: Marek Belisko <marek.belisko@open-nandra.com>
---
 .../staging/ft1000/ft1000-usb/ft1000_download.c    |   89 +++++++++----------
 1 files changed, 42 insertions(+), 47 deletions(-)

diff --git a/drivers/staging/ft1000/ft1000-usb/ft1000_download.c b/drivers/staging/ft1000/ft1000-usb/ft1000_download.c
index 0ee80b5..03694db 100644
--- a/drivers/staging/ft1000/ft1000-usb/ft1000_download.c
+++ b/drivers/staging/ft1000/ft1000-usb/ft1000_download.c
@@ -125,53 +125,48 @@ struct dsp_image_info {
 //---------------------------------------------------------------------------
 static u32 check_usb_db (struct ft1000_device *ft1000dev)
 {
-   int               loopcnt;
-   u16            temp;
-   u32             status;
-
-   loopcnt = 0;
-   while (loopcnt < 10)
-   {
-
-      status = ft1000_read_register (ft1000dev, &temp, FT1000_REG_DOORBELL);
-      DEBUG("check_usb_db: read FT1000_REG_DOORBELL value is %x\n", temp);
-      if (temp & 0x0080)
-      {
-           DEBUG("FT1000:Got checkusb doorbell\n");
-           status = ft1000_write_register (ft1000dev, 0x0080, FT1000_REG_DOORBELL);
-           status = ft1000_write_register (ft1000dev, 0x0100, FT1000_REG_DOORBELL);
-           status = ft1000_write_register (ft1000dev,  0x8000, FT1000_REG_DOORBELL);
-           break;
-      }
-      else
-      {
-           loopcnt++;
-           msleep (10);
-      }
-
-   } //end of while
-
-
-   loopcnt = 0;
-   while (loopcnt < 20)
-   {
-
-      status = ft1000_read_register (ft1000dev, &temp, FT1000_REG_DOORBELL);
-      DEBUG("FT1000:check_usb_db:Doorbell = 0x%x\n", temp);
-      if (temp & 0x8000)
-      {
-         loopcnt++;
-         msleep (10);
-      }
-      else
-      {
-         DEBUG("check_usb_db: door bell is cleared, return 0\n");
-         return 0;
-      }
-   }
+	int loopcnt;
+	u16 temp;
+	u32 status;
+
+	loopcnt = 0;
+
+	while (loopcnt < 10) {
+		status = ft1000_read_register(ft1000dev, &temp,
+					       FT1000_REG_DOORBELL);
+		DEBUG("check_usb_db: read FT1000_REG_DOORBELL value is %x\n",
+		       temp);
+		if (temp & 0x0080) {
+			DEBUG("FT1000:Got checkusb doorbell\n");
+			status = ft1000_write_register(ft1000dev, 0x0080,
+						FT1000_REG_DOORBELL);
+			status = ft1000_write_register(ft1000dev, 0x0100,
+						FT1000_REG_DOORBELL);
+			status = ft1000_write_register(ft1000dev,  0x8000,
+						FT1000_REG_DOORBELL);
+			break;
+		} else {
+			loopcnt++;
+			msleep(10);
+		}
 
-   return HANDSHAKE_MAG_TIMEOUT_VALUE;
+	}
+
+	loopcnt = 0;
+	while (loopcnt < 20) {
+		status = ft1000_read_register(ft1000dev, &temp,
+					       FT1000_REG_DOORBELL);
+		DEBUG("FT1000:check_usb_db:Doorbell = 0x%x\n", temp);
+		if (temp & 0x8000) {
+			loopcnt++;
+			msleep(10);
+		} else	{
+			DEBUG("check_usb_db: door bell is cleared, return 0\n");
+			return 0;
+		}
+	}
 
+	return HANDSHAKE_MAG_TIMEOUT_VALUE;
 }
 
 //---------------------------------------------------------------------------
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH v2 03/11] staging: ft1000: Fix coding style in put_handshake() function.
  2011-01-25 13:04 [PATCH v2 00/11] staging: ft1000: Various coding style cleanups Marek Belisko
  2011-01-25 13:04 ` [PATCH v2 01/11] staging: ft1000: Remove dead code Marek Belisko
  2011-01-25 13:04 ` [PATCH v2 02/11] staging: ft1000: Fix coding style in check_usb_db() function Marek Belisko
@ 2011-01-25 13:04 ` Marek Belisko
  2011-01-25 13:04 ` [PATCH v2 04/11] staging: ft1000: Fix coding style in get_handshake_usb() function Marek Belisko
                   ` (8 subsequent siblings)
  11 siblings, 0 replies; 14+ messages in thread
From: Marek Belisko @ 2011-01-25 13:04 UTC (permalink / raw)
  To: gregkh; +Cc: devel, linux-kernel, Marek Belisko

Signed-off-by: Marek Belisko <marek.belisko@open-nandra.com>
---
 .../staging/ft1000/ft1000-usb/ft1000_download.c    |   27 ++++++++++---------
 1 files changed, 14 insertions(+), 13 deletions(-)

diff --git a/drivers/staging/ft1000/ft1000-usb/ft1000_download.c b/drivers/staging/ft1000/ft1000-usb/ft1000_download.c
index 03694db..1472943 100644
--- a/drivers/staging/ft1000/ft1000-usb/ft1000_download.c
+++ b/drivers/staging/ft1000/ft1000-usb/ft1000_download.c
@@ -254,20 +254,21 @@ static u16 get_handshake(struct ft1000_device *ft1000dev, u16 expected_value)
 //---------------------------------------------------------------------------
 static void put_handshake(struct ft1000_device *ft1000dev,u16 handshake_value)
 {
-    u32 tempx;
-    u16 tempword;
-    u32 status;
-
-
-
-        tempx = (u32)handshake_value;
-        tempx = ntohl(tempx);
+	u32 tempx;
+	u16 tempword;
+	u32 status;
 
-        tempword = (u16)(tempx & 0xffff);
-        status = ft1000_write_dpram16 (ft1000dev, DWNLD_MAG1_HANDSHAKE_LOC, tempword, 0);
-        tempword = (u16)(tempx >> 16);
-        status = ft1000_write_dpram16 (ft1000dev, DWNLD_MAG1_HANDSHAKE_LOC, tempword, 1);
-        status = ft1000_write_register(ft1000dev, FT1000_DB_DNLD_TX, FT1000_REG_DOORBELL);
+	tempx = (u32)handshake_value;
+	tempx = ntohl(tempx);
+
+	tempword = (u16)(tempx & 0xffff);
+	status = ft1000_write_dpram16(ft1000dev, DWNLD_MAG1_HANDSHAKE_LOC,
+					tempword, 0);
+	tempword = (u16)(tempx >> 16);
+	status = ft1000_write_dpram16(ft1000dev, DWNLD_MAG1_HANDSHAKE_LOC,
+					tempword, 1);
+	status = ft1000_write_register(ft1000dev, FT1000_DB_DNLD_TX,
+					FT1000_REG_DOORBELL);
 }
 
 static u16 get_handshake_usb(struct ft1000_device *ft1000dev, u16 expected_value)
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH v2 04/11] staging: ft1000: Fix coding style in get_handshake_usb() function.
  2011-01-25 13:04 [PATCH v2 00/11] staging: ft1000: Various coding style cleanups Marek Belisko
                   ` (2 preceding siblings ...)
  2011-01-25 13:04 ` [PATCH v2 03/11] staging: ft1000: Fix coding style in put_handshake() function Marek Belisko
@ 2011-01-25 13:04 ` Marek Belisko
  2011-01-25 13:05 ` [PATCH v2 05/11] staging: ft1000: Fix coding style in put_handshake_usb() function Marek Belisko
                   ` (7 subsequent siblings)
  11 siblings, 0 replies; 14+ messages in thread
From: Marek Belisko @ 2011-01-25 13:04 UTC (permalink / raw)
  To: gregkh; +Cc: devel, linux-kernel, Marek Belisko

Signed-off-by: Marek Belisko <marek.belisko@open-nandra.com>
---
 .../staging/ft1000/ft1000-usb/ft1000_download.c    |   74 +++++++++++---------
 1 files changed, 41 insertions(+), 33 deletions(-)

diff --git a/drivers/staging/ft1000/ft1000-usb/ft1000_download.c b/drivers/staging/ft1000/ft1000-usb/ft1000_download.c
index 1472943..07604a7 100644
--- a/drivers/staging/ft1000/ft1000-usb/ft1000_download.c
+++ b/drivers/staging/ft1000/ft1000-usb/ft1000_download.c
@@ -273,42 +273,50 @@ static void put_handshake(struct ft1000_device *ft1000dev,u16 handshake_value)
 
 static u16 get_handshake_usb(struct ft1000_device *ft1000dev, u16 expected_value)
 {
-   u16            handshake;
-   int               loopcnt;
-   u16            temp;
-   u32             status=0;
+	u16 handshake
+	int loopcnt;
+	u16 temp;
+	u32 status = 0;
 
 	struct ft1000_info *pft1000info = netdev_priv(ft1000dev->net);
-   loopcnt = 0;
-   handshake = 0;
-   while (loopcnt < 100)
-   {
-       if (pft1000info->usbboot == 2) {
-           status = ft1000_read_dpram32 (ft1000dev, 0, (u8 *)&(pft1000info->tempbuf[0]), 64);
-           for (temp=0; temp<16; temp++)
-               DEBUG("tempbuf %d = 0x%x\n", temp, pft1000info->tempbuf[temp]);
-           status = ft1000_read_dpram16 (ft1000dev, DWNLD_MAG1_HANDSHAKE_LOC, (u8 *)&handshake, 1);
-           DEBUG("handshake from read_dpram16 = 0x%x\n", handshake);
-           if (pft1000info->dspalive == pft1000info->tempbuf[6])
-               handshake = 0;
-           else {
-               handshake = pft1000info->tempbuf[1];
-               pft1000info->dspalive = pft1000info->tempbuf[6];
-           }
-       }
-       else {
-           status = ft1000_read_dpram16 (ft1000dev, DWNLD_MAG1_HANDSHAKE_LOC, (u8 *)&handshake, 1);
-       }
-       loopcnt++;
-       msleep(10);
-       handshake = ntohs(handshake);
-       if ((handshake == expected_value) || (handshake == HANDSHAKE_RESET_VALUE_USB))
-       {
-           return handshake;
-       }
-   }
+	loopcnt = 0;
+	handshake = 0;
+
+	while (loopcnt < 100) {
+		if (pft1000info->usbboot == 2) {
+			status = ft1000_read_dpram32(ft1000dev, 0,
+					(u8 *)&(pft1000info->tempbuf[0]), 64);
+			for (temp = 0; temp < 16; temp++) {
+				DEBUG("tempbuf %d = 0x%x\n", temp,
+					pft1000info->tempbuf[temp]);
+			}
+			status = ft1000_read_dpram16(ft1000dev,
+						DWNLD_MAG1_HANDSHAKE_LOC,
+						(u8 *)&handshake, 1);
+			DEBUG("handshake from read_dpram16 = 0x%x\n",
+				handshake);
+			if (pft1000info->dspalive == pft1000info->tempbuf[6]) {
+				handshake = 0;
+			} else {
+				handshake = pft1000info->tempbuf[1];
+				pft1000info->dspalive =
+						pft1000info->tempbuf[6];
+			}
+		} else {
+			status = ft1000_read_dpram16(ft1000dev,
+						DWNLD_MAG1_HANDSHAKE_LOC,
+						(u8 *)&handshake, 1);
+		}
 
-   return HANDSHAKE_TIMEOUT_VALUE;
+		loopcnt++;
+		msleep(10);
+		handshake = ntohs(handshake);
+		if ((handshake == expected_value) ||
+		    (handshake == HANDSHAKE_RESET_VALUE_USB))
+			return handshake;
+	}
+
+	return HANDSHAKE_TIMEOUT_VALUE;
 }
 
 static void put_handshake_usb(struct ft1000_device *ft1000dev,u16 handshake_value)
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH v2 05/11] staging: ft1000: Fix coding style in put_handshake_usb() function.
  2011-01-25 13:04 [PATCH v2 00/11] staging: ft1000: Various coding style cleanups Marek Belisko
                   ` (3 preceding siblings ...)
  2011-01-25 13:04 ` [PATCH v2 04/11] staging: ft1000: Fix coding style in get_handshake_usb() function Marek Belisko
@ 2011-01-25 13:05 ` Marek Belisko
  2011-01-25 13:05 ` [PATCH v2 06/11] staging: ft1000: Fix coding style in get_request_type() function Marek Belisko
                   ` (6 subsequent siblings)
  11 siblings, 0 replies; 14+ messages in thread
From: Marek Belisko @ 2011-01-25 13:05 UTC (permalink / raw)
  To: gregkh; +Cc: devel, linux-kernel, Marek Belisko

Signed-off-by: Marek Belisko <marek.belisko@open-nandra.com>
---
 .../staging/ft1000/ft1000-usb/ft1000_download.c    |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/staging/ft1000/ft1000-usb/ft1000_download.c b/drivers/staging/ft1000/ft1000-usb/ft1000_download.c
index 07604a7..1e442fc 100644
--- a/drivers/staging/ft1000/ft1000-usb/ft1000_download.c
+++ b/drivers/staging/ft1000/ft1000-usb/ft1000_download.c
@@ -321,7 +321,7 @@ static u16 get_handshake_usb(struct ft1000_device *ft1000dev, u16 expected_value
 
 static void put_handshake_usb(struct ft1000_device *ft1000dev,u16 handshake_value)
 {
-   int i;
+	int i;
 
         for (i=0; i<1000; i++);
 }
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH v2 06/11] staging: ft1000: Fix coding style in get_request_type() function.
  2011-01-25 13:04 [PATCH v2 00/11] staging: ft1000: Various coding style cleanups Marek Belisko
                   ` (4 preceding siblings ...)
  2011-01-25 13:05 ` [PATCH v2 05/11] staging: ft1000: Fix coding style in put_handshake_usb() function Marek Belisko
@ 2011-01-25 13:05 ` Marek Belisko
  2011-01-25 13:05 ` [PATCH v2 07/11] staging: ft1000: Fix coding style in get_request_type_usb() function Marek Belisko
                   ` (5 subsequent siblings)
  11 siblings, 0 replies; 14+ messages in thread
From: Marek Belisko @ 2011-01-25 13:05 UTC (permalink / raw)
  To: gregkh; +Cc: devel, linux-kernel, Marek Belisko

Signed-off-by: Marek Belisko <marek.belisko@open-nandra.com>
---
 .../staging/ft1000/ft1000-usb/ft1000_download.c    |   38 +++++++++-----------
 1 files changed, 17 insertions(+), 21 deletions(-)

diff --git a/drivers/staging/ft1000/ft1000-usb/ft1000_download.c b/drivers/staging/ft1000/ft1000-usb/ft1000_download.c
index 1e442fc..f87b927 100644
--- a/drivers/staging/ft1000/ft1000-usb/ft1000_download.c
+++ b/drivers/staging/ft1000/ft1000-usb/ft1000_download.c
@@ -340,30 +340,26 @@ static void put_handshake_usb(struct ft1000_device *ft1000dev,u16 handshake_valu
 //---------------------------------------------------------------------------
 static u16 get_request_type(struct ft1000_device *ft1000dev)
 {
-   u16   request_type;
-   u32    status;
-   u16   tempword;
-   u32    tempx;
+	u16 request_type;
+	u32 status;
+	u16 tempword;
+	u32 tempx;
 	struct ft1000_info *pft1000info = netdev_priv(ft1000dev->net);
 
-   if ( pft1000info->bootmode == 1)
-   {
-       status = fix_ft1000_read_dpram32 (ft1000dev, DWNLD_MAG1_TYPE_LOC, (u8 *)&tempx);
-       tempx = ntohl(tempx);
-   }
-   else
-   {
-       tempx = 0;
-
-       status = ft1000_read_dpram16 (ft1000dev, DWNLD_MAG1_TYPE_LOC, (u8 *)&tempword, 1);
-       tempx |= (tempword << 16);
-       tempx = ntohl(tempx);
-   }
-   request_type = (u16)tempx;
-
-   //DEBUG("get_request_type: request_type is %x\n", request_type);
-   return request_type;
+	if (pft1000info->bootmode == 1) {
+		status = fix_ft1000_read_dpram32(ft1000dev,
+				DWNLD_MAG1_TYPE_LOC, (u8 *)&tempx);
+		tempx = ntohl(tempx);
+	} else {
+		tempx = 0;
+		status = ft1000_read_dpram16(ft1000dev,
+				DWNLD_MAG1_TYPE_LOC, (u8 *)&tempword, 1);
+		tempx |= (tempword << 16);
+		tempx = ntohl(tempx);
+	}
+	request_type = (u16)tempx;
 
+	return request_type;
 }
 
 static u16 get_request_type_usb(struct ft1000_device *ft1000dev)
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH v2 07/11] staging: ft1000: Fix coding style in get_request_type_usb() function.
  2011-01-25 13:04 [PATCH v2 00/11] staging: ft1000: Various coding style cleanups Marek Belisko
                   ` (5 preceding siblings ...)
  2011-01-25 13:05 ` [PATCH v2 06/11] staging: ft1000: Fix coding style in get_request_type() function Marek Belisko
@ 2011-01-25 13:05 ` Marek Belisko
  2011-01-25 13:05 ` [PATCH v2 08/11] staging: ft1000: Fix coding style in get_request_value() function Marek Belisko
                   ` (4 subsequent siblings)
  11 siblings, 0 replies; 14+ messages in thread
From: Marek Belisko @ 2011-01-25 13:05 UTC (permalink / raw)
  To: gregkh; +Cc: devel, linux-kernel, Marek Belisko

Signed-off-by: Marek Belisko <marek.belisko@open-nandra.com>
---
 .../staging/ft1000/ft1000-usb/ft1000_download.c    |   48 +++++++++----------
 1 files changed, 23 insertions(+), 25 deletions(-)

diff --git a/drivers/staging/ft1000/ft1000-usb/ft1000_download.c b/drivers/staging/ft1000/ft1000-usb/ft1000_download.c
index f87b927..3385eac 100644
--- a/drivers/staging/ft1000/ft1000-usb/ft1000_download.c
+++ b/drivers/staging/ft1000/ft1000-usb/ft1000_download.c
@@ -364,34 +364,32 @@ static u16 get_request_type(struct ft1000_device *ft1000dev)
 
 static u16 get_request_type_usb(struct ft1000_device *ft1000dev)
 {
-   u16   request_type;
-   u32    status;
-   u16   tempword;
-   u32    tempx;
+	u16 request_type;
+	u32 status;
+	u16 tempword;
+	u32 tempx;
 	struct ft1000_info *pft1000info = netdev_priv(ft1000dev->net);
-   if ( pft1000info->bootmode == 1)
-   {
-       status = fix_ft1000_read_dpram32 (ft1000dev, DWNLD_MAG1_TYPE_LOC, (u8 *)&tempx);
-       tempx = ntohl(tempx);
-   }
-   else
-   {
-       if (pft1000info->usbboot == 2) {
-          tempx = pft1000info->tempbuf[2];
-          tempword = pft1000info->tempbuf[3];
-       }
-       else {
-          tempx = 0;
-          status = ft1000_read_dpram16 (ft1000dev, DWNLD_MAG1_TYPE_LOC, (u8 *)&tempword, 1);
-       }
-       tempx |= (tempword << 16);
-       tempx = ntohl(tempx);
-   }
-   request_type = (u16)tempx;
 
-   //DEBUG("get_request_type: request_type is %x\n", request_type);
-   return request_type;
+	if (pft1000info->bootmode == 1) {
+		status = fix_ft1000_read_dpram32(ft1000dev,
+				DWNLD_MAG1_TYPE_LOC, (u8 *)&tempx);
+		tempx = ntohl(tempx);
+	} else {
+		if (pft1000info->usbboot == 2) {
+			tempx = pft1000info->tempbuf[2];
+			tempword = pft1000info->tempbuf[3];
+		} else {
+			tempx = 0;
+			status = ft1000_read_dpram16(ft1000dev,
+					DWNLD_MAG1_TYPE_LOC,
+					(u8 *)&tempword, 1);
+		}
+		tempx |= (tempword << 16);
+		tempx = ntohl(tempx);
+	}
+	request_type = (u16)tempx;
 
+	return request_type;
 }
 
 //---------------------------------------------------------------------------
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH v2 08/11] staging: ft1000: Fix coding style in get_request_value() function.
  2011-01-25 13:04 [PATCH v2 00/11] staging: ft1000: Various coding style cleanups Marek Belisko
                   ` (6 preceding siblings ...)
  2011-01-25 13:05 ` [PATCH v2 07/11] staging: ft1000: Fix coding style in get_request_type_usb() function Marek Belisko
@ 2011-01-25 13:05 ` Marek Belisko
  2011-01-25 13:05 ` [PATCH v2 09/11] staging: ft1000: Fix coding style in put_request_value() function Marek Belisko
                   ` (3 subsequent siblings)
  11 siblings, 0 replies; 14+ messages in thread
From: Marek Belisko @ 2011-01-25 13:05 UTC (permalink / raw)
  To: gregkh; +Cc: devel, linux-kernel, Marek Belisko

Signed-off-by: Marek Belisko <marek.belisko@open-nandra.com>
---
 .../staging/ft1000/ft1000-usb/ft1000_download.c    |   38 +++++++++-----------
 1 files changed, 17 insertions(+), 21 deletions(-)

diff --git a/drivers/staging/ft1000/ft1000-usb/ft1000_download.c b/drivers/staging/ft1000/ft1000-usb/ft1000_download.c
index 3385eac..b34429c 100644
--- a/drivers/staging/ft1000/ft1000-usb/ft1000_download.c
+++ b/drivers/staging/ft1000/ft1000-usb/ft1000_download.c
@@ -406,30 +406,26 @@ static u16 get_request_type_usb(struct ft1000_device *ft1000dev)
 //---------------------------------------------------------------------------
 static long get_request_value(struct ft1000_device *ft1000dev)
 {
-   u32     value;
-   u16   tempword;
-   u32    status;
+	u32 value;
+	u16 tempword;
+	u32 status;
 	struct ft1000_info *pft1000info = netdev_priv(ft1000dev->net);
 
+	if (pft1000info->bootmode == 1) {
+		status = fix_ft1000_read_dpram32(ft1000dev,
+				DWNLD_MAG1_SIZE_LOC, (u8 *)&value);
+		value = ntohl(value);
+	} else	{
+		status = ft1000_read_dpram16(ft1000dev,
+				DWNLD_MAG1_SIZE_LOC, (u8 *)&tempword, 0);
+		value = tempword;
+		status = ft1000_read_dpram16(ft1000dev,
+				DWNLD_MAG1_SIZE_LOC, (u8 *)&tempword, 1);
+		value |= (tempword << 16);
+		value = ntohl(value);
+	}
 
-       if ( pft1000info->bootmode == 1)
-       {
-	   status = fix_ft1000_read_dpram32(ft1000dev, DWNLD_MAG1_SIZE_LOC, (u8 *)&value);
-	   value = ntohl(value);
-       }
-       else
-       {
-	   status = ft1000_read_dpram16(ft1000dev, DWNLD_MAG1_SIZE_LOC, (u8 *)&tempword, 0);
-	   value = tempword;
-           status = ft1000_read_dpram16(ft1000dev, DWNLD_MAG1_SIZE_LOC, (u8 *)&tempword, 1);
-	   value |= (tempword << 16);
-	   value = ntohl(value);
-       }
-
-
-   //DEBUG("get_request_value: value is %x\n", value);
-   return value;
-
+	return value;
 }
 
 
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH v2 09/11] staging: ft1000: Fix coding style in put_request_value() function.
  2011-01-25 13:04 [PATCH v2 00/11] staging: ft1000: Various coding style cleanups Marek Belisko
                   ` (7 preceding siblings ...)
  2011-01-25 13:05 ` [PATCH v2 08/11] staging: ft1000: Fix coding style in get_request_value() function Marek Belisko
@ 2011-01-25 13:05 ` Marek Belisko
  2011-01-25 15:23   ` Alexey Dobriyan
  2011-01-25 13:05 ` [PATCH v2 10/11] staging: ft1000: Fix coding style in hdr_checksum() function Marek Belisko
                   ` (2 subsequent siblings)
  11 siblings, 1 reply; 14+ messages in thread
From: Marek Belisko @ 2011-01-25 13:05 UTC (permalink / raw)
  To: gregkh; +Cc: devel, linux-kernel, Marek Belisko

Signed-off-by: Marek Belisko <marek.belisko@open-nandra.com>
---
 .../staging/ft1000/ft1000-usb/ft1000_download.c    |   14 +++++---------
 1 files changed, 5 insertions(+), 9 deletions(-)

diff --git a/drivers/staging/ft1000/ft1000-usb/ft1000_download.c b/drivers/staging/ft1000/ft1000-usb/ft1000_download.c
index b34429c..9167210 100644
--- a/drivers/staging/ft1000/ft1000-usb/ft1000_download.c
+++ b/drivers/staging/ft1000/ft1000-usb/ft1000_download.c
@@ -444,16 +444,12 @@ static long get_request_value(struct ft1000_device *ft1000dev)
 //---------------------------------------------------------------------------
 static void put_request_value(struct ft1000_device *ft1000dev, long lvalue)
 {
-   u32    tempx;
-   u32    status;
-
-       tempx = ntohl(lvalue);
-       status = fix_ft1000_write_dpram32(ft1000dev, DWNLD_MAG1_SIZE_LOC, (u8 *)&tempx);
-
-
-
-   //DEBUG("put_request_value: value is %x\n", lvalue);
+	u32    tempx;
+	u32    status;
 
+	tempx = ntohl(lvalue);
+	status = fix_ft1000_write_dpram32(ft1000dev, DWNLD_MAG1_SIZE_LOC,
+					  (u8 *)&tempx);
 }
 
 
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH v2 10/11] staging: ft1000: Fix coding style in hdr_checksum() function.
  2011-01-25 13:04 [PATCH v2 00/11] staging: ft1000: Various coding style cleanups Marek Belisko
                   ` (8 preceding siblings ...)
  2011-01-25 13:05 ` [PATCH v2 09/11] staging: ft1000: Fix coding style in put_request_value() function Marek Belisko
@ 2011-01-25 13:05 ` Marek Belisko
  2011-01-25 13:05 ` [PATCH v2 11/11] staging: ft1000: Fix coding style in get_handshake() function Marek Belisko
  2011-01-25 13:32 ` [PATCH v2 00/11] staging: ft1000: Various coding style cleanups Dan Carpenter
  11 siblings, 0 replies; 14+ messages in thread
From: Marek Belisko @ 2011-01-25 13:05 UTC (permalink / raw)
  To: gregkh; +Cc: devel, linux-kernel, Marek Belisko

Signed-off-by: Marek Belisko <marek.belisko@open-nandra.com>
---
 .../staging/ft1000/ft1000-usb/ft1000_download.c    |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/ft1000/ft1000-usb/ft1000_download.c b/drivers/staging/ft1000/ft1000-usb/ft1000_download.c
index 9167210..7ebb683 100644
--- a/drivers/staging/ft1000/ft1000-usb/ft1000_download.c
+++ b/drivers/staging/ft1000/ft1000-usb/ft1000_download.c
@@ -468,14 +468,14 @@ static void put_request_value(struct ft1000_device *ft1000dev, long lvalue)
 //---------------------------------------------------------------------------
 static u16 hdr_checksum(struct pseudo_hdr *pHdr)
 {
-   u16   *usPtr = (u16 *)pHdr;
-   u16   chksum;
+	u16   *usPtr = (u16 *)pHdr;
+	u16   chksum;
 
 
-  chksum = ((((((usPtr[0] ^ usPtr[1]) ^ usPtr[2]) ^ usPtr[3]) ^
-                    usPtr[4]) ^ usPtr[5]) ^ usPtr[6]);
+	chksum = ((((((usPtr[0] ^ usPtr[1]) ^ usPtr[2]) ^ usPtr[3]) ^
+	usPtr[4]) ^ usPtr[5]) ^ usPtr[6]);
 
-  return chksum;
+	return chksum;
 }
 
 
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH v2 11/11] staging: ft1000: Fix coding style in get_handshake() function.
  2011-01-25 13:04 [PATCH v2 00/11] staging: ft1000: Various coding style cleanups Marek Belisko
                   ` (9 preceding siblings ...)
  2011-01-25 13:05 ` [PATCH v2 10/11] staging: ft1000: Fix coding style in hdr_checksum() function Marek Belisko
@ 2011-01-25 13:05 ` Marek Belisko
  2011-01-25 13:32 ` [PATCH v2 00/11] staging: ft1000: Various coding style cleanups Dan Carpenter
  11 siblings, 0 replies; 14+ messages in thread
From: Marek Belisko @ 2011-01-25 13:05 UTC (permalink / raw)
  To: gregkh; +Cc: devel, linux-kernel, Marek Belisko

Signed-off-by: Marek Belisko <marek.belisko@open-nandra.com>
---
 .../staging/ft1000/ft1000-usb/ft1000_download.c    |   90 +++++++++-----------
 1 files changed, 41 insertions(+), 49 deletions(-)

diff --git a/drivers/staging/ft1000/ft1000-usb/ft1000_download.c b/drivers/staging/ft1000/ft1000-usb/ft1000_download.c
index 7ebb683..05f3e22 100644
--- a/drivers/staging/ft1000/ft1000-usb/ft1000_download.c
+++ b/drivers/staging/ft1000/ft1000-usb/ft1000_download.c
@@ -185,57 +185,49 @@ static u32 check_usb_db (struct ft1000_device *ft1000dev)
 //---------------------------------------------------------------------------
 static u16 get_handshake(struct ft1000_device *ft1000dev, u16 expected_value)
 {
-   u16            handshake;
-   int               loopcnt;
-   u32             status=0;
+	u16 handshake;
+	int loopcnt;
+	u32 status = 0;
 	struct ft1000_info *pft1000info = netdev_priv(ft1000dev->net);
 
-   loopcnt = 0;
-   while (loopcnt < 100)
-   {
+	loopcnt = 0;
 
-           // Need to clear downloader doorbell if Hartley ASIC
-           status = ft1000_write_register (ft1000dev,  FT1000_DB_DNLD_RX, FT1000_REG_DOORBELL);
-           //DEBUG("FT1000:get_handshake:doorbell = 0x%x\n", temp);
-               if (pft1000info->fcodeldr)
-               {
-                   DEBUG(" get_handshake: fcodeldr is %d\n", pft1000info->fcodeldr);
-                   pft1000info->fcodeldr = 0;
-                   status = check_usb_db(ft1000dev);
-                   if (status != STATUS_SUCCESS)
-                   {
-                       DEBUG("get_handshake: check_usb_db failed\n");
-                       status = STATUS_FAILURE;
-                       break;
-                   }
-                   status = ft1000_write_register (ft1000dev,  FT1000_DB_DNLD_RX, FT1000_REG_DOORBELL);
-               }
+	while (loopcnt < 100) {
+		/* Need to clear downloader doorbell if Hartley ASIC */
+		status = ft1000_write_register(ft1000dev,  FT1000_DB_DNLD_RX,
+						FT1000_REG_DOORBELL);
+		if (pft1000info->fcodeldr) {
+			DEBUG(" get_handshake: fcodeldr is %d\n",
+				pft1000info->fcodeldr);
+			pft1000info->fcodeldr = 0;
+			status = check_usb_db(ft1000dev);
+			if (status != STATUS_SUCCESS) {
+				DEBUG("get_handshake: check_usb_db failed\n");
+				status = STATUS_FAILURE;
+				break;
+			}
+			status = ft1000_write_register(ft1000dev,
+					FT1000_DB_DNLD_RX,
+					FT1000_REG_DOORBELL);
+		}
 
-                status = ft1000_read_dpram16 (ft1000dev, DWNLD_MAG1_HANDSHAKE_LOC, (u8 *)&handshake, 1);
-                //DEBUG("get_handshake: handshake is %x\n", tempx);
-                handshake = ntohs(handshake);
-                //DEBUG("get_handshake: after swap, handshake is %x\n", handshake);
-
-        if (status)
-           return HANDSHAKE_TIMEOUT_VALUE;
-
-        //DEBUG("get_handshake: handshake= %x\n", handshake);
-        if ((handshake == expected_value) || (handshake == HANDSHAKE_RESET_VALUE_USB))
-        {
-            //DEBUG("get_handshake: return handshake %x\n", handshake);
-            return handshake;
-        }
-        else
-        {
-            loopcnt++;
-            msleep (10);
-        }
-        //DEBUG("HANDSHKE LOOP: %d\n", loopcnt);
+		status = ft1000_read_dpram16(ft1000dev,
+				DWNLD_MAG1_HANDSHAKE_LOC, (u8 *)&handshake, 1);
+		handshake = ntohs(handshake);
 
-   }
+		if (status)
+			return HANDSHAKE_TIMEOUT_VALUE;
 
-   //DEBUG("get_handshake: return handshake time out\n");
-   return HANDSHAKE_TIMEOUT_VALUE;
+		if ((handshake == expected_value) ||
+		    (handshake == HANDSHAKE_RESET_VALUE_USB)) {
+			return handshake;
+		} else	{
+			loopcnt++;
+			msleep(10);
+		}
+	}
+
+	return HANDSHAKE_TIMEOUT_VALUE;
 }
 
 //---------------------------------------------------------------------------
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* Re: [PATCH v2 00/11] staging: ft1000: Various coding style cleanups.
  2011-01-25 13:04 [PATCH v2 00/11] staging: ft1000: Various coding style cleanups Marek Belisko
                   ` (10 preceding siblings ...)
  2011-01-25 13:05 ` [PATCH v2 11/11] staging: ft1000: Fix coding style in get_handshake() function Marek Belisko
@ 2011-01-25 13:32 ` Dan Carpenter
  11 siblings, 0 replies; 14+ messages in thread
From: Dan Carpenter @ 2011-01-25 13:32 UTC (permalink / raw)
  To: Marek Belisko; +Cc: gregkh, devel, linux-kernel

Looks good.

Reviewed-by: Dan Carpenter <error27@gmail.com>

regards,
dan carpenter

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH v2 09/11] staging: ft1000: Fix coding style in put_request_value() function.
  2011-01-25 13:05 ` [PATCH v2 09/11] staging: ft1000: Fix coding style in put_request_value() function Marek Belisko
@ 2011-01-25 15:23   ` Alexey Dobriyan
  0 siblings, 0 replies; 14+ messages in thread
From: Alexey Dobriyan @ 2011-01-25 15:23 UTC (permalink / raw)
  To: Marek Belisko; +Cc: gregkh, devel, linux-kernel

I'm sorry, but per-function split is ridiculous.

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2011-01-25 15:23 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-01-25 13:04 [PATCH v2 00/11] staging: ft1000: Various coding style cleanups Marek Belisko
2011-01-25 13:04 ` [PATCH v2 01/11] staging: ft1000: Remove dead code Marek Belisko
2011-01-25 13:04 ` [PATCH v2 02/11] staging: ft1000: Fix coding style in check_usb_db() function Marek Belisko
2011-01-25 13:04 ` [PATCH v2 03/11] staging: ft1000: Fix coding style in put_handshake() function Marek Belisko
2011-01-25 13:04 ` [PATCH v2 04/11] staging: ft1000: Fix coding style in get_handshake_usb() function Marek Belisko
2011-01-25 13:05 ` [PATCH v2 05/11] staging: ft1000: Fix coding style in put_handshake_usb() function Marek Belisko
2011-01-25 13:05 ` [PATCH v2 06/11] staging: ft1000: Fix coding style in get_request_type() function Marek Belisko
2011-01-25 13:05 ` [PATCH v2 07/11] staging: ft1000: Fix coding style in get_request_type_usb() function Marek Belisko
2011-01-25 13:05 ` [PATCH v2 08/11] staging: ft1000: Fix coding style in get_request_value() function Marek Belisko
2011-01-25 13:05 ` [PATCH v2 09/11] staging: ft1000: Fix coding style in put_request_value() function Marek Belisko
2011-01-25 15:23   ` Alexey Dobriyan
2011-01-25 13:05 ` [PATCH v2 10/11] staging: ft1000: Fix coding style in hdr_checksum() function Marek Belisko
2011-01-25 13:05 ` [PATCH v2 11/11] staging: ft1000: Fix coding style in get_handshake() function Marek Belisko
2011-01-25 13:32 ` [PATCH v2 00/11] staging: ft1000: Various coding style cleanups Dan Carpenter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).