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 8/8] ide: return request status from ->pc_callback method
Date: Sun, 01 Feb 2009 20:28:38 +0100 [thread overview]
Message-ID: <20090201192838.1592.16234.sendpatchset@localhost.localdomain> (raw)
In-Reply-To: <20090201192732.1592.76435.sendpatchset@localhost.localdomain>
From: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Subject: [PATCH] ide: return request status from ->pc_callback method
Make ->pc_callback method return request status and then move
the request completion from ->pc_callback to ide_pc_intr().
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-atapi.c | 12 +++++++++++-
drivers/ide/ide-floppy.c | 12 ++++--------
drivers/ide/ide-tape.c | 10 ++--------
include/linux/ide.h | 2 +-
4 files changed, 18 insertions(+), 18 deletions(-)
Index: b/drivers/ide/ide-atapi.c
===================================================================
--- a/drivers/ide/ide-atapi.c
+++ b/drivers/ide/ide-atapi.c
@@ -345,6 +345,8 @@ static ide_startstop_t ide_pc_intr(ide_d
/* No more interrupts */
if ((stat & ATA_DRQ) == 0) {
+ int uptodate;
+
debug_log("Packet command completed, %d bytes transferred\n",
pc->xferred);
@@ -383,7 +385,15 @@ static ide_startstop_t ide_pc_intr(ide_d
dsc = 1;
/* Command finished - Call the callback function */
- drive->pc_callback(drive, dsc);
+ uptodate = drive->pc_callback(drive, dsc);
+
+ if (uptodate == 0)
+ drive->failed_pc = NULL;
+
+ if (blk_special_request(rq))
+ ide_complete_rq(drive, 0);
+ else
+ ide_end_request(drive, uptodate, 0);
return ide_stopped;
}
Index: b/drivers/ide/ide-floppy.c
===================================================================
--- a/drivers/ide/ide-floppy.c
+++ b/drivers/ide/ide-floppy.c
@@ -71,7 +71,7 @@ static void idefloppy_update_buffers(ide
ide_end_request(drive, 1, 0);
}
-static void ide_floppy_callback(ide_drive_t *drive, int dsc)
+static int ide_floppy_callback(ide_drive_t *drive, int dsc)
{
struct ide_disk_obj *floppy = drive->driver_data;
struct ide_atapi_pc *pc = drive->pc;
@@ -108,14 +108,10 @@ static void ide_floppy_callback(ide_driv
"Aborting request!\n");
}
- if (uptodate == 0)
- drive->failed_pc = NULL;
-
- if (blk_special_request(rq)) {
+ if (blk_special_request(rq))
rq->errors = uptodate ? 0 : IDE_DRV_ERROR_GENERAL;
- ide_complete_rq(drive, 0);
- } else
- ide_end_request(drive, uptodate, 0);
+
+ return uptodate;
}
static void ide_floppy_report_error(struct ide_disk_obj *floppy,
Index: b/drivers/ide/ide-tape.c
===================================================================
--- a/drivers/ide/ide-tape.c
+++ b/drivers/ide/ide-tape.c
@@ -463,7 +463,7 @@ static void ide_tape_kfree_buffer(idetap
static void ide_tape_handle_dsc(ide_drive_t *);
-static void ide_tape_callback(ide_drive_t *drive, int dsc)
+static int ide_tape_callback(ide_drive_t *drive, int dsc)
{
idetape_tape_t *tape = drive->driver_data;
struct ide_atapi_pc *pc = drive->pc;
@@ -530,13 +530,7 @@ static void ide_tape_callback(ide_drive_
rq->errors = err;
- if (uptodate == 0)
- drive->failed_pc = NULL;
-
- if (blk_special_request(rq))
- ide_complete_rq(drive, 0);
- else
- ide_end_request(drive, uptodate, 0);
+ return uptodate;
}
/*
Index: b/include/linux/ide.h
===================================================================
--- a/include/linux/ide.h
+++ b/include/linux/ide.h
@@ -619,7 +619,7 @@ struct ide_drive_s {
struct ide_atapi_pc *failed_pc;
/* callback for packet commands */
- void (*pc_callback)(struct ide_drive_s *, int);
+ int (*pc_callback)(struct ide_drive_s *, int);
void (*pc_update_buffers)(struct ide_drive_s *, struct ide_atapi_pc *);
int (*pc_io_buffers)(struct ide_drive_s *, struct ide_atapi_pc *,
next prev parent reply other threads:[~2009-02-01 19:27 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-02-01 19:27 [PATCH 0/8] ide: remove ->end_request method Bartlomiej Zolnierkiewicz
2009-02-01 19:27 ` [PATCH 1/8] ide: remove no longer needed PC_FLAG_TIMEDOUT packet command flag Bartlomiej Zolnierkiewicz
2009-02-01 19:27 ` [PATCH 2/8] ide-floppy: remove superfluous check from ide_floppy_end_request() Bartlomiej Zolnierkiewicz
2009-02-01 19:27 ` [PATCH 3/8] ide-tape: remove superfluous tape->lock Bartlomiej Zolnierkiewicz
2009-02-01 19:28 ` [PATCH 4/8] ide: move ->failed_pc to ide_drive_t Bartlomiej Zolnierkiewicz
2009-02-01 19:28 ` [PATCH 5/8] ide: use ->end_request only for private device driver requests Bartlomiej Zolnierkiewicz
2009-02-01 19:28 ` [PATCH 6/8] ide-{floppy,tape}: cleanup ide*_end_request() Bartlomiej Zolnierkiewicz
2009-02-01 19:28 ` [PATCH 7/8] ide: remove ->end_request method Bartlomiej Zolnierkiewicz
2009-02-01 19:28 ` Bartlomiej Zolnierkiewicz [this message]
2009-02-05 6:50 ` [PATCH 0/8] " 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=20090201192838.1592.16234.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.