From patchwork Tue Jun 16 08:42:41 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Piotr Stankiewicz X-Patchwork-Id: 11606889 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 42F4D1392 for ; Tue, 16 Jun 2020 08:43:04 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 2BA902078E for ; Tue, 16 Jun 2020 08:43:04 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2BA902078E Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=intel.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 743BE6E064; Tue, 16 Jun 2020 08:43:03 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by gabe.freedesktop.org (Postfix) with ESMTPS id 2123F6E064; Tue, 16 Jun 2020 08:43:02 +0000 (UTC) IronPort-SDR: ZJv6PeF/YEzzIA35Y9XP0xhbscEpQZOXQUSCSdg/RVO+V0z2AuMRsBtmYncI10HAFMUpD7ncjW kLVVopJ8COHA== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Jun 2020 01:43:00 -0700 IronPort-SDR: ESwecSLyQfPyKt5v+QA7YVSN7oPk6dEwv7A7LD3l65xfCRDTw98JDvGguFbLjsPh4m0pT64k9+ 4LLFQ1luX1oA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,518,1583222400"; d="scan'208";a="449726556" Received: from gklab-125-110.igk.intel.com ([10.91.125.110]) by orsmga005.jf.intel.com with ESMTP; 16 Jun 2020 01:42:57 -0700 From: Piotr Stankiewicz To: Alex Deucher Subject: [PATCH] drm/amdgpu: Simplify IRQ vector request logic Date: Tue, 16 Jun 2020 10:42:41 +0200 Message-Id: <20200616084243.18544-1-piotr.stankiewicz@intel.com> X-Mailer: git-send-email 2.17.2 In-Reply-To: References: X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: David Airlie , Aurabindo Pillai , linux-kernel@vger.kernel.org, amd-gfx@lists.freedesktop.org, Emily Deng , Piotr Stankiewicz , dri-devel@lists.freedesktop.org, shaoyunl , =?utf-8?q?Christian_K=C3=B6nig?= , Hawking Zhang MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" pci_alloc_irq_vectors() will handle fallback from MSI-X to MSI internally, if necessary. So remove checks which determine if we are dealing with MSI or MSI-X and rely on pci_alloc_irq_vectors() to do the right thing. Signed-off-by: Piotr Stankiewicz Reviewed-by: Andy Shevchenko --- drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c index 0cc4c67f95f7..2d68ad7d45d4 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c @@ -248,17 +248,8 @@ int amdgpu_irq_init(struct amdgpu_device *adev) adev->irq.msi_enabled = false; if (amdgpu_msi_ok(adev)) { - int nvec = pci_msix_vec_count(adev->pdev); - unsigned int flags; - - if (nvec <= 0) { - flags = PCI_IRQ_MSI; - } else { - flags = PCI_IRQ_MSI | PCI_IRQ_MSIX; - } /* we only need one vector */ - nvec = pci_alloc_irq_vectors(adev->pdev, 1, 1, flags); - if (nvec > 0) { + if (pci_alloc_irq_vectors(adev->pdev, 1, 1, PCI_IRQ_MSI | PCI_IRQ_MSIX) > 0) { adev->irq.msi_enabled = true; dev_dbg(adev->dev, "using MSI/MSI-X.\n"); }