[PATCH] nvme: remove 'qid' argument in case with nvmeq

Minwoo Im minwoo.im.dev at gmail.com
Fri Nov 6 06:39:28 EST 2020


qid can be retrieved from the struct nvme_queue directly which might
already be set when the queue is allocated in nvme_alloc_queue().

This patch removed qid argument from nvme_init_queue() and
nvme_create_queue() and replaced with nvmeq->qid.

Signed-off-by: Minwoo Im <minwoo.im.dev at gmail.com>
---
 drivers/nvme/host/pci.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c
index 0578ff253c47..fec79b5246da 100644
--- a/drivers/nvme/host/pci.c
+++ b/drivers/nvme/host/pci.c
@@ -1505,9 +1505,10 @@ static int queue_request_irq(struct nvme_queue *nvmeq)
 	}
 }
 
-static void nvme_init_queue(struct nvme_queue *nvmeq, u16 qid)
+static void nvme_init_queue(struct nvme_queue *nvmeq)
 {
 	struct nvme_dev *dev = nvmeq->dev;
+	unsigned int qid = nvmeq->qid;
 
 	nvmeq->sq_tail = 0;
 	nvmeq->last_sq_tail = 0;
@@ -1520,11 +1521,12 @@ static void nvme_init_queue(struct nvme_queue *nvmeq, u16 qid)
 	wmb(); /* ensure the first interrupt sees the initialization */
 }
 
-static int nvme_create_queue(struct nvme_queue *nvmeq, int qid, bool polled)
+static int nvme_create_queue(struct nvme_queue *nvmeq, bool polled)
 {
 	struct nvme_dev *dev = nvmeq->dev;
 	int result;
 	u16 vector = 0;
+	unsigned int qid = nvmeq->qid;
 
 	clear_bit(NVMEQ_DELETE_ERROR, &nvmeq->flags);
 
@@ -1548,7 +1550,7 @@ static int nvme_create_queue(struct nvme_queue *nvmeq, int qid, bool polled)
 		goto release_cq;
 
 	nvmeq->cq_vector = vector;
-	nvme_init_queue(nvmeq, qid);
+	nvme_init_queue(nvmeq);
 
 	if (!polled) {
 		result = queue_request_irq(nvmeq);
@@ -1699,7 +1701,7 @@ static int nvme_pci_configure_admin_queue(struct nvme_dev *dev)
 		return result;
 
 	nvmeq->cq_vector = 0;
-	nvme_init_queue(nvmeq, 0);
+	nvme_init_queue(nvmeq);
 	result = queue_request_irq(nvmeq);
 	if (result) {
 		dev->online_queues--;
@@ -1733,7 +1735,7 @@ static int nvme_create_io_queues(struct nvme_dev *dev)
 	for (i = dev->online_queues; i <= max; i++) {
 		bool polled = i > rw_queues;
 
-		ret = nvme_create_queue(&dev->queues[i], i, polled);
+		ret = nvme_create_queue(&dev->queues[i], polled);
 		if (ret)
 			break;
 	}
-- 
2.17.1




More information about the Linux-nvme mailing list