diff options
Diffstat (limited to 'drivers/ide')
-rw-r--r-- | drivers/ide/ide-atapi.c | 12 | ||||
-rw-r--r-- | drivers/ide/ide-dma.c | 12 | ||||
-rw-r--r-- | drivers/ide/ide-floppy.c | 6 |
3 files changed, 25 insertions, 5 deletions
diff --git a/drivers/ide/ide-atapi.c b/drivers/ide/ide-atapi.c index e96c01260598..e9d042dba0e0 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, | |||
140 | rq->cmd_flags |= REQ_PREEMPT; | 140 | rq->cmd_flags |= REQ_PREEMPT; |
141 | rq->buffer = (char *)pc; | 141 | rq->buffer = (char *)pc; |
142 | rq->rq_disk = disk; | 142 | rq->rq_disk = disk; |
143 | |||
144 | if (pc->req_xfer) { | ||
145 | rq->data = pc->buf; | ||
146 | rq->data_len = pc->req_xfer; | ||
147 | } | ||
148 | |||
143 | memcpy(rq->cmd, pc->c, 12); | 149 | memcpy(rq->cmd, pc->c, 12); |
144 | if (drive->media == ide_tape) | 150 | if (drive->media == ide_tape) |
145 | rq->cmd[13] = REQ_IDETAPE_PC1; | 151 | rq->cmd[13] = REQ_IDETAPE_PC1; |
@@ -159,6 +165,12 @@ int ide_queue_pc_tail(ide_drive_t *drive, struct gendisk *disk, | |||
159 | rq = blk_get_request(drive->queue, READ, __GFP_WAIT); | 165 | rq = blk_get_request(drive->queue, READ, __GFP_WAIT); |
160 | rq->cmd_type = REQ_TYPE_SPECIAL; | 166 | rq->cmd_type = REQ_TYPE_SPECIAL; |
161 | rq->buffer = (char *)pc; | 167 | rq->buffer = (char *)pc; |
168 | |||
169 | if (pc->req_xfer) { | ||
170 | rq->data = pc->buf; | ||
171 | rq->data_len = pc->req_xfer; | ||
172 | } | ||
173 | |||
162 | memcpy(rq->cmd, pc->c, 12); | 174 | memcpy(rq->cmd, pc->c, 12); |
163 | if (drive->media == ide_tape) | 175 | if (drive->media == ide_tape) |
164 | rq->cmd[13] = REQ_IDETAPE_PC1; | 176 | rq->cmd[13] = REQ_IDETAPE_PC1; |
diff --git a/drivers/ide/ide-dma.c b/drivers/ide/ide-dma.c index 72ebab0bc755..059c90bb5ad2 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) | |||
128 | { | 128 | { |
129 | ide_hwif_t *hwif = drive->hwif; | 129 | ide_hwif_t *hwif = drive->hwif; |
130 | struct scatterlist *sg = hwif->sg_table; | 130 | struct scatterlist *sg = hwif->sg_table; |
131 | int i; | ||
131 | 132 | ||
132 | ide_map_sg(drive, rq); | 133 | ide_map_sg(drive, rq); |
133 | 134 | ||
@@ -136,8 +137,13 @@ int ide_build_sglist(ide_drive_t *drive, struct request *rq) | |||
136 | else | 137 | else |
137 | hwif->sg_dma_direction = DMA_TO_DEVICE; | 138 | hwif->sg_dma_direction = DMA_TO_DEVICE; |
138 | 139 | ||
139 | return dma_map_sg(hwif->dev, sg, hwif->sg_nents, | 140 | i = dma_map_sg(hwif->dev, sg, hwif->sg_nents, hwif->sg_dma_direction); |
140 | hwif->sg_dma_direction); | 141 | if (i) { |
142 | hwif->orig_sg_nents = hwif->sg_nents; | ||
143 | hwif->sg_nents = i; | ||
144 | } | ||
145 | |||
146 | return i; | ||
141 | } | 147 | } |
142 | EXPORT_SYMBOL_GPL(ide_build_sglist); | 148 | EXPORT_SYMBOL_GPL(ide_build_sglist); |
143 | 149 | ||
@@ -156,7 +162,7 @@ void ide_destroy_dmatable(ide_drive_t *drive) | |||
156 | { | 162 | { |
157 | ide_hwif_t *hwif = drive->hwif; | 163 | ide_hwif_t *hwif = drive->hwif; |
158 | 164 | ||
159 | dma_unmap_sg(hwif->dev, hwif->sg_table, hwif->sg_nents, | 165 | dma_unmap_sg(hwif->dev, hwif->sg_table, hwif->orig_sg_nents, |
160 | hwif->sg_dma_direction); | 166 | hwif->sg_dma_direction); |
161 | } | 167 | } |
162 | EXPORT_SYMBOL_GPL(ide_destroy_dmatable); | 168 | EXPORT_SYMBOL_GPL(ide_destroy_dmatable); |
diff --git a/drivers/ide/ide-floppy.c b/drivers/ide/ide-floppy.c index 3eab1c6c9b31..317ec62c33d4 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, | |||
327 | return ide_stopped; | 327 | return ide_stopped; |
328 | } | 328 | } |
329 | 329 | ||
330 | ide_init_sg_cmd(drive, rq); | 330 | if (blk_fs_request(rq) || pc->req_xfer) { |
331 | ide_map_sg(drive, rq); | 331 | ide_init_sg_cmd(drive, rq); |
332 | ide_map_sg(drive, rq); | ||
333 | } | ||
332 | 334 | ||
333 | pc->sg = hwif->sg_table; | 335 | pc->sg = hwif->sg_table; |
334 | pc->sg_cnt = hwif->sg_nents; | 336 | pc->sg_cnt = hwif->sg_nents; |