Thread (40 messages) 40 messages, 6 authors, 2022-11-13

Re: [PATCH 07/12] nvme-pci: factor out a nvme_pci_alloc_ctrl helper

From: Sagi Grimberg <sagi@grimberg.me>
Date: 2022-11-09 03:03:50
Also in: asahi, linux-nvme


On 11/8/22 17:02, Christoph Hellwig wrote:
quoted hunk ↗ jump to hunk
Add a helper that allocates the nvme_dev structure up to the point where
we can call nvme_init_ctrl.  This pairs with the free_ctrl method and can
thus be used to cleanup the teardown path and make it more symmetric.

Note that this now calls nvme_init_ctrl a lot earlier during probing,
which also means the per-controller character device shows up earlier.
Due to the controller state no commnds can be send on it, but it might
make sense to delay the cdev registration until nvme_init_ctrl_finish.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
  drivers/nvme/host/pci.c | 81 +++++++++++++++++++++++------------------
  1 file changed, 46 insertions(+), 35 deletions(-)
diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c
index f7dab65bf5042..e1f60b1c6918f 100644
--- a/drivers/nvme/host/pci.c
+++ b/drivers/nvme/host/pci.c
@@ -2777,6 +2777,7 @@ static void nvme_free_tagset(struct nvme_dev *dev)
  	dev->ctrl.tagset = NULL;
  }
  
+/* pairs with nvme_pci_alloc_ctrl */
  static void nvme_pci_free_ctrl(struct nvme_ctrl *ctrl)
  {
  	struct nvme_dev *dev = to_nvme_dev(ctrl);
@@ -3090,19 +3091,23 @@ static void nvme_async_probe(void *data, async_cookie_t cookie)
  	nvme_put_ctrl(&dev->ctrl);
  }
  
-static int nvme_probe(struct pci_dev *pdev, const struct pci_device_id *id)
+static struct nvme_dev *nvme_pci_alloc_ctrl(struct pci_dev *pdev,
+		const struct pci_device_id *id)
kinda weird that nvme_pci_alloc_ctrl return struct nvme_dev. Patch looks
fine though...

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help