Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp3172653ybi; Fri, 5 Jul 2019 03:08:26 -0700 (PDT) X-Google-Smtp-Source: APXvYqyN7V6QeeSSUfuDhGmPtjJq7RQq3vovExmyuBSebyQ/LIcjeN7n3SQVxQvcjmmNg7EaamWM X-Received: by 2002:a17:90a:bd0b:: with SMTP id y11mr907701pjr.141.1562321306498; Fri, 05 Jul 2019 03:08:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1562321306; cv=none; d=google.com; s=arc-20160816; b=cf6BOOOZxa0T2GHxFqzZTpQdRF1CHP4CSYtJO2AfmYY4K9m6BhF29rmWuRiAN/G5cz UCts1c2NLYKMK7OUDG1qSuLTp5tadb/SLcVnpCPxjcQ6T1wqappuGhWyd7jgoEYzoStM Os+LaA+0+QX5sVjXZu3jh2FbVdMSG2TjDm87vD6gKqwp9baFmfu3q18y12Dt+VkWU1Jf 7xN3tktaEvCHZ6N0Bi4QMyOAU7XuXVgP2OHbr9/tu6vDCyM+bRQ9iH1EnpvKJuCQnCc8 t3SbDfcNZA3gVdqjRyqPGTNA3RZ7b4DHkUfKqBjT4GHJA7/HCSkLnl3g0W8n2SGDh78g 6IoQ== 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=c88fNFs+5FBWoyhqVR2SEPd6ztlLhbQlLL8aqnjmS1k=; b=f3b1xMYIhT9aQzWcr5LNg+VAITdfc+NQfNYyM7uSRyM6jpM0kCvkdYL+GZx4H+/qNx A+jP5ZP8k4IszWR7OVV7WrKWLigfKFio6YDBH3B84vZkDy4o13c9gH8Yp5dhP4nsplHW De7td+OB+/FQwYlC1jOg7yv5e+sA4qGRik9HWC3vFnQXQWbkf6mTW3QqpDDDNuCyDFrj /Qw4WPwJ+KWP05llqHASHWVidAuYOQRVdv/mgJZ7Y1tFV7FRA/AEB/3NB8vHdZlDnuzl oZmDhDT4xGUjLKhJrVnE/stfCrBGtTgVXwxuGvSZYkFRfYt8yDvFiOEQvCBGr8vjl7D2 23Cg== 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 i69si8775043pge.366.2019.07.05.03.08.11; Fri, 05 Jul 2019 03:08:26 -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 S1728316AbfGEKHd (ORCPT + 99 others); Fri, 5 Jul 2019 06:07:33 -0400 Received: from inva020.nxp.com ([92.121.34.13]:32888 "EHLO inva020.nxp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728245AbfGEKH3 (ORCPT ); Fri, 5 Jul 2019 06:07:29 -0400 Received: from inva020.nxp.com (localhost [127.0.0.1]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id 208CB1A0EB7; Fri, 5 Jul 2019 12:07:27 +0200 (CEST) Received: from invc005.ap-rdc01.nxp.com (invc005.ap-rdc01.nxp.com [165.114.16.14]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id 939521A0EA8; Fri, 5 Jul 2019 12:07:18 +0200 (CEST) Received: from titan.ap.freescale.net (TITAN.ap.freescale.net [10.192.208.233]) by invc005.ap-rdc01.nxp.com (Postfix) with ESMTP id 2064A4032F; Fri, 5 Jul 2019 18:07:08 +0800 (SGT) From: Hou Zhiqiang To: linux-pci@vger.kernel.org, linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, bhelgaas@google.com, robh+dt@kernel.org, mark.rutland@arm.com, l.subrahmanya@mobiveil.co.in, shawnguo@kernel.org, leoyang.li@nxp.com, lorenzo.pieralisi@arm.com, catalin.marinas@arm.com, will.deacon@arm.com Cc: Mingkai.Hu@nxp.com, Minghuan.Lian@nxp.com, Xiaowei.Bao@nxp.com, Hou Zhiqiang Subject: [PATCHv6 15/28] PCI: mobiveil: Revise the MEM/IO outbound window initialization Date: Fri, 5 Jul 2019 17:56:43 +0800 Message-Id: <20190705095656.19191-16-Zhiqiang.Hou@nxp.com> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20190705095656.19191-1-Zhiqiang.Hou@nxp.com> References: <20190705095656.19191-1-Zhiqiang.Hou@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 resource type check into a if..else block, and only set up outbound window for MEM and IO resource. No functional change. Signed-off-by: Hou Zhiqiang Reviewed-by: Minghuan Lian --- V6: - Splited from #2 of v5 patches, no functional change. drivers/pci/controller/pcie-mobiveil.c | 20 ++++++++++---------- 1 files changed, 10 insertions(+), 10 deletions(-) diff --git a/drivers/pci/controller/pcie-mobiveil.c b/drivers/pci/controller/pcie-mobiveil.c index 906299b..965f89a 100644 --- a/drivers/pci/controller/pcie-mobiveil.c +++ b/drivers/pci/controller/pcie-mobiveil.c @@ -565,7 +565,7 @@ static void mobiveil_pcie_enable_msi(struct mobiveil_pcie *pcie) static int mobiveil_host_init(struct mobiveil_pcie *pcie) { - u32 value, pab_ctrl, type = 0; + u32 value, pab_ctrl, type; struct resource_entry *win; /* setup bus numbers */ @@ -617,18 +617,18 @@ static int mobiveil_host_init(struct mobiveil_pcie *pcie) /* Get the I/O and memory ranges from DT */ resource_list_for_each_entry(win, &pcie->resources) { - type = 0; if (resource_type(win->res) == IORESOURCE_MEM) type = MEM_WINDOW_TYPE; - if (resource_type(win->res) == IORESOURCE_IO) + else if (resource_type(win->res) == IORESOURCE_IO) type = IO_WINDOW_TYPE; - if (type) { - /* configure outbound translation window */ - program_ob_windows(pcie, pcie->ob_wins_configured, - win->res->start, - win->res->start - win->offset, - type, resource_size(win->res)); - } + else + continue; + + /* configure outbound translation window */ + program_ob_windows(pcie, pcie->ob_wins_configured, + win->res->start, + win->res->start - win->offset, + type, resource_size(win->res)); } /* fixup for PCIe class register */ -- 1.7.1