]> www.infradead.org Git - users/hch/block.git/commitdiff
nvme-apple: initialize max_hw_sectors earlier
authorChristoph Hellwig <hch@lst.de>
Mon, 26 Feb 2024 18:13:09 +0000 (13:13 -0500)
committerChristoph Hellwig <hch@lst.de>
Thu, 29 Feb 2024 15:23:09 +0000 (07:23 -0800)
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@lst.de>
drivers/nvme/host/apple.c

index a480cdeac2883c0eb08dbfd32fc4c1adaece7a88..12281fc6932d4033f88a6cd33cb134772ad78b7c 100644 (file)
@@ -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;