Merge branch 'for-linus' of git://git.kernel.dk/linux-block
[muen/linux.git] / drivers / nvme / host / pci.c
index 0866f64890e5a864cdbb1cca4d253ad01289a122..4c2ff2bb26bcd7c615e40ae777327a3ba401cf3d 100644 (file)
@@ -132,7 +132,6 @@ static inline struct nvme_dev *to_nvme_dev(struct nvme_ctrl *ctrl)
 struct nvme_queue {
        struct device *q_dmadev;
        struct nvme_dev *dev;
-       char irqname[24];       /* nvme4294967295-65535\0 */
        spinlock_t q_lock;
        struct nvme_command *sq_cmds;
        struct nvme_command __iomem *sq_cmds_io;
@@ -329,11 +328,6 @@ static unsigned int nvme_cmd_size(struct nvme_dev *dev)
                nvme_iod_alloc_size(dev, NVME_INT_BYTES(dev), NVME_INT_PAGES);
 }
 
-static int nvmeq_irq(struct nvme_queue *nvmeq)
-{
-       return pci_irq_vector(to_pci_dev(nvmeq->dev->dev), nvmeq->cq_vector);
-}
-
 static int nvme_admin_init_hctx(struct blk_mq_hw_ctx *hctx, void *data,
                                unsigned int hctx_idx)
 {
@@ -1078,7 +1072,7 @@ static int nvme_suspend_queue(struct nvme_queue *nvmeq)
                spin_unlock_irq(&nvmeq->q_lock);
                return 1;
        }
-       vector = nvmeq_irq(nvmeq);
+       vector = nvmeq->cq_vector;
        nvmeq->dev->online_queues--;
        nvmeq->cq_vector = -1;
        spin_unlock_irq(&nvmeq->q_lock);
@@ -1086,7 +1080,7 @@ static int nvme_suspend_queue(struct nvme_queue *nvmeq)
        if (!nvmeq->qid && nvmeq->dev->ctrl.admin_q)
                blk_mq_stop_hw_queues(nvmeq->dev->ctrl.admin_q);
 
-       free_irq(vector, nvmeq);
+       pci_free_irq(to_pci_dev(nvmeq->dev->dev), vector, nvmeq);
 
        return 0;
 }
@@ -1171,8 +1165,6 @@ static struct nvme_queue *nvme_alloc_queue(struct nvme_dev *dev, int qid,
 
        nvmeq->q_dmadev = dev->dev;
        nvmeq->dev = dev;
-       snprintf(nvmeq->irqname, sizeof(nvmeq->irqname), "nvme%dq%d",
-                       dev->ctrl.instance, qid);
        spin_lock_init(&nvmeq->q_lock);
        nvmeq->cq_head = 0;
        nvmeq->cq_phase = 1;
@@ -1195,12 +1187,16 @@ static struct nvme_queue *nvme_alloc_queue(struct nvme_dev *dev, int qid,
 
 static int queue_request_irq(struct nvme_queue *nvmeq)
 {
-       if (use_threaded_interrupts)
-               return request_threaded_irq(nvmeq_irq(nvmeq), nvme_irq_check,
-                               nvme_irq, IRQF_SHARED, nvmeq->irqname, nvmeq);
-       else
-               return request_irq(nvmeq_irq(nvmeq), nvme_irq, IRQF_SHARED,
-                               nvmeq->irqname, nvmeq);
+       struct pci_dev *pdev = to_pci_dev(nvmeq->dev->dev);
+       int nr = nvmeq->dev->ctrl.instance;
+
+       if (use_threaded_interrupts) {
+               return pci_request_irq(pdev, nvmeq->cq_vector, nvme_irq_check,
+                               nvme_irq, nvmeq, "nvme%dq%d", nr, nvmeq->qid);
+       } else {
+               return pci_request_irq(pdev, nvmeq->cq_vector, nvme_irq,
+                               NULL, nvmeq, "nvme%dq%d", nr, nvmeq->qid);
+       }
 }
 
 static void nvme_init_queue(struct nvme_queue *nvmeq, u16 qid)
@@ -1562,7 +1558,7 @@ static int nvme_setup_io_queues(struct nvme_dev *dev)
        }
 
        /* Deregister the admin queue's interrupt */
-       free_irq(pci_irq_vector(pdev, 0), adminq);
+       pci_free_irq(pdev, 0, adminq);
 
        /*
         * If we enable msix early due to not intx, disable it again before