]> git.baikalelectronics.ru Git - kernel.git/commit
[SCSI] bsg: add release callback support
authorFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Fri, 18 Apr 2008 15:43:14 +0000 (00:43 +0900)
committerJames Bottomley <James.Bottomley@HansenPartnership.com>
Tue, 22 Apr 2008 20:16:32 +0000 (15:16 -0500)
commit5010a5990f951ed2eb5ed4cff4b332a60aa3044e
tree7e7245349c433f67be23c6a75c3936c0466b59d6
parentc298b66f1e0922268c288ce701f214ddf3925738
[SCSI] bsg: add release callback support

This patch adds release callback support, which is called when a bsg
device goes away. bsg_register_queue() takes a pointer to a callback
function. This feature is useful for stuff like sas_host that can't
use the release callback in struct device.

If a caller doesn't need bsg's release callback, it can call
bsg_register_queue() with NULL pointer (e.g. scsi devices can use
release callback in struct device so they don't need bsg's callback).

With this patch, bsg uses kref for refcounts on bsg devices instead of
get/put_device in fops->open/release. bsg calls put_device and the
caller's release callback (if it was registered) in kref_put's
release.

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
block/bsg.c
drivers/scsi/scsi_sysfs.c
drivers/scsi/scsi_transport_sas.c
include/linux/bsg.h