mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-28 02:32:09 -04:00
[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 <[email protected]> Signed-off-by: James Bottomley <[email protected]>
This commit is contained in:
parent
643eb2d932
commit
97f46ae45c
4 changed files with 41 additions and 20 deletions
|
|
@ -889,7 +889,7 @@ int scsi_sysfs_add_sdev(struct scsi_device *sdev)
|
|||
goto out;
|
||||
}
|
||||
|
||||
error = bsg_register_queue(rq, &sdev->sdev_gendev, NULL);
|
||||
error = bsg_register_queue(rq, &sdev->sdev_gendev, NULL, NULL);
|
||||
|
||||
if (error)
|
||||
sdev_printk(KERN_INFO, sdev,
|
||||
|
|
|
|||
|
|
@ -219,7 +219,7 @@ static int sas_bsg_initialize(struct Scsi_Host *shost, struct sas_rphy *rphy)
|
|||
if (!q)
|
||||
return -ENOMEM;
|
||||
|
||||
error = bsg_register_queue(q, dev, name);
|
||||
error = bsg_register_queue(q, dev, name, NULL);
|
||||
if (error) {
|
||||
blk_cleanup_queue(q);
|
||||
return -ENOMEM;
|
||||
|
|
|
|||
Loading…
Reference in a new issue