From patchwork Thu Apr 13 07:06:43 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 9678813 X-Patchwork-Delegate: bhelgaas@google.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 91AB0601C3 for ; Thu, 13 Apr 2017 07:07:51 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 84B6B28625 for ; Thu, 13 Apr 2017 07:07:51 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7997728632; Thu, 13 Apr 2017 07:07:51 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8F38028625 for ; Thu, 13 Apr 2017 07:07:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756194AbdDMHHO (ORCPT ); Thu, 13 Apr 2017 03:07:14 -0400 Received: from bombadil.infradead.org ([65.50.211.133]:53786 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752689AbdDMHHM (ORCPT ); Thu, 13 Apr 2017 03:07:12 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=References:In-Reply-To:Message-Id: Date:Subject:Cc:To:From:Sender:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=Y84WKyKO4oin+CE7mgmvjDto5abDjCKHpP6vQ3mSn/o=; b=fnLLKc4PO+Gh307a0cL11FwZD 8f6RyslrpH/TCx8cpoZyNyiTR4lNDd7BpPxr5s/igLbXJ+Iup+O3g7ZJ+vuc/fHd5aB6GxthGEb94 MLsYWc+vdB1Os6cPaxDz9JM88FHeaZhXWofS5trz7c0gLs388FvA+wKpm+SkXcopMzVVGyzUjRuXt zsP/EKlLnydA4dpa507erA4cRlc6IZ43d3L292Kke0UpJvf3KF7UnXjk/0zRoCXoFAiT9+QlivQXC rjhYQOmzzKxOP2OXwzpvFyXu9eKVV7u0bLxrcqos7LvRCvAJNf/9NsQwTkS1hPM1nclbj3Z99TeH2 2iBi6vvTw==; Received: from 212095007060.public.telering.at ([212.95.7.60] helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.87 #1 (Red Hat Linux)) id 1cyYqR-0006Bo-Ar; Thu, 13 Apr 2017 07:07:08 +0000 From: Christoph Hellwig To: Thomas Gleixner , Bjorn Helgaas Cc: linux-pci@vger.kernel.org, linux-nvme@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH 4/4] nvme/pci: switch to pci_request_irq Date: Thu, 13 Apr 2017 09:06:43 +0200 Message-Id: <20170413070643.32165-5-hch@lst.de> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170413070643.32165-1-hch@lst.de> References: <20170413070643.32165-1-hch@lst.de> X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Christoph Hellwig Reviewed-by: Keith Busch Reviewed-by: Sagi Grimberg --- drivers/nvme/host/pci.c | 30 +++++++++++++----------------- 1 file changed, 13 insertions(+), 17 deletions(-) diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c index 26a5fd05fe88..925997127a6b 100644 --- a/drivers/nvme/host/pci.c +++ b/drivers/nvme/host/pci.c @@ -117,7 +117,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; @@ -204,11 +203,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) { @@ -962,7 +956,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); @@ -970,7 +964,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; } @@ -1055,8 +1049,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; @@ -1079,12 +1071,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) @@ -1440,7 +1436,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