[PATCH 8/9] staging: ft1000: Fix coding style in fix_ft1000_write_dpram32 fucntion.

From: Marek Belisko
Date: Wed Feb 09 2011 - 09:03:06 EST


Signed-off-by: Marek Belisko <marek.belisko@xxxxxxxxxxxxxxx>
---
drivers/staging/ft1000/ft1000-usb/ft1000_hw.c | 104 +++++++++++--------------
1 files changed, 47 insertions(+), 57 deletions(-)

diff --git a/drivers/staging/ft1000/ft1000-usb/ft1000_hw.c b/drivers/staging/ft1000/ft1000-usb/ft1000_hw.c
index 6195ee9..437aee3 100644
--- a/drivers/staging/ft1000/ft1000-usb/ft1000_hw.c
+++ b/drivers/staging/ft1000/ft1000-usb/ft1000_hw.c
@@ -365,68 +365,58 @@ int fix_ft1000_read_dpram32(struct ft1000_device *ft1000dev, u16 indx,
//---------------------------------------------------------------------------
int fix_ft1000_write_dpram32(struct ft1000_device *ft1000dev, u16 indx, u8 *buffer)
{
- u16 pos1;
- u16 pos2;
- u16 i;
- u8 buf[32];
- u8 resultbuffer[32];
- u8 *pdata;
- int ret = STATUS_SUCCESS;
-
- //DEBUG("fix_ft1000_write_dpram32: Entered:\n");
-
- pos1 = (indx / 4)*4;
- pdata = buffer;
- ret = ft1000_read_dpram32(ft1000dev, pos1, buf, 16);
- if (ret == STATUS_SUCCESS)
- {
- pos2 = (indx % 4)*4;
- buf[pos2++] = *buffer++;
- buf[pos2++] = *buffer++;
- buf[pos2++] = *buffer++;
- buf[pos2++] = *buffer++;
- ret = ft1000_write_dpram32(ft1000dev, pos1, buf, 16);
- }
- else
- {
- DEBUG("fix_ft1000_write_dpram32: DPRAM32 Read failed\n");
+ u16 pos1;
+ u16 pos2;
+ u16 i;
+ u8 buf[32];
+ u8 resultbuffer[32];
+ u8 *pdata;
+ int ret = STATUS_SUCCESS;
+
+ pos1 = (indx / 4) * 4;
+ pdata = buffer;
+ ret = ft1000_read_dpram32(ft1000dev, pos1, buf, 16);

- return ret;
- }
-
- ret = ft1000_read_dpram32(ft1000dev, pos1, (u8 *)&resultbuffer[0], 16);
- if (ret == STATUS_SUCCESS)
- {
- buffer = pdata;
- for (i=0; i<16; i++)
- {
- if (buf[i] != resultbuffer[i]){
+ if (ret == STATUS_SUCCESS) {
+ pos2 = (indx % 4)*4;
+ buf[pos2++] = *buffer++;
+ buf[pos2++] = *buffer++;
+ buf[pos2++] = *buffer++;
+ buf[pos2++] = *buffer++;
+ ret = ft1000_write_dpram32(ft1000dev, pos1, buf, 16);
+ } else {
+ DEBUG("fix_ft1000_write_dpram32: DPRAM32 Read failed\n");
+ return ret;
+ }

- ret = STATUS_FAILURE;
- }
- }
- }
+ ret = ft1000_read_dpram32(ft1000dev, pos1, (u8 *)&resultbuffer[0], 16);

- if (ret == STATUS_FAILURE)
- {
- ret = ft1000_write_dpram32(ft1000dev, pos1, (u8 *)&tempbuffer[0], 16);
- ret = ft1000_read_dpram32(ft1000dev, pos1, (u8 *)&resultbuffer[0], 16);
- if (ret == STATUS_SUCCESS)
- {
- buffer = pdata;
- for (i=0; i<16; i++)
- {
- if (tempbuffer[i] != resultbuffer[i])
- {
- ret = STATUS_FAILURE;
- DEBUG("fix_ft1000_write_dpram32 Failed to write\n");
- }
- }
- }
- }
+ if (ret == STATUS_SUCCESS) {
+ buffer = pdata;
+ for (i = 0; i < 16; i++) {
+ if (buf[i] != resultbuffer[i])
+ ret = STATUS_FAILURE;
+ }
+ }

- return ret;
+ if (ret == STATUS_FAILURE) {
+ ret = ft1000_write_dpram32(ft1000dev, pos1,
+ (u8 *)&tempbuffer[0], 16);
+ ret = ft1000_read_dpram32(ft1000dev, pos1,
+ (u8 *)&resultbuffer[0], 16);
+ if (ret == STATUS_SUCCESS) {
+ buffer = pdata;
+ for (i = 0; i < 16; i++) {
+ if (tempbuffer[i] != resultbuffer[i]) {
+ ret = STATUS_FAILURE;
+ DEBUG("%s Failed to write\n",
+ __func__);
+ }
+ }
+ }
+ }

+ return ret;
}


--
1.7.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/