Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

bsg: provide bsg_remove_queue() helper

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

Cc: linux-scsi@vger.kernel.org
Reviewed-by: Hannes Reinecke <hare@suse.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Tested-by: Benjamin Block <bblock@linux.vnet.ibm.com>
Tested-by: Ming Lei <ming.lei@redhat.com>
Reviewed-by: Omar Sandoval <osandov@fb.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>

+14 -14
+9
block/bsg-lib.c
··· 296 296 kfree(job->reply); 297 297 } 298 298 299 + void bsg_remove_queue(struct request_queue *q) 300 + { 301 + if (q) { 302 + bsg_unregister_queue(q); 303 + blk_cleanup_queue(q); 304 + } 305 + } 306 + EXPORT_SYMBOL_GPL(bsg_remove_queue); 307 + 299 308 /** 300 309 * bsg_setup_queue - Create and add the bsg hooks so we can receive requests 301 310 * @dev: device to attach bsg device to
+1 -4
drivers/scsi/scsi_transport_fc.c
··· 3851 3851 static void 3852 3852 fc_bsg_remove(struct request_queue *q) 3853 3853 { 3854 - if (q) { 3855 - bsg_unregister_queue(q); 3856 - blk_cleanup_queue(q); 3857 - } 3854 + bsg_remove_queue(q); 3858 3855 } 3859 3856 3860 3857
+1 -4
drivers/scsi/scsi_transport_iscsi.c
··· 1576 1576 struct Scsi_Host *shost = dev_to_shost(dev); 1577 1577 struct iscsi_cls_host *ihost = shost->shost_data; 1578 1578 1579 - if (ihost->bsg_q) { 1580 - bsg_unregister_queue(ihost->bsg_q); 1581 - blk_cleanup_queue(ihost->bsg_q); 1582 - } 1579 + bsg_remove_queue(ihost->bsg_q); 1583 1580 return 0; 1584 1581 } 1585 1582
+1 -5
drivers/scsi/scsi_transport_sas.c
··· 246 246 struct Scsi_Host *shost = dev_to_shost(dev); 247 247 struct request_queue *q = to_sas_host_attrs(shost)->q; 248 248 249 - if (q) { 250 - bsg_unregister_queue(q); 251 - blk_cleanup_queue(q); 252 - } 253 - 249 + bsg_remove_queue(q); 254 250 return 0; 255 251 } 256 252
+1 -1
drivers/scsi/ufs/ufs_bsg.c
··· 157 157 if (!hba->bsg_queue) 158 158 return; 159 159 160 - bsg_unregister_queue(hba->bsg_queue); 160 + bsg_remove_queue(hba->bsg_queue); 161 161 162 162 device_del(bsg_dev); 163 163 put_device(bsg_dev);
+1
include/linux/bsg-lib.h
··· 73 73 unsigned int reply_payload_rcv_len); 74 74 struct request_queue *bsg_setup_queue(struct device *dev, const char *name, 75 75 bsg_job_fn *job_fn, rq_timed_out_fn *timeout, int dd_job_size); 76 + void bsg_remove_queue(struct request_queue *q); 76 77 void bsg_job_put(struct bsg_job *job); 77 78 int __must_check bsg_job_get(struct bsg_job *job); 78 79