summaryrefslogtreecommitdiffstats
path: root/drivers/nvme/target/loop.c
diff options
context:
space:
mode:
authorChristoph Hellwig2017-10-18 13:25:42 +0200
committerChristoph Hellwig2017-10-27 08:04:07 +0200
commitd22524a4782a943bb02a9cf6885ac470210aabfc (patch)
tree660bfba4f33f5a4cd6199bdca79f83438b70bcb6 /drivers/nvme/target/loop.c
parentnvme: simplify nvme_open (diff)
downloadkernel-qcow2-linux-d22524a4782a943bb02a9cf6885ac470210aabfc.tar.gz
kernel-qcow2-linux-d22524a4782a943bb02a9cf6885ac470210aabfc.tar.xz
kernel-qcow2-linux-d22524a4782a943bb02a9cf6885ac470210aabfc.zip
nvme: switch controller refcounting to use struct device
Instead of allocating a separate struct device for the character device handle embedd it into struct nvme_ctrl and use it for the main controller refcounting. This removes double refcounting and gets us an automatic reference for the character device operations. We keep ctrl->device as a pointer for now to avoid chaning printks all over, but in the future we could look into message printing helpers that take a controller structure similar to what other subsystems do. Note the delete_ctrl operation always already has a reference (either through sysfs due this change, or because every open file on the /dev/nvme-fabrics node has a refernece) when it is entered now, so we don't need to do the unless_zero variant there. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Hannes Reinecke <hare@suse.com>
Diffstat (limited to 'drivers/nvme/target/loop.c')
-rw-r--r--drivers/nvme/target/loop.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/nvme/target/loop.c b/drivers/nvme/target/loop.c
index c56354e1e4c6..f83e925fe64a 100644
--- a/drivers/nvme/target/loop.c
+++ b/drivers/nvme/target/loop.c
@@ -642,7 +642,7 @@ static struct nvme_ctrl *nvme_loop_create_ctrl(struct device *dev,
dev_info(ctrl->ctrl.device,
"new ctrl: \"%s\"\n", ctrl->ctrl.opts->subsysnqn);
- kref_get(&ctrl->ctrl.kref);
+ nvme_get_ctrl(&ctrl->ctrl);
changed = nvme_change_ctrl_state(&ctrl->ctrl, NVME_CTRL_LIVE);
WARN_ON_ONCE(!changed);