]> git.baikalelectronics.ru Git - kernel.git/commit
nvme: switch controller refcounting to use struct device
authorChristoph Hellwig <hch@lst.de>
Wed, 18 Oct 2017 11:25:42 +0000 (13:25 +0200)
committerChristoph Hellwig <hch@lst.de>
Fri, 27 Oct 2017 06:04:07 +0000 (09:04 +0300)
commita6a0c8f88d2e2243c191f8725dcf3e55194f2a98
tree660bfba4f33f5a4cd6199bdca79f83438b70bcb6
parentf6a2c15e3fec28abce55a4ffddcb524cab2d2d55
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>
drivers/nvme/host/core.c
drivers/nvme/host/fc.c
drivers/nvme/host/nvme.h
drivers/nvme/host/pci.c
drivers/nvme/host/rdma.c
drivers/nvme/target/loop.c