Received: by 2002:a25:e7d8:0:0:0:0:0 with SMTP id e207csp222933ybh; Fri, 13 Mar 2020 20:46:20 -0700 (PDT) X-Google-Smtp-Source: ADFU+vtIrknOM5qWD91OfExfgnwCdqK1yP1l0DgtQZ3Vi9r4pFVviKT2hhCwxP4PTtvJawApsjHN X-Received: by 2002:a05:6808:a08:: with SMTP id n8mr9858867oij.91.1584157580473; Fri, 13 Mar 2020 20:46:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1584157580; cv=none; d=google.com; s=arc-20160816; b=FVrumWULgqB/kxyllWyakbEDyRncLhfbBPpvHKkSQnYMK0tMDqT2vmBt7sHnMe3RT+ 7VFw+qUO9s4RqTccGJY+JFjudOIX3fnjaQGtoeMtp65CgZ3MGoG3K7JkTxo2rWzV83My d+fbQYRSvi2OtB1qrYbW+DoQTWXyi51nyf+JBAs7mO9gbbEtE4A2/unWak/oX+0rQVnG RvE32wEbIhvrOKb+cWJi/YKQ0eEeK5k2laMyyaMvdNhOqTX/dFxaBUuSAV11uJ8vfstZ y+SLIrZmuzpumUuC4kDCCehVpc6tIghT8AvGxL4rU/BOZ+G9OjHjPIiVoHdKSR8wG3qt R23w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=HM2NSLZns5pUM/Dp5fY+Unm3lvKGRJaBbQqWmmyu+DA=; b=I53up118i00kWT93GTtwaQiGVt7HEqqX+aaS3FpOl3mOSiWWa1KtfW6hQqysR2C+W8 3M4jfYywz6QL5JMi5ep7TkSWM72imEw0UAvroVU42IsyQ9iVFsDBTG8/fU2T18xuCShr xpibgaev0Ous/nsrTK1Oosf4jDB0NnwgOmnbD4/2lAJtNTxPFa/jYlw3BSqOT5HkjkhU 09iylpHIfaUk134AwNWZqnObk1AkvJsAYn2ugJ2nPc92SAjmCEUezFYObQsvy18yKSEl BfFXQf5lHPFZItuNl+wXrUwlivcGFNCeo9p5HLV6hEn8emR6qLNv8BpxZ0vtqHcLzb1P xCtw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x73si5530031oif.16.2020.03.13.20.46.08; Fri, 13 Mar 2020 20:46:20 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727000AbgCNDp1 (ORCPT + 99 others); Fri, 13 Mar 2020 23:45:27 -0400 Received: from inva021.nxp.com ([92.121.34.21]:59808 "EHLO inva021.nxp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726704AbgCNDoo (ORCPT ); Fri, 13 Mar 2020 23:44:44 -0400 Received: from inva021.nxp.com (localhost [127.0.0.1]) by inva021.eu-rdc02.nxp.com (Postfix) with ESMTP id 48DE42014F9; Sat, 14 Mar 2020 04:44:42 +0100 (CET) Received: from invc005.ap-rdc01.nxp.com (invc005.ap-rdc01.nxp.com [165.114.16.14]) by inva021.eu-rdc02.nxp.com (Postfix) with ESMTP id 6FF6B2014E6; Sat, 14 Mar 2020 04:44:32 +0100 (CET) Received: from titan.ap.freescale.net (titan.ap.freescale.net [10.192.208.233]) by invc005.ap-rdc01.nxp.com (Postfix) with ESMTP id 7EADD402DA; Sat, 14 Mar 2020 11:44:20 +0800 (SGT) From: Xiaowei Bao To: Zhiqiang.Hou@nxp.com, Minghuan.Lian@nxp.com, mingkai.hu@nxp.com, bhelgaas@google.com, robh+dt@kernel.org, shawnguo@kernel.org, leoyang.li@nxp.com, kishon@ti.com, lorenzo.pieralisi@arm.com, roy.zang@nxp.com, amurray@thegoodpenguin.co.uk, jingoohan1@gmail.com, gustavo.pimentel@synopsys.com, andrew.murray@arm.com, linux-pci@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linuxppc-dev@lists.ozlabs.org Cc: Xiaowei Bao Subject: [PATCH v6 03/11] PCI: designware-ep: Move the function of getting MSI capability forward Date: Sat, 14 Mar 2020 11:30:30 +0800 Message-Id: <20200314033038.24844-4-xiaowei.bao@nxp.com> X-Mailer: git-send-email 2.9.5 In-Reply-To: <20200314033038.24844-1-xiaowei.bao@nxp.com> References: <20200314033038.24844-1-xiaowei.bao@nxp.com> X-Virus-Scanned: ClamAV using ClamSMTP Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Move the function of getting MSI capability to the front of init function, because the init function of the EP platform driver will use the return value by the function of getting MSI capability. Signed-off-by: Xiaowei Bao Reviewed-by: Andrew Murray --- v2: - No change. v3: - No change. v4: - No change. v5: - No change. v6: - No change. drivers/pci/controller/dwc/pcie-designware-ep.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/pci/controller/dwc/pcie-designware-ep.c b/drivers/pci/controller/dwc/pcie-designware-ep.c index 44ece33..933bb89 100644 --- a/drivers/pci/controller/dwc/pcie-designware-ep.c +++ b/drivers/pci/controller/dwc/pcie-designware-ep.c @@ -632,6 +632,10 @@ int dw_pcie_ep_init(struct dw_pcie_ep *ep) if (ret < 0) epc->max_functions = 1; + ep->msi_cap = dw_pcie_find_capability(pci, PCI_CAP_ID_MSI); + + ep->msix_cap = dw_pcie_find_capability(pci, PCI_CAP_ID_MSIX); + if (ep->ops->ep_init) ep->ops->ep_init(ep); @@ -648,9 +652,6 @@ int dw_pcie_ep_init(struct dw_pcie_ep *ep) dev_err(dev, "Failed to reserve memory for MSI/MSI-X\n"); return -ENOMEM; } - ep->msi_cap = dw_pcie_find_capability(pci, PCI_CAP_ID_MSI); - - ep->msix_cap = dw_pcie_find_capability(pci, PCI_CAP_ID_MSIX); offset = dw_pcie_ep_find_ext_capability(pci, PCI_EXT_CAP_ID_REBAR); if (offset) { -- 2.9.5