Re: [PATCH 2/2] staging: ft1000: remove code indention

2015-03-17 Thread Sudip Mukherjee
On Mon, Mar 16, 2015 at 04:33:34PM +0100, Greg Kroah-Hartman wrote:
> On Sat, Mar 07, 2015 at 10:56:53AM +0530, Sudip Mukherjee wrote:
> > modified the code to keep the logic same but removed some indention.
> > 
> > Signed-off-by: Sudip Mukherjee 
> > ---
> > 
> > this patch will generate checkpatch warning about line more than 80char,
> > and too many use of tab. but unless the total function is rewrtten it will
> > be difficult to fix that.
> > 
> >  drivers/staging/ft1000/ft1000-usb/ft1000_debug.c | 44 
> > +++-
> >  1 file changed, 21 insertions(+), 23 deletions(-)
> 
> I don't see how this looks any better, do you?
well, better in the sense very little indention was fixed and code
which was repeating in if-else if - else was placed in a loop, but a
small if-else was still there for the different delay between retries.
I will see if i can make it more better.

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


Re: [PATCH 2/2] staging: ft1000: remove code indention

2015-03-16 Thread Greg Kroah-Hartman
On Sat, Mar 07, 2015 at 10:56:53AM +0530, Sudip Mukherjee wrote:
> modified the code to keep the logic same but removed some indention.
> 
> Signed-off-by: Sudip Mukherjee 
> ---
> 
> this patch will generate checkpatch warning about line more than 80char,
> and too many use of tab. but unless the total function is rewrtten it will
> be difficult to fix that.
> 
>  drivers/staging/ft1000/ft1000-usb/ft1000_debug.c | 44 
> +++-
>  1 file changed, 21 insertions(+), 23 deletions(-)

I don't see how this looks any better, do you?
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 2/2] staging: ft1000: remove code indention

2015-03-06 Thread Sudip Mukherjee
modified the code to keep the logic same but removed some indention.

Signed-off-by: Sudip Mukherjee 
---

this patch will generate checkpatch warning about line more than 80char,
and too many use of tab. but unless the total function is rewrtten it will
be difficult to fix that.

 drivers/staging/ft1000/ft1000-usb/ft1000_debug.c | 44 +++-
 1 file changed, 21 insertions(+), 23 deletions(-)

diff --git a/drivers/staging/ft1000/ft1000-usb/ft1000_debug.c 
b/drivers/staging/ft1000/ft1000-usb/ft1000_debug.c
index 86dd699..584c59a 100644
--- a/drivers/staging/ft1000/ft1000-usb/ft1000_debug.c
+++ b/drivers/staging/ft1000/ft1000-usb/ft1000_debug.c
@@ -587,32 +587,30 @@ static long ft1000_ioctl(struct file *file, unsigned int 
command,
if (qtype) {
} else {
/* Put message into Slow Queue */
-   /* Only put a message into the DPRAM if 
msg doorbell is available */
-   ft1000_read_register(ft1000dev, 
&tempword, FT1000_REG_DOORBELL);
-   /* pr_debug("READ REGISTER 
tempword=%x\n", tempword); */
-   if (tempword & FT1000_DB_DPRAM_TX) {
-   /* Suspend for 2ms and try 
again due to DSP doorbell busy */
-   mdelay(2);
+   u8 cnt = 0;
+
+   do {
+   /* Only put a message into the 
DPRAM if msg doorbell is available */
ft1000_read_register(ft1000dev, 
&tempword, FT1000_REG_DOORBELL);
+   /* pr_debug("READ REGISTER 
tempword=%x\n", tempword); */
if (tempword & 
FT1000_DB_DPRAM_TX) {
+   /* Suspend for 2ms and 
try again due to DSP doorbell busy */
+   if (cnt == 0)
+   mdelay(2);
/* Suspend for 1ms and 
try again due to DSP doorbell busy */
-   mdelay(1);
-   
ft1000_read_register(ft1000dev, &tempword, FT1000_REG_DOORBELL);
-   if (tempword & 
FT1000_DB_DPRAM_TX) {
-   
ft1000_read_register(ft1000dev, &tempword, FT1000_REG_DOORBELL);
-   if (tempword & 
FT1000_DB_DPRAM_TX) {
-   /* 
Suspend for 3ms and try again due to DSP doorbell busy */
-   
mdelay(3);
-   
ft1000_read_register(ft1000dev, &tempword, FT1000_REG_DOORBELL);
-   if 
(tempword & FT1000_DB_DPRAM_TX) {
-   
pr_debug("Doorbell not available\n");
-   
result = -ENOTTY;
-   
kfree(dpram_data);
-   
break;
-   }
-   }
-   }
-   }
+   else if (cnt == 1)
+   mdelay(1);
+   /* Suspend for 3ms and 
try again due to DSP doorbell busy */
+   else
+   mdelay(3);
+   } else
+   break;
+   } while (++cnt < 3);
+   if (tempword & FT1000_DB_DPRAM_TX) {
+   pr_debug("Doorbell not 
available\n");
+   result = -ENOTTY;
+   kfree(dpram_data);
+   break;
}