From: Borislav Petkov <petkovbb@googlemail.com>
To: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Cc: linux-kernel@vger.kernel.org, linux-ide@vger.kernel.org
Subject: Re: [PATCH 03/18] ide-cd: cdrom_decode_status: factor out block pc error handling code
Date: Fri, 15 Aug 2008 09:34:13 +0200 [thread overview]
Message-ID: <20080815073413.GA9906@gollum.tnic> (raw)
In-Reply-To: <200806141929.21329.bzolnier@gmail.com>
On Sat, Jun 14, 2008 at 07:29:21PM +0200, Bartlomiej Zolnierkiewicz wrote:
> On Thursday 12 June 2008, Borislav Petkov wrote:
> > ... into cdrom_handle_failed_pc_req().
>
> I actually think that we should try to unite pc/fs error handling as much
> as possible as it shouldn't really matter if i.e. READ command came through
> fs or pc request - the error handling w.r.t. hardware should be the same
> (at the moment it is not always the case - the most blatant example of this
> disrepancy is handling of NOT_READY sense key for WRITE commands).
>
> When I was suggesting factoring out error handling I rather meant moving
> out _everything_ after OK_STAT() (sorry for the confusion). On the second
> thought we may do it in even simpler way by moving:
>
> ...
> /* check for errors */
> stat = ide_read_status(drive);
>
> if (stat_ret)
> *stat_ret = stat;
>
> if (OK_STAT(stat, good_stat, BAD_R_STAT))
> return 0;
> ...
>
> to cdrom_decode_status() users and passing as an argument 'stat' instead
> of 'good_stat' and 'stat_ret'.
>
> Therefore I skipped this patch (and also patch #4) for now.
Hi Bart,
here's a first attempt at that. These are only RFC of nature, please take a look
when there's time. They've been lightly tested but I'll do more later since this
path is not hit that often and a special test case will be required.
---
From: Borislav Petkov <petkovbb@gmail.com>
Date: Sun, 10 Aug 2008 18:54:03 +0200
Subject: [PATCH 1/2] ide-cd: move error handling outside of cdrom_decode_status()
There should be no functionality change resulting from this patch.
Signed-off-by: Borislav Petkov <petkovbb@gmail.com>
---
drivers/ide/ide-cd.c | 36 ++++++++++++++++++------------------
1 files changed, 18 insertions(+), 18 deletions(-)
diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c
index f675cee..f2c12be 100644
--- a/drivers/ide/ide-cd.c
+++ b/drivers/ide/ide-cd.c
@@ -284,20 +284,11 @@ static void ide_dump_status_no_sense(ide_drive_t *drive, const char *msg, u8 st)
* 0: if the request should be continued.
* 1: if the request was ended.
*/
-static int cdrom_decode_status(ide_drive_t *drive, int good_stat, int *stat_ret)
+static int cdrom_decode_status(ide_drive_t *drive, int stat)
{
ide_hwif_t *hwif = drive->hwif;
struct request *rq = hwif->hwgroup->rq;
- int stat, err, sense_key;
-
- /* check for errors */
- stat = hwif->tp_ops->read_status(hwif);
-
- if (stat_ret)
- *stat_ret = stat;
-
- if (OK_STAT(stat, good_stat, BAD_R_STAT))
- return 0;
+ int err, sense_key;
/* get the IDE error register */
err = ide_read_error(drive);
@@ -563,7 +554,7 @@ static ide_startstop_t cdrom_transfer_packet_command(ide_drive_t *drive,
ide_handler_t *handler)
{
ide_hwif_t *hwif = drive->hwif;
- int cmd_len;
+ int cmd_len, stat;
struct cdrom_info *info = drive->driver_data;
ide_startstop_t startstop;
@@ -574,8 +565,11 @@ static ide_startstop_t cdrom_transfer_packet_command(ide_drive_t *drive,
*/
/* check for errors */
- if (cdrom_decode_status(drive, ATA_DRQ, NULL))
- return ide_stopped;
+ stat = hwif->tp_ops->read_status(hwif);
+
+ if (!OK_STAT(stat, ATA_DRQ, BAD_R_STAT))
+ if (cdrom_decode_status(drive, stat))
+ return ide_stopped;
/* ok, next interrupt will be DMA interrupt */
if (info->dma)
@@ -739,8 +733,11 @@ static ide_startstop_t cdrom_seek_intr(ide_drive_t *drive)
int stat;
static int retry = 10;
- if (cdrom_decode_status(drive, 0, &stat))
- return ide_stopped;
+ stat = drive->hwif->tp_ops->read_status(drive->hwif);
+
+ if (!OK_STAT(stat, 0, BAD_R_STAT))
+ if (cdrom_decode_status(drive, stat))
+ return ide_stopped;
drive->atapi_flags |= IDE_AFLAG_SEEKING;
@@ -917,8 +914,11 @@ static ide_startstop_t cdrom_newpc_intr(ide_drive_t *drive)
}
}
- if (cdrom_decode_status(drive, 0, &stat))
- return ide_stopped;
+ stat = hwif->tp_ops->read_status(hwif);
+
+ if (!OK_STAT(stat, 0, BAD_R_STAT))
+ if (cdrom_decode_status(drive, stat))
+ return ide_stopped;
/* using dma, transfer is complete now */
if (dma) {
--
1.5.5.4
--
Regards/Gruss,
Boris.
next prev parent reply other threads:[~2008-08-15 7:34 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-06-12 6:40 [PATCH 00/18] misc generic ide stuff Borislav Petkov
2008-06-12 6:40 ` [PATCH 01/18] ide-cd: remove wait-for-idle-controller bit in cdrom_start_packet_command Borislav Petkov
2008-06-12 6:40 ` [PATCH 02/18] ide-cd: remove ide_cd_drain_data and ide_cd_pad_transfer Borislav Petkov
2008-06-14 17:29 ` Bartlomiej Zolnierkiewicz
2008-06-15 9:28 ` Borislav Petkov
2008-06-12 6:40 ` [PATCH 03/18] ide-cd: cdrom_decode_status: factor out block pc error handling code Borislav Petkov
2008-06-14 17:29 ` Bartlomiej Zolnierkiewicz
2008-08-15 7:34 ` Borislav Petkov [this message]
2008-08-16 20:26 ` Borislav Petkov
2008-08-15 7:34 ` Borislav Petkov
2008-06-12 6:40 ` [PATCH 04/18] ide-cd: cdrom_decode_status: factor out fs request " Borislav Petkov
2008-06-12 6:40 ` [PATCH 05/18] ide-cd: ide_do_rw_cdrom: add the catch-all bad request case to the if-else block Borislav Petkov
2008-06-12 6:40 ` [PATCH 06/18] ide-cd: cdrom_start_seek: remove unused argument block Borislav Petkov
2008-06-12 6:40 ` [PATCH 07/18] ide-cd: mv ide_do_rw_cdrom ide_cd_do_request Borislav Petkov
2008-06-12 6:41 ` [PATCH 08/18] ide-cd: simplify request issuing path Borislav Petkov
2008-06-12 6:41 ` [PATCH 09/18] ide-cd: fold cdrom_start_seek into ide_cd_do_request Borislav Petkov
2008-06-12 6:41 ` [PATCH 10/18] ide-cd: move request prep from cdrom_start_seek_continuation to rq issue path Borislav Petkov
2008-06-12 6:41 ` [PATCH 11/18] ide-cd: move request prep from cdrom_start_rw_cont " Borislav Petkov
2008-06-12 6:41 ` [PATCH 12/18] ide-cd: move request prep chunk from cdrom_do_newpc_cont " Borislav Petkov
2008-06-12 6:41 ` [PATCH 13/18] ide-floppy: replace pc->c with rq->cmd Borislav Petkov
2008-06-14 17:40 ` Bartlomiej Zolnierkiewicz
2008-06-15 10:21 ` Borislav Petkov
2008-06-15 14:57 ` Bartlomiej Zolnierkiewicz
2008-06-12 6:41 ` [PATCH 14/18] ide-floppy: fold idefloppy_create_test_unit_ready_cmd into idefloppy_open Borislav Petkov
2008-06-12 6:41 ` [PATCH 15/18] ide-floppy: zero out the whole struct ide_atapi_pc on init Borislav Petkov
2008-06-12 6:41 ` [PATCH 16/18] ide-floppy: pass rq instead of pc to idefloppy_issue_pc Borislav Petkov
2008-06-12 6:41 ` [PATCH 17/18] ide-floppy: cleanup idefloppy_create_rw_cmd Borislav Petkov
2008-06-12 6:41 ` [PATCH 18/18] ide: use flags in IRQ handler Borislav Petkov
2008-06-14 17:47 ` Bartlomiej Zolnierkiewicz
2008-06-14 17:29 ` [PATCH 00/18] misc generic ide stuff Bartlomiej Zolnierkiewicz
2008-06-15 10:27 ` Borislav Petkov
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=20080815073413.GA9906@gollum.tnic \
--to=petkovbb@googlemail.com \
--cc=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
all inboxes | Powered by JetHome®