[PATCH 19/21] nvme-apple: initialize max_hw_sectors earlier
Christoph Hellwig
hch at lst.de
Wed Feb 28 10:12:13 PST 2024
Initialize max_hw_sectors and max_sectors a little earlier so they
can be passed directly to blk_mq_alloc_queue.
Signed-off-by: Christoph Hellwig <hch at lst.de>
---
drivers/nvme/host/apple.c | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/drivers/nvme/host/apple.c b/drivers/nvme/host/apple.c
index a480cdeac2883c..12281fc6932d40 100644
--- a/drivers/nvme/host/apple.c
+++ b/drivers/nvme/host/apple.c
@@ -1046,14 +1046,6 @@ static void apple_nvme_reset_work(struct work_struct *work)
dev_dbg(anv->dev, "ANS booted successfully.");
- /*
- * Limit the max command size to prevent iod->sg allocations going
- * over a single page.
- */
- anv->ctrl.max_hw_sectors = min_t(u32, NVME_MAX_KB_SZ << 1,
- dma_max_mapping_size(anv->dev) >> 9);
- anv->ctrl.max_segments = NVME_MAX_SEGS;
-
dma_set_max_seg_size(anv->dev, 0xffffffff);
/*
@@ -1516,6 +1508,14 @@ static int apple_nvme_probe(struct platform_device *pdev)
goto put_dev;
}
+ /*
+ * Limit the max command size to prevent iod->sg allocations going
+ * over a single page.
+ */
+ anv->ctrl.max_hw_sectors = min_t(u32, NVME_MAX_KB_SZ << 1,
+ dma_max_mapping_size(anv->dev) >> 9);
+ anv->ctrl.max_segments = NVME_MAX_SEGS;
+
anv->ctrl.admin_q = blk_mq_alloc_queue(&anv->admin_tagset, NULL, NULL);
if (IS_ERR(anv->ctrl.admin_q)) {
ret = -ENOMEM;
--
2.39.2
More information about the Linux-nvme
mailing list