mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
To: Marek Belisko <marek.belisko@gmail.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Sudip Mukherjee <sudipm.mukherjee@gmail.com>,
	devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org
Subject: [PATCH 2/2] staging: ft1000: remove code indention
Date: Sat,  7 Mar 2015 10:56:53 +0530	[thread overview]
Message-ID: <1425706013-8888-2-git-send-email-sudipm.mukherjee@gmail.com> (raw)
In-Reply-To: <1425706013-8888-1-git-send-email-sudipm.mukherjee@gmail.com>

modified the code to keep the logic same but removed some indention.

Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org>
---

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;
 					}
 
 					/*pr_debug("finished reading register\n"); */
-- 
1.8.1.2


  reply	other threads:[~2015-03-07  5:27 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-07  5:26 [PATCH 1/2] staging: ft1000: remove unused variables Sudip Mukherjee
2015-03-07  5:26 ` Sudip Mukherjee [this message]
2015-03-16 15:33   ` [PATCH 2/2] staging: ft1000: remove code indention Greg Kroah-Hartman
2015-03-17 11:13     ` Sudip Mukherjee
2015-03-16 15:33 ` [PATCH 1/2] staging: ft1000: remove unused variables Greg KH
2015-03-17 12:52   ` Sudip Mukherjee

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1425706013-8888-2-git-send-email-sudipm.mukherjee@gmail.com \
    --to=sudipm.mukherjee@gmail.com \
    --cc=devel@driverdev.osuosl.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marek.belisko@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®