aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide/ide-io.c
diff options
context:
space:
mode:
authorBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2009-03-27 07:46:38 -0400
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2009-03-27 07:46:38 -0400
commitb6308ee0c55acd2e943d849773c9f0a49c516317 (patch)
treee56f59a7935fccdf0145ffd4638a066bf4ba1e17 /drivers/ide/ide-io.c
parentadb1af9803d167091c2cb4de14014185054bfe2c (diff)
ide: move command related fields from ide_hwif_t to struct ide_cmd
* Move command related fields from ide_hwif_t to struct ide_cmd. * Make ide_init_sg_cmd() take command and sectors number as arguments. There should be no functional changes caused by this patch. Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers/ide/ide-io.c')
-rw-r--r--drivers/ide/ide-io.c24
1 files changed, 10 insertions, 14 deletions
diff --git a/drivers/ide/ide-io.c b/drivers/ide/ide-io.c
index 2900271c6ddd..7917fa09bf15 100644
--- a/drivers/ide/ide-io.c
+++ b/drivers/ide/ide-io.c
@@ -274,30 +274,26 @@ static ide_startstop_t do_special (ide_drive_t *drive)
274void ide_map_sg(ide_drive_t *drive, struct request *rq) 274void ide_map_sg(ide_drive_t *drive, struct request *rq)
275{ 275{
276 ide_hwif_t *hwif = drive->hwif; 276 ide_hwif_t *hwif = drive->hwif;
277 struct ide_cmd *cmd = &hwif->cmd;
277 struct scatterlist *sg = hwif->sg_table; 278 struct scatterlist *sg = hwif->sg_table;
278 279
279 if (rq->cmd_type == REQ_TYPE_ATA_TASKFILE) { 280 if (rq->cmd_type == REQ_TYPE_ATA_TASKFILE) {
280 sg_init_one(sg, rq->buffer, rq->nr_sectors * SECTOR_SIZE); 281 sg_init_one(sg, rq->buffer, rq->nr_sectors * SECTOR_SIZE);
281 hwif->sg_nents = 1; 282 cmd->sg_nents = 1;
282 } else if (!rq->bio) { 283 } else if (!rq->bio) {
283 sg_init_one(sg, rq->data, rq->data_len); 284 sg_init_one(sg, rq->data, rq->data_len);
284 hwif->sg_nents = 1; 285 cmd->sg_nents = 1;
285 } else { 286 } else
286 hwif->sg_nents = blk_rq_map_sg(drive->queue, rq, sg); 287 cmd->sg_nents = blk_rq_map_sg(drive->queue, rq, sg);
287 }
288} 288}
289
290EXPORT_SYMBOL_GPL(ide_map_sg); 289EXPORT_SYMBOL_GPL(ide_map_sg);
291 290
292void ide_init_sg_cmd(ide_drive_t *drive, struct request *rq) 291void ide_init_sg_cmd(struct ide_cmd *cmd, int nsect)
293{ 292{
294 ide_hwif_t *hwif = drive->hwif; 293 cmd->nsect = cmd->nleft = nsect;
295 294 cmd->cursg_ofs = 0;
296 hwif->nsect = hwif->nleft = rq->nr_sectors; 295 cmd->cursg = NULL;
297 hwif->cursg_ofs = 0;
298 hwif->cursg = NULL;
299} 296}
300
301EXPORT_SYMBOL_GPL(ide_init_sg_cmd); 297EXPORT_SYMBOL_GPL(ide_init_sg_cmd);
302 298
303/** 299/**
@@ -323,7 +319,7 @@ static ide_startstop_t execute_drive_cmd (ide_drive_t *drive,
323 case TASKFILE_OUT: 319 case TASKFILE_OUT:
324 case TASKFILE_MULTI_IN: 320 case TASKFILE_MULTI_IN:
325 case TASKFILE_IN: 321 case TASKFILE_IN:
326 ide_init_sg_cmd(drive, rq); 322 ide_init_sg_cmd(cmd, rq->nr_sectors);
327 ide_map_sg(drive, rq); 323 ide_map_sg(drive, rq);
328 default: 324 default:
329 break; 325 break;