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

Commit 5e28b8d8 authored by Jens Axboe's avatar Jens Axboe
Browse files

bsg: provide bsg_remove_queue() helper



All drivers do unregister + cleanup, provide a helper for that.

Cc: linux-scsi@vger.kernel.org
Reviewed-by: default avatarHannes Reinecke <hare@suse.com>
Reviewed-by: default avatarJohannes Thumshirn <jthumshirn@suse.de>
Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
Tested-by: default avatarBenjamin Block <bblock@linux.vnet.ibm.com>
Tested-by: default avatarMing Lei <ming.lei@redhat.com>
Reviewed-by: default avatarOmar Sandoval <osandov@fb.com>
Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent aae3b069
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -296,6 +296,15 @@ static void bsg_exit_rq(struct request_queue *q, struct request *req)
	kfree(job->reply);
}

void bsg_remove_queue(struct request_queue *q)
{
	if (q) {
		bsg_unregister_queue(q);
		blk_cleanup_queue(q);
	}
}
EXPORT_SYMBOL_GPL(bsg_remove_queue);

/**
 * bsg_setup_queue - Create and add the bsg hooks so we can receive requests
 * @dev: device to attach bsg device to
+1 −4
Original line number Diff line number Diff line
@@ -3851,10 +3851,7 @@ fc_bsg_rportadd(struct Scsi_Host *shost, struct fc_rport *rport)
static void
fc_bsg_remove(struct request_queue *q)
{
	if (q) {
		bsg_unregister_queue(q);
		blk_cleanup_queue(q);
	}
	bsg_remove_queue(q);
}


+1 −4
Original line number Diff line number Diff line
@@ -1576,10 +1576,7 @@ static int iscsi_remove_host(struct transport_container *tc,
	struct Scsi_Host *shost = dev_to_shost(dev);
	struct iscsi_cls_host *ihost = shost->shost_data;

	if (ihost->bsg_q) {
		bsg_unregister_queue(ihost->bsg_q);
		blk_cleanup_queue(ihost->bsg_q);
	}
	bsg_remove_queue(ihost->bsg_q);
	return 0;
}

+1 −5
Original line number Diff line number Diff line
@@ -246,11 +246,7 @@ static int sas_host_remove(struct transport_container *tc, struct device *dev,
	struct Scsi_Host *shost = dev_to_shost(dev);
	struct request_queue *q = to_sas_host_attrs(shost)->q;

	if (q) {
		bsg_unregister_queue(q);
		blk_cleanup_queue(q);
	}

	bsg_remove_queue(q);
	return 0;
}

+1 −1
Original line number Diff line number Diff line
@@ -157,7 +157,7 @@ void ufs_bsg_remove(struct ufs_hba *hba)
	if (!hba->bsg_queue)
		return;

	bsg_unregister_queue(hba->bsg_queue);
	bsg_remove_queue(hba->bsg_queue);

	device_del(bsg_dev);
	put_device(bsg_dev);
Loading