Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 34b7d2c9 authored by Tejun Heo's avatar Tejun Heo Committed by Jens Axboe
Browse files

ide: cleanup rq->data_len usages



With recent unification of fields, it's now guaranteed that
rq->data_len always equals blk_rq_bytes().  Convert all direct users
to accessors.

[ Impact: convert direct rq->data_len usages to blk_rq_bytes() ]

Signed-off-by: default avatarTejun Heo <tj@kernel.org>
Acked-by: default avatarBartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Cc: Borislav Petkov <petkovbb@googlemail.com>
Cc: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: default avatarJens Axboe <jens.axboe@oracle.com>
parent b0790410
Loading
Loading
Loading
Loading
+2 −2
Original line number Original line Diff line number Diff line
@@ -255,7 +255,7 @@ void ide_retry_pc(ide_drive_t *drive)
	ide_init_pc(pc);
	ide_init_pc(pc);
	memcpy(pc->c, sense_rq->cmd, 12);
	memcpy(pc->c, sense_rq->cmd, 12);
	pc->buf = bio_data(sense_rq->bio);	/* pointer to mapped address */
	pc->buf = bio_data(sense_rq->bio);	/* pointer to mapped address */
	pc->req_xfer = sense_rq->data_len;
	pc->req_xfer = blk_rq_bytes(sense_rq);


	if (drive->media == ide_tape)
	if (drive->media == ide_tape)
		set_bit(IDE_AFLAG_IGNORE_DSC, &drive->atapi_flags);
		set_bit(IDE_AFLAG_IGNORE_DSC, &drive->atapi_flags);
@@ -303,7 +303,7 @@ int ide_cd_get_xferlen(struct request *rq)
		return 32768;
		return 32768;
	else if (blk_sense_request(rq) || blk_pc_request(rq) ||
	else if (blk_sense_request(rq) || blk_pc_request(rq) ||
			 rq->cmd_type == REQ_TYPE_ATA_PC)
			 rq->cmd_type == REQ_TYPE_ATA_PC)
		return rq->data_len;
		return blk_rq_bytes(rq);
	else
	else
		return 0;
		return 0;
}
}
+7 −18
Original line number Original line Diff line number Diff line
@@ -577,7 +577,7 @@ static ide_startstop_t cdrom_newpc_intr(ide_drive_t *drive)
	struct request *rq = hwif->rq;
	struct request *rq = hwif->rq;
	ide_expiry_t *expiry = NULL;
	ide_expiry_t *expiry = NULL;
	int dma_error = 0, dma, thislen, uptodate = 0;
	int dma_error = 0, dma, thislen, uptodate = 0;
	int write = (rq_data_dir(rq) == WRITE) ? 1 : 0, rc = 0, nsectors;
	int write = (rq_data_dir(rq) == WRITE) ? 1 : 0, rc = 0;
	int sense = blk_sense_request(rq);
	int sense = blk_sense_request(rq);
	unsigned int timeout;
	unsigned int timeout;
	u16 len;
	u16 len;
@@ -707,9 +707,7 @@ static ide_startstop_t cdrom_newpc_intr(ide_drive_t *drive)


out_end:
out_end:
	if (blk_pc_request(rq) && rc == 0) {
	if (blk_pc_request(rq) && rc == 0) {
		if (blk_end_request(rq, 0, rq->data_len))
		blk_end_request_all(rq, 0);
			BUG();

		hwif->rq = NULL;
		hwif->rq = NULL;
	} else {
	} else {
		if (sense && uptodate)
		if (sense && uptodate)
@@ -727,22 +725,14 @@ out_end:
			ide_cd_error_cmd(drive, cmd);
			ide_cd_error_cmd(drive, cmd);


		/* make sure it's fully ended */
		/* make sure it's fully ended */
		if (blk_pc_request(rq))
			nsectors = (rq->data_len + 511) >> 9;
		else
			nsectors = blk_rq_sectors(rq);

		if (nsectors == 0)
			nsectors = 1;

		if (blk_fs_request(rq) == 0) {
		if (blk_fs_request(rq) == 0) {
			rq->resid_len = rq->data_len -
			rq->resid_len = blk_rq_bytes(rq) -
				(cmd->nbytes - cmd->nleft);
				(cmd->nbytes - cmd->nleft);
			if (uptodate == 0 && (cmd->tf_flags & IDE_TFLAG_WRITE))
			if (uptodate == 0 && (cmd->tf_flags & IDE_TFLAG_WRITE))
				rq->resid_len += cmd->last_xfer_len;
				rq->resid_len += cmd->last_xfer_len;
		}
		}


		ide_complete_rq(drive, uptodate ? 0 : -EIO, nsectors << 9);
		ide_complete_rq(drive, uptodate ? 0 : -EIO, blk_rq_bytes(rq));


		if (sense && rc == 2)
		if (sense && rc == 2)
			ide_error(drive, "request sense failure", stat);
			ide_error(drive, "request sense failure", stat);
@@ -819,7 +809,7 @@ static void cdrom_do_block_pc(ide_drive_t *drive, struct request *rq)
		 */
		 */
		alignment = queue_dma_alignment(q) | q->dma_pad_mask;
		alignment = queue_dma_alignment(q) | q->dma_pad_mask;
		if ((unsigned long)buf & alignment
		if ((unsigned long)buf & alignment
		    || rq->data_len & q->dma_pad_mask
		    || blk_rq_bytes(rq) & q->dma_pad_mask
		    || object_is_on_stack(buf))
		    || object_is_on_stack(buf))
			drive->dma = 0;
			drive->dma = 0;
	}
	}
@@ -867,9 +857,8 @@ static ide_startstop_t ide_cd_do_request(ide_drive_t *drive, struct request *rq,


	cmd.rq = rq;
	cmd.rq = rq;


	if (blk_fs_request(rq) || rq->data_len) {
	if (blk_fs_request(rq) || blk_rq_bytes(rq)) {
		ide_init_sg_cmd(&cmd, blk_fs_request(rq) ?
		ide_init_sg_cmd(&cmd, blk_rq_bytes(rq));
				(blk_rq_sectors(rq) << 9) : rq->data_len);
		ide_map_sg(drive, &cmd);
		ide_map_sg(drive, &cmd);
	}
	}


+2 −2
Original line number Original line Diff line number Diff line
@@ -220,14 +220,14 @@ static void idefloppy_blockpc_cmd(struct ide_disk_obj *floppy,
	ide_init_pc(pc);
	ide_init_pc(pc);
	memcpy(pc->c, rq->cmd, sizeof(pc->c));
	memcpy(pc->c, rq->cmd, sizeof(pc->c));
	pc->rq = rq;
	pc->rq = rq;
	if (rq->data_len) {
	if (blk_rq_bytes(rq)) {
		pc->flags |= PC_FLAG_DMA_OK;
		pc->flags |= PC_FLAG_DMA_OK;
		if (rq_data_dir(rq) == WRITE)
		if (rq_data_dir(rq) == WRITE)
			pc->flags |= PC_FLAG_WRITING;
			pc->flags |= PC_FLAG_WRITING;
	}
	}
	/* pio will be performed by ide_pio_bytes() which handles sg fine */
	/* pio will be performed by ide_pio_bytes() which handles sg fine */
	pc->buf = NULL;
	pc->buf = NULL;
	pc->req_xfer = pc->buf_size = rq->data_len;
	pc->req_xfer = pc->buf_size = blk_rq_bytes(rq);
}
}


static ide_startstop_t ide_floppy_do_request(ide_drive_t *drive,
static ide_startstop_t ide_floppy_do_request(ide_drive_t *drive,
+1 −1
Original line number Original line Diff line number Diff line
@@ -116,7 +116,7 @@ void ide_complete_cmd(ide_drive_t *drive, struct ide_cmd *cmd, u8 stat, u8 err)
unsigned int ide_rq_bytes(struct request *rq)
unsigned int ide_rq_bytes(struct request *rq)
{
{
	if (blk_pc_request(rq))
	if (blk_pc_request(rq))
		return rq->data_len;
		return blk_rq_bytes(rq);
	else
	else
		return blk_rq_cur_sectors(rq) << 9;
		return blk_rq_cur_sectors(rq) << 9;
}
}
+1 −1
Original line number Original line Diff line number Diff line
@@ -380,7 +380,7 @@ static int ide_tape_callback(ide_drive_t *drive, int dsc)
		}
		}


		tape->first_frame += blocks;
		tape->first_frame += blocks;
		rq->resid_len = rq->data_len - blocks * tape->blk_size;
		rq->resid_len = blk_rq_bytes(rq) - blocks * tape->blk_size;


		if (pc->error) {
		if (pc->error) {
			uptodate = 0;
			uptodate = 0;