linux-ide.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Stephen Rothwell <sfr@canb.auug.org.au>,
	linux-ide@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [git pull] IDE fixes
Date: Fri, 13 Mar 2009 21:49:12 +0100	[thread overview]
Message-ID: <200903132149.12780.bzolnier@gmail.com> (raw)


Hi,

ide-floppy regression fix (from Borislav Petkov) and an important
bug fix for DMA mapping code (from FUJITA Tomonori).


Linus, please pull from:

master.kernel.org:/pub/scm/linux/kernel/git/bart/ide-2.6.git/

to receive the following updates:

 drivers/ide/ide-atapi.c  |   12 ++++++++++++
 drivers/ide/ide-dma.c    |   12 +++++++++---
 drivers/ide/ide-floppy.c |    6 ++++--
 include/linux/ide.h      |    1 +
 4 files changed, 26 insertions(+), 5 deletions(-)


Borislav Petkov (1):
      ide-floppy: do not map dataless cmds to an sg

FUJITA Tomonori (1):
      ide: save the returned value of dma_map_sg


diff --git a/drivers/ide/ide-atapi.c b/drivers/ide/ide-atapi.c
index e96c012..e9d042d 100644
--- a/drivers/ide/ide-atapi.c
+++ b/drivers/ide/ide-atapi.c
@@ -140,6 +140,12 @@ static void ide_queue_pc_head(ide_drive_t *drive, struct gendisk *disk,
 	rq->cmd_flags |= REQ_PREEMPT;
 	rq->buffer = (char *)pc;
 	rq->rq_disk = disk;
+
+	if (pc->req_xfer) {
+		rq->data = pc->buf;
+		rq->data_len = pc->req_xfer;
+	}
+
 	memcpy(rq->cmd, pc->c, 12);
 	if (drive->media == ide_tape)
 		rq->cmd[13] = REQ_IDETAPE_PC1;
@@ -159,6 +165,12 @@ int ide_queue_pc_tail(ide_drive_t *drive, struct gendisk *disk,
 	rq = blk_get_request(drive->queue, READ, __GFP_WAIT);
 	rq->cmd_type = REQ_TYPE_SPECIAL;
 	rq->buffer = (char *)pc;
+
+	if (pc->req_xfer) {
+		rq->data = pc->buf;
+		rq->data_len = pc->req_xfer;
+	}
+
 	memcpy(rq->cmd, pc->c, 12);
 	if (drive->media == ide_tape)
 		rq->cmd[13] = REQ_IDETAPE_PC1;
diff --git a/drivers/ide/ide-dma.c b/drivers/ide/ide-dma.c
index 72ebab0..059c90b 100644
--- a/drivers/ide/ide-dma.c
+++ b/drivers/ide/ide-dma.c
@@ -128,6 +128,7 @@ int ide_build_sglist(ide_drive_t *drive, struct request *rq)
 {
 	ide_hwif_t *hwif = drive->hwif;
 	struct scatterlist *sg = hwif->sg_table;
+	int i;
 
 	ide_map_sg(drive, rq);
 
@@ -136,8 +137,13 @@ int ide_build_sglist(ide_drive_t *drive, struct request *rq)
 	else
 		hwif->sg_dma_direction = DMA_TO_DEVICE;
 
-	return dma_map_sg(hwif->dev, sg, hwif->sg_nents,
-			  hwif->sg_dma_direction);
+	i = dma_map_sg(hwif->dev, sg, hwif->sg_nents, hwif->sg_dma_direction);
+	if (i) {
+		hwif->orig_sg_nents = hwif->sg_nents;
+		hwif->sg_nents = i;
+	}
+
+	return i;
 }
 EXPORT_SYMBOL_GPL(ide_build_sglist);
 
@@ -156,7 +162,7 @@ void ide_destroy_dmatable(ide_drive_t *drive)
 {
 	ide_hwif_t *hwif = drive->hwif;
 
-	dma_unmap_sg(hwif->dev, hwif->sg_table, hwif->sg_nents,
+	dma_unmap_sg(hwif->dev, hwif->sg_table, hwif->orig_sg_nents,
 		     hwif->sg_dma_direction);
 }
 EXPORT_SYMBOL_GPL(ide_destroy_dmatable);
diff --git a/drivers/ide/ide-floppy.c b/drivers/ide/ide-floppy.c
index 3eab1c6..317ec62 100644
--- a/drivers/ide/ide-floppy.c
+++ b/drivers/ide/ide-floppy.c
@@ -327,8 +327,10 @@ static ide_startstop_t ide_floppy_do_request(ide_drive_t *drive,
 		return ide_stopped;
 	}
 
-	ide_init_sg_cmd(drive, rq);
-	ide_map_sg(drive, rq);
+	if (blk_fs_request(rq) || pc->req_xfer) {
+		ide_init_sg_cmd(drive, rq);
+		ide_map_sg(drive, rq);
+	}
 
 	pc->sg = hwif->sg_table;
 	pc->sg_cnt = hwif->sg_nents;
diff --git a/include/linux/ide.h b/include/linux/ide.h
index e0cedfe..25087ae 100644
--- a/include/linux/ide.h
+++ b/include/linux/ide.h
@@ -797,6 +797,7 @@ typedef struct hwif_s {
 	struct scatterlist *sg_table;
 	int sg_max_nents;		/* Maximum number of entries in it */
 	int sg_nents;			/* Current number of entries in it */
+	int orig_sg_nents;
 	int sg_dma_direction;		/* dma transfer direction */
 
 	/* data phase of the active command (currently only valid for PIO/DMA) */

             reply	other threads:[~2009-03-13 20:48 UTC|newest]

Thread overview: 58+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-03-13 20:49 Bartlomiej Zolnierkiewicz [this message]
  -- strict thread matches above, loose matches on Subject: below --
2009-06-07 12:44 [git pull] IDE fixes Bartlomiej Zolnierkiewicz
2009-06-07 14:21 ` Alan Cox
2009-06-07 14:32   ` Bartlomiej Zolnierkiewicz
2009-06-07 14:40     ` Alan Cox
2009-06-07 15:03       ` Bartlomiej Zolnierkiewicz
2009-06-07 15:11         ` Alan Cox
2009-06-07 14:38   ` James Bottomley
2009-06-07 14:57     ` Bartlomiej Zolnierkiewicz
2009-06-07 15:18       ` James Bottomley
2009-06-07 15:44         ` Bartlomiej Zolnierkiewicz
2009-06-07 16:08           ` James Bottomley
2009-06-07 17:47             ` Bartlomiej Zolnierkiewicz
2009-06-07 19:08               ` James Bottomley
2009-06-07 19:23                 ` Bartlomiej Zolnierkiewicz
2009-06-07 20:07                 ` Alan Cox
2009-06-07 20:39                   ` James Bottomley
2009-06-07 21:08                     ` Bartlomiej Zolnierkiewicz
2009-06-07 20:42                   ` Bartlomiej Zolnierkiewicz
2009-06-07 16:54           ` Pekka Enberg
2009-06-07 17:55             ` Bartlomiej Zolnierkiewicz
2009-06-07 18:21               ` Pekka Enberg
2009-06-07 19:00                 ` Bartlomiej Zolnierkiewicz
2009-06-07 19:09                   ` Pekka Enberg
2009-06-07 19:25                     ` Bartlomiej Zolnierkiewicz
2009-06-07 23:15                       ` Linus Torvalds
2009-06-07 23:47                         ` Bartlomiej Zolnierkiewicz
2009-06-07 23:57                           ` Linus Torvalds
2009-06-08  0:54                             ` Bartlomiej Zolnierkiewicz
2009-06-07 23:14               ` Linus Torvalds
2009-06-07 23:12       ` Linus Torvalds
2009-05-22 15:17 Bartlomiej Zolnierkiewicz
2009-05-16 19:16 Bartlomiej Zolnierkiewicz
2009-05-16 19:22 ` Borislav Petkov
2009-05-16 19:33   ` Bartlomiej Zolnierkiewicz
2009-04-22 18:48 Bartlomiej Zolnierkiewicz
2009-04-22 19:06 ` Joe Perches
2009-04-22 19:22   ` Sam Ravnborg
2009-04-22 19:43   ` Bartlomiej Zolnierkiewicz
2009-04-22 19:55     ` Joe Perches
2009-04-22 21:41       ` Bartlomiej Zolnierkiewicz
2009-04-22 22:02         ` Ray Lee
2009-04-22 22:51           ` Bartlomiej Zolnierkiewicz
2009-04-22 22:58           ` Bartlomiej Zolnierkiewicz
2009-04-18 16:09 Bartlomiej Zolnierkiewicz
2009-03-05 15:30 Bartlomiej Zolnierkiewicz
2009-03-05 16:27 ` Bartlomiej Zolnierkiewicz
2009-02-25 19:54 Bartlomiej Zolnierkiewicz
2009-02-02 19:48 Bartlomiej Zolnierkiewicz
2009-01-19 12:50 Bartlomiej Zolnierkiewicz
2008-12-22 22:08 Bartlomiej Zolnierkiewicz
2008-12-08 16:55 Bartlomiej Zolnierkiewicz
2008-10-05 16:38 Bartlomiej Zolnierkiewicz
2008-09-27 17:47 Bartlomiej Zolnierkiewicz
2008-09-10 20:47 Bartlomiej Zolnierkiewicz
2008-09-02 18:24 Bartlomiej Zolnierkiewicz
2008-08-18 20:22 Bartlomiej Zolnierkiewicz
2008-07-08 17:38 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=200903132149.12780.bzolnier@gmail.com \
    --to=bzolnier@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-ide@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sfr@canb.auug.org.au \
    --cc=torvalds@linux-foundation.org \
    /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).