From: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
To: linux-ide@vger.kernel.org
Cc: Borislav Petkov <petkovbb@gmail.com>,
Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>,
linux-kernel@vger.kernel.org
Subject: [PATCH 09/20] ide-cd: unify ide_cd_do_request() exit paths
Date: Mon, 16 Feb 2009 01:14:09 +0100 [thread overview]
Message-ID: <20090216001409.27491.64048.sendpatchset@localhost.localdomain> (raw)
In-Reply-To: <20090216001309.27491.59759.sendpatchset@localhost.localdomain>
From: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Subject: [PATCH] ide-cd: unify ide_cd_do_request() exit paths
* Move cdrom_end_request() calls from cdrom_start_rw()
and ide_cd_prepare_rw_request() to ide_cd_do_request().
* Unify ide_cd_do_request() exit paths.
There should be no functional changes caused by this patch.
Cc: Borislav Petkov <petkovbb@gmail.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
---
drivers/ide/ide-cd.c | 28 ++++++++++++----------------
1 file changed, 12 insertions(+), 16 deletions(-)
Index: b/drivers/ide/ide-cd.c
===================================================================
--- a/drivers/ide/ide-cd.c
+++ b/drivers/ide/ide-cd.c
@@ -590,7 +590,6 @@ static ide_startstop_t ide_cd_prepare_rw
printk(KERN_ERR PFX "%s: %s: buffer botch (%u)\n",
drive->name, __func__,
rq->current_nr_sectors);
- cdrom_end_request(drive, 0);
return ide_stopped;
}
rq->current_nr_sectors += nskip;
@@ -967,10 +966,8 @@ static ide_startstop_t cdrom_start_rw(id
if (write) {
/* disk has become write protected */
- if (get_disk_ro(cd->disk)) {
- cdrom_end_request(drive, 0);
+ if (get_disk_ro(cd->disk))
return ide_stopped;
- }
} else {
/*
* We may be retrying this request after an error. Fix up any
@@ -982,10 +979,8 @@ static ide_startstop_t cdrom_start_rw(id
/* use DMA, if possible / writes *must* be hardware frame aligned */
if ((rq->nr_sectors & (sectors_per_frame - 1)) ||
(rq->sector & (sectors_per_frame - 1))) {
- if (write) {
- cdrom_end_request(drive, 0);
+ if (write)
return ide_stopped;
- }
drive->dma = 0;
} else
drive->dma = !!(drive->dev_flags & IDE_DFLAG_USING_DMA);
@@ -1040,6 +1035,7 @@ static ide_startstop_t ide_cd_do_request
sector_t block)
{
struct ide_cmd cmd;
+ int uptodate = 0;
ide_debug_log(IDE_DBG_RQ, "cmd: 0x%x, block: %llu",
rq->cmd[0], (unsigned long long)block);
@@ -1048,11 +1044,9 @@ static ide_startstop_t ide_cd_do_request
blk_dump_rq_flags(rq, "ide_cd_do_request");
if (blk_fs_request(rq)) {
- if (cdrom_start_rw(drive, rq) == ide_stopped)
- return ide_stopped;
-
- if (ide_cd_prepare_rw_request(drive, rq) == ide_stopped)
- return ide_stopped;
+ if (cdrom_start_rw(drive, rq) == ide_stopped ||
+ ide_cd_prepare_rw_request(drive, rq) == ide_stopped)
+ goto out_end;
} else if (blk_sense_request(rq) || blk_pc_request(rq) ||
rq->cmd_type == REQ_TYPE_ATA_PC) {
if (!rq->timeout)
@@ -1061,12 +1055,11 @@ static ide_startstop_t ide_cd_do_request
cdrom_do_block_pc(drive, rq);
} else if (blk_special_request(rq)) {
/* right now this can only be a reset... */
- cdrom_end_request(drive, 1);
- return ide_stopped;
+ uptodate = 1;
+ goto out_end;
} else {
blk_dump_rq_flags(rq, DRV_NAME " bad flags");
- cdrom_end_request(drive, 0);
- return ide_stopped;
+ goto out_end;
}
memset(&cmd, 0, sizeof(cmd));
@@ -1077,6 +1070,9 @@ static ide_startstop_t ide_cd_do_request
cmd.rq = rq;
return ide_issue_pc(drive, &cmd);
+out_end:
+ cdrom_end_request(drive, uptodate);
+ return ide_stopped;
}
/*
next prev parent reply other threads:[~2009-02-16 0:12 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-02-16 0:13 [PATCH 00/20] ide-cd: use scatterlists also for PIO transfers Bartlomiej Zolnierkiewicz
2009-02-16 0:13 ` [PATCH 01/20] ide: add support for arbitrary transfer lengths to ide_pio_bytes() Bartlomiej Zolnierkiewicz
2009-02-16 0:13 ` [PATCH 02/20] ide: use PageHighMem() instead of ifdefs in ide_pio_bytes() Bartlomiej Zolnierkiewicz
2009-02-16 0:13 ` [PATCH 03/20] ide-cd: remove dead URLs Bartlomiej Zolnierkiewicz
2009-02-16 0:13 ` [PATCH 04/20] ide-cd: use ide_end_rq() also for failed non-fs requests Bartlomiej Zolnierkiewicz
2009-02-16 0:13 ` [PATCH 05/20] ide-cd: remove dead code from cdrom_decode_status() Bartlomiej Zolnierkiewicz
2009-02-16 0:13 ` [PATCH 06/20] ide: remove needless ide_dump_status_no_sense() wrapper Bartlomiej Zolnierkiewicz
2009-02-16 0:13 ` [PATCH 07/20] ide-cd: remove no longer needed 'ignore' module parameter Bartlomiej Zolnierkiewicz
2009-02-16 0:14 ` [PATCH 08/20] ide-cd: factor out failed request completion from cdrom_end_request() Bartlomiej Zolnierkiewicz
2009-02-16 0:14 ` Bartlomiej Zolnierkiewicz [this message]
2009-02-16 0:14 ` [PATCH 10/20] ide-cd: move setting REQ_FAILED flag out from 'end_request' exit path Bartlomiej Zolnierkiewicz
2009-02-16 0:14 ` [PATCH 11/20] ide-cd: unify cdrom_newpc_intr() exit paths Bartlomiej Zolnierkiewicz
2009-02-16 9:25 ` Borislav Petkov
2009-02-16 21:09 ` Bartlomiej Zolnierkiewicz
2009-02-16 0:14 ` [PATCH 12/20] ide-cd: remove cdrom_end_request() Bartlomiej Zolnierkiewicz
2009-02-16 0:14 ` [PATCH 13/20] ide-cd: kill whole failed request in ide_cd_do_request() Bartlomiej Zolnierkiewicz
2009-02-16 0:14 ` [PATCH 14/20] ide-cd: cleanup ide_cd_do_request() Bartlomiej Zolnierkiewicz
2009-02-16 0:14 ` [PATCH 15/20] ide-cd: use scatterlists for PIO transfers (fs requests) Bartlomiej Zolnierkiewicz
2009-02-16 0:14 ` [PATCH 16/20] ide-cd: fix non-SECTOR_SIZE-multiples PIO transfers for fs requests Bartlomiej Zolnierkiewicz
2009-02-16 0:15 ` [PATCH 17/20] ide-cd: merge ide_cd_prepare_rw_request() into cdrom_start_rw() Bartlomiej Zolnierkiewicz
2009-02-16 0:15 ` [PATCH 18/20] ide-cd: use scatterlists for PIO transfers (non-fs requests) Bartlomiej Zolnierkiewicz
2009-02-16 0:15 ` [PATCH 19/20] ide-cd: use common completion path for DMA requests in cdrom_newpc_intr() Bartlomiej Zolnierkiewicz
2009-02-16 0:15 ` [PATCH 20/20] ide-cd: unify transfer padding " Bartlomiej Zolnierkiewicz
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=20090216001409.27491.64048.sendpatchset@localhost.localdomain \
--to=bzolnier@gmail.com \
--cc=linux-ide@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=petkovbb@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;
as well as URLs for NNTP newsgroup(s).