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

Commit ca18d6f7 authored by Bart Van Assche's avatar Bart Van Assche Committed by Jens Axboe
Browse files

block: Make most scsi_req_init() calls implicit



Instead of explicitly calling scsi_req_init() after blk_get_request(),
call that function from inside blk_get_request(). Add an
.initialize_rq_fn() callback function to the block drivers that need
it. Merge the IDE .init_rq_fn() function into .initialize_rq_fn()
because it is too small to keep it as a separate function. Keep the
scsi_req_init() call in ide_prep_sense() because it follows a
blk_rq_init() call.

References: commit 82ed4db4 ("block: split scsi_request out of struct request")
Signed-off-by: default avatarBart Van Assche <bart.vanassche@sandisk.com>
Cc: Christoph Hellwig <hch@lst.de>
Cc: Hannes Reinecke <hare@suse.com>
Cc: Omar Sandoval <osandov@fb.com>
Cc: Nicholas Bellinger <nab@linux-iscsi.org>
Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent d280bab3
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -236,7 +236,6 @@ bsg_map_hdr(struct bsg_device *bd, struct sg_io_v4 *hdr, fmode_t has_write_perm)
	rq = blk_get_request(q, op, GFP_KERNEL);
	if (IS_ERR(rq))
		return rq;
	scsi_req_init(rq);

	ret = blk_fill_sgv4_hdr_rq(q, rq, hdr, bd, has_write_perm);
	if (ret)
+0 −3
Original line number Diff line number Diff line
@@ -326,7 +326,6 @@ static int sg_io(struct request_queue *q, struct gendisk *bd_disk,
	if (IS_ERR(rq))
		return PTR_ERR(rq);
	req = scsi_req(rq);
	scsi_req_init(rq);

	if (hdr->cmd_len > BLK_MAX_CDB) {
		req->cmd = kzalloc(hdr->cmd_len, GFP_KERNEL);
@@ -456,7 +455,6 @@ int sg_scsi_ioctl(struct request_queue *q, struct gendisk *disk, fmode_t mode,
		goto error_free_buffer;
	}
	req = scsi_req(rq);
	scsi_req_init(rq);

	cmdlen = COMMAND_SIZE(opcode);

@@ -542,7 +540,6 @@ static int __blk_send_generic(struct request_queue *q, struct gendisk *bd_disk,
	rq = blk_get_request(q, REQ_OP_SCSI_OUT, __GFP_RECLAIM);
	if (IS_ERR(rq))
		return PTR_ERR(rq);
	scsi_req_init(rq);
	rq->timeout = BLK_DEFAULT_SG_TIMEOUT;
	scsi_req(rq)->cmd[0] = cmd;
	scsi_req(rq)->cmd[4] = data;
+0 −1
Original line number Diff line number Diff line
@@ -708,7 +708,6 @@ static int pkt_generic_packet(struct pktcdvd_device *pd, struct packet_command *
			     REQ_OP_SCSI_OUT : REQ_OP_SCSI_IN, __GFP_RECLAIM);
	if (IS_ERR(rq))
		return PTR_ERR(rq);
	scsi_req_init(rq);

	if (cgc->buflen) {
		ret = blk_rq_map_kern(q, rq, cgc->buffer, cgc->buflen,
+0 −1
Original line number Diff line number Diff line
@@ -2201,7 +2201,6 @@ static int cdrom_read_cdda_bpc(struct cdrom_device_info *cdi, __u8 __user *ubuf,
			break;
		}
		req = scsi_req(rq);
		scsi_req_init(rq);

		ret = blk_rq_map_user(q, rq, NULL, ubuf, len, GFP_KERNEL);
		if (ret) {
+0 −1
Original line number Diff line number Diff line
@@ -93,7 +93,6 @@ int ide_queue_pc_tail(ide_drive_t *drive, struct gendisk *disk,
	int error;

	rq = blk_get_request(drive->queue, REQ_OP_DRV_IN, __GFP_RECLAIM);
	scsi_req_init(rq);
	ide_req(rq)->type = ATA_PRIV_MISC;
	rq->special = (char *)pc;

Loading