[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20080522074354.GB2414@gollum.tnic>
Date: Thu, 22 May 2008 09:43:54 +0200
From: Borislav Petkov <petkovbb@...glemail.com>
To: Bartlomiej Zolnierkiewicz <bzolnier@...il.com>
Cc: linux-ide@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 00/40] ide: generic ATAPI support
On Sun, May 18, 2008 at 08:54:28PM +0200, Bartlomiej Zolnierkiewicz wrote:
>
> Hi,
>
> This patch series unifies ATAPI support present in ide-{floppy,tape,scsi}
> device drivers and moves it out to the core IDE code (new ide-atapi.c file).
>
> In the process many bugs were shaken out and ~300 LOC were removed.
>
> diffstat:
>
> drivers/ide/Kconfig | 6
> drivers/ide/Makefile | 1
> drivers/ide/ide-atapi.c | 296 ++++++++++++++++++++++
> drivers/ide/ide-cd.c | 5
> drivers/ide/ide-floppy.c | 431 +++++++-------------------------
> drivers/ide/ide-tape.c | 630 ++++++++++++++---------------------------------
> drivers/scsi/ide-scsi.c | 455 +++++++++++----------------------
> include/linux/ide.h | 28 +-
> 8 files changed, 777 insertions(+), 1075 deletions(-)
>
> Now, while this is a big step in the right direction there are still some
> things left on TODO for generic ATAPI support to be complete:
>
> - convert ide-cd to use generic ATAPI code
>
> - kill pc and rq stacks in ide-{floppy,tape}
>
> - generic handling of REQUEST SENSE command
>
> - generic handling of MODE SENSE command for ide-{floppy,tape}
>
> - convert ide-{cd,floppy,tape} to use scatterlists for PIO transers
> (ala ide-scsi)
>
> I know that Borislav is working on the first two items but other ones
> are free at the moment so if you feel brave you may give it a try :-).
>
> PS I'll be travelling during this weekend and be rather busy with day job
> so replies from me may be delayed a bit.
Hi Bart,
yep, these all look real good, makes all drivers really lightweight. Looks like
ide-cd will follow not too far behind. By the way, here's another one you count apply ontop:
From: Borislav Petkov <petkovbb@...il.com>
Date: Thu, 22 May 2008 09:36:53 +0200
Subject: [PATCH] ide-tape: unify idetape_create_read/write_cmd
A straightforward one. There should be no functional change resulting from this
change.
Signed-off-by: Borislav Petkov <petkovbb@...il.com>
---
drivers/ide/ide-tape.c | 47 ++++++++++++++++++++---------------------------
1 files changed, 20 insertions(+), 27 deletions(-)
diff --git a/drivers/ide/ide-tape.c b/drivers/ide/ide-tape.c
index 0afa109..da08a6a 100644
--- a/drivers/ide/ide-tape.c
+++ b/drivers/ide/ide-tape.c
@@ -952,40 +952,31 @@ static ide_startstop_t idetape_media_access_finished(ide_drive_t *drive)
return ide_stopped;
}
-static void idetape_create_read_cmd(idetape_tape_t *tape,
- struct ide_atapi_pc *pc,
- unsigned int length, struct idetape_bh *bh)
+static void ide_tape_create_rw_cmd(idetape_tape_t *tape,
+ struct ide_atapi_pc *pc, unsigned int length,
+ struct idetape_bh *bh, int opcode)
{
idetape_init_pc(pc);
- pc->c[0] = READ_6;
put_unaligned(cpu_to_be32(length), (unsigned int *) &pc->c[1]);
pc->c[1] = 1;
pc->bh = bh;
- atomic_set(&bh->b_count, 0);
pc->buf = NULL;
pc->buf_size = length * tape->blk_size;
pc->req_xfer = pc->buf_size;
if (pc->req_xfer == tape->buffer_size)
pc->flags |= PC_FLAG_DMA_OK;
-}
-static void idetape_create_write_cmd(idetape_tape_t *tape,
- struct ide_atapi_pc *pc,
- unsigned int length, struct idetape_bh *bh)
-{
- idetape_init_pc(pc);
- pc->c[0] = WRITE_6;
- put_unaligned(cpu_to_be32(length), (unsigned int *) &pc->c[1]);
- pc->c[1] = 1;
- pc->flags |= PC_FLAG_WRITING;
- pc->bh = bh;
- pc->b_data = bh->b_data;
- pc->b_count = atomic_read(&bh->b_count);
- pc->buf = NULL;
- pc->buf_size = length * tape->blk_size;
- pc->req_xfer = pc->buf_size;
- if (pc->req_xfer == tape->buffer_size)
- pc->flags |= PC_FLAG_DMA_OK;
+ if (opcode == READ_6) {
+ pc->c[0] = READ_6;
+ atomic_set(&bh->b_count, 0);
+ }
+ else if (opcode == WRITE_6) {
+ pc->c[0] = WRITE_6;
+ pc->flags |= PC_FLAG_WRITING;
+ pc->b_data = bh->b_data;
+ pc->b_count = atomic_read(&bh->b_count);
+ } else
+ printk(KERN_ERR "%s: Invalid opcode: 0x%x\n", __func__, opcode);
}
static ide_startstop_t idetape_do_request(ide_drive_t *drive,
@@ -1062,14 +1053,16 @@ static ide_startstop_t idetape_do_request(ide_drive_t *drive,
}
if (rq->cmd[0] & REQ_IDETAPE_READ) {
pc = idetape_next_pc_storage(drive);
- idetape_create_read_cmd(tape, pc, rq->current_nr_sectors,
- (struct idetape_bh *)rq->special);
+ ide_tape_create_rw_cmd(tape, pc, rq->current_nr_sectors,
+ (struct idetape_bh *)rq->special,
+ READ_6);
goto out;
}
if (rq->cmd[0] & REQ_IDETAPE_WRITE) {
pc = idetape_next_pc_storage(drive);
- idetape_create_write_cmd(tape, pc, rq->current_nr_sectors,
- (struct idetape_bh *)rq->special);
+ ide_tape_create_rw_cmd(tape, pc, rq->current_nr_sectors,
+ (struct idetape_bh *)rq->special,
+ WRITE_6);
goto out;
}
if (rq->cmd[0] & REQ_IDETAPE_PC1) {
--
1.5.5.1
--
Regards/Gruß,
Boris.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists