From: Joe Perches <joe@perches.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: linux-kernel@vger.kernel.org, Jiri Slaby <jirislaby@gmail.com>,
Marcin Slusarz <marcin.slusarz@gmail.com>,
Stephen Hemminger <shemminger@vyatta.com>,
Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Subject: [PATCH 02/13] drivers/block/floppy.c: Unclutter redo_fd_request logic
Date: Wed, 27 Jan 2010 12:46:18 -0800 [thread overview]
Message-ID: <fc251691b3da86b02beae6f2f833be39fea4bca1.1264624291.git.joe@perches.com> (raw)
In-Reply-To: <cover.1264624291.git.joe@perches.com>
Change for(;;) with continue; to label: goto label
Reduces indentation and adds a bit of clarity.
Signed-off-by: Joe Perches <joe@perches.com>
---
drivers/block/floppy.c | 105 ++++++++++++++++++++++++------------------------
1 files changed, 52 insertions(+), 53 deletions(-)
diff --git a/drivers/block/floppy.c b/drivers/block/floppy.c
index e750554..aca5226 100644
--- a/drivers/block/floppy.c
+++ b/drivers/block/floppy.c
@@ -2892,64 +2892,63 @@ static void redo_fd_request(void)
if (current_drive < N_DRIVE)
floppy_off(current_drive);
- for (;;) {
- if (!current_req) {
- struct request *req;
-
- spin_lock_irq(floppy_queue->queue_lock);
- req = blk_fetch_request(floppy_queue);
- spin_unlock_irq(floppy_queue->queue_lock);
- if (!req) {
- do_floppy = NULL;
- unlock_fdc();
- return;
- }
- current_req = req;
- }
- drive = (long)current_req->rq_disk->private_data;
- set_fdc(drive);
- reschedule_timeout(current_reqD, "redo fd request", 0);
-
- set_floppy(drive);
- raw_cmd = &default_raw_cmd;
- raw_cmd->flags = 0;
- if (start_motor(redo_fd_request))
+do_request:
+ if (!current_req) {
+ struct request *req;
+
+ spin_lock_irq(floppy_queue->queue_lock);
+ req = blk_fetch_request(floppy_queue);
+ spin_unlock_irq(floppy_queue->queue_lock);
+ if (!req) {
+ do_floppy = NULL;
+ unlock_fdc();
return;
- disk_change(current_drive);
- if (test_bit(current_drive, &fake_change) ||
- test_bit(FD_DISK_CHANGED_BIT, &DRS->flags)) {
- DPRINT("disk absent or changed during operation\n");
- request_done(0);
- continue;
- }
- if (!_floppy) { /* Autodetection */
- if (!probing) {
- DRS->probed_format = 0;
- if (next_valid_format()) {
- DPRINT("no autodetectable formats\n");
- _floppy = NULL;
- request_done(0);
- continue;
- }
- }
- probing = 1;
- _floppy =
- floppy_type + DP->autodetect[DRS->probed_format];
- } else
- probing = 0;
- errors = &(current_req->errors);
- tmp = make_raw_rw_request();
- if (tmp < 2) {
- request_done(tmp);
- continue;
}
+ current_req = req;
+ }
+ drive = (long)current_req->rq_disk->private_data;
+ set_fdc(drive);
+ reschedule_timeout(current_reqD, "redo fd request", 0);
- if (test_bit(FD_NEED_TWADDLE_BIT, &DRS->flags))
- twaddle();
- schedule_bh(floppy_start);
- debugt("queue fd request");
+ set_floppy(drive);
+ raw_cmd = &default_raw_cmd;
+ raw_cmd->flags = 0;
+ if (start_motor(redo_fd_request))
return;
+
+ disk_change(current_drive);
+ if (test_bit(current_drive, &fake_change) ||
+ test_bit(FD_DISK_CHANGED_BIT, &DRS->flags)) {
+ DPRINT("disk absent or changed during operation\n");
+ request_done(0);
+ goto do_request;
}
+ if (!_floppy) { /* Autodetection */
+ if (!probing) {
+ DRS->probed_format = 0;
+ if (next_valid_format()) {
+ DPRINT("no autodetectable formats\n");
+ _floppy = NULL;
+ request_done(0);
+ goto do_request;
+ }
+ }
+ probing = 1;
+ _floppy = floppy_type + DP->autodetect[DRS->probed_format];
+ } else
+ probing = 0;
+ errors = &(current_req->errors);
+ tmp = make_raw_rw_request();
+ if (tmp < 2) {
+ request_done(tmp);
+ goto do_request;
+ }
+
+ if (test_bit(FD_NEED_TWADDLE_BIT, &DRS->flags))
+ twaddle();
+ schedule_bh(floppy_start);
+ debugt("queue fd request");
+ return;
}
static struct cont_t rw_cont = {
--
1.6.6.rc0.57.gad7a
next prev parent reply other threads:[~2010-01-27 20:48 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-01-27 20:46 [PATCH 00/13] drivers/block/floppy.c cleanups Joe Perches
2010-01-27 20:46 ` [PATCH 01/13] drivers/block/floppy.c: Remove REPEAT macro Joe Perches
2010-01-27 20:46 ` Joe Perches [this message]
2010-01-27 20:46 ` [PATCH 03/13] drivers/block/floppy.c: Remove unnecessary argument from [__]reschedule_timeout Joe Perches
2010-01-27 20:46 ` [PATCH 04/13] drivers/block/floppy.c: Remove #define FLOPPY_SANITY_CHECK Joe Perches
2010-01-27 20:46 ` [PATCH 05/13] drivers/block/floppy.c: DPRINT neatening Joe Perches
2010-01-27 20:46 ` [PATCH 06/13] drivers/block/floppy.c: Use __func__ where appropriate Joe Perches
2010-01-27 20:46 ` [PATCH 07/13] drivers/block/floppy.c: Use %pf in logging messages Joe Perches
2010-01-27 20:46 ` [PATCH 08/13] drivers/block/floppy.c: Remove some unnecessary casting Joe Perches
2010-01-27 20:46 ` [PATCH 09/13] drivers/block/floppy.c: Convert raw_cmd_copyin from while(1) to label: goto Joe Perches
2010-01-27 20:46 ` [PATCH 10/13] drivers/block/floppy.c: Add __func__ to debugt Joe Perches
2010-01-27 20:46 ` [PATCH 11/13] drivers/block/floppy.c: Remove obfuscating CODE2SIZE macro Joe Perches
2010-01-27 21:16 ` Jiri Slaby
2010-01-27 20:46 ` [PATCH 12/13] drivers/block/floppy.c: Remove misleading, used once FD_IOCTL_ALLOWED macro Joe Perches
2010-01-27 20:46 ` [PATCH 13/13] drivers/block/floppy.c: Remove unnecessary casting in fd_ioctl Joe Perches
2010-01-27 21:28 ` [PATCH V2 11/13] drivers/block/floppy.c: Remove obfuscating CODE2SIZE macro Joe Perches
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=fc251691b3da86b02beae6f2f833be39fea4bca1.1264624291.git.joe@perches.com \
--to=joe@perches.com \
--cc=akpm@linux-foundation.org \
--cc=bzolnier@gmail.com \
--cc=jirislaby@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=marcin.slusarz@gmail.com \
--cc=shemminger@vyatta.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®