From patchwork Wed Jan 11 15:06:34 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hanjun Guo X-Patchwork-Id: 9510355 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 297AC60231 for ; Wed, 11 Jan 2017 15:09:19 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1D99C27CF5 for ; Wed, 11 Jan 2017 15:09:19 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 11E86283F6; Wed, 11 Jan 2017 15:09:19 +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=-4.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED, T_DKIM_INVALID autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 95C6B27CF5 for ; Wed, 11 Jan 2017 15:09:18 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1cRKWa-00026n-Me; Wed, 11 Jan 2017 15:09:16 +0000 Received: from mail-pg0-x229.google.com ([2607:f8b0:400e:c05::229]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1cRKWV-0001aO-7V for linux-arm-kernel@lists.infradead.org; Wed, 11 Jan 2017 15:09:15 +0000 Received: by mail-pg0-x229.google.com with SMTP id 194so21635309pgd.2 for ; Wed, 11 Jan 2017 07:08:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=s7k8HTMeHjefTmGUDgUU4NbK0/te/1QqIhIQFZwi+E0=; b=OiH2CK8D81N/kJpF6D0KmcRUuqe/oE44fUcPhjezg8u8jUOHVeFBtH8+QeyLPxjT6o gBhgmrBZx3ZLFZbs0l56bBbFSRVsoXC63dKGBWUE+ioglJEDNzyv7cIuS0fLqw2M2aRt ex58/C+j8do4wiNqcpCluHBHIijNAz9eRriBg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=s7k8HTMeHjefTmGUDgUU4NbK0/te/1QqIhIQFZwi+E0=; b=HQKoB4qrc9JmlFsl3SS5I50AXA2TaVB361j9e136i1xUiNzF6IiwuOLndg5DaGjPYX 0hJ0TohNbin/bbOIJOk245HTfI0n/KkBoN+67uKXHCk5eVy3PnrFY0eVIgxtOL1M2puR gopr7akA0PC6zmKND1dV1GpRTJcIhuppkbuQLfNYqZmjqjVqqMsQ7FuRojDu0EDNTTGP 6sszbDFftyVDK8rpUeTT5Q+5N1unVHdVMjBvh0897nZGevGlK9cynNeyqhKzk0Tj71H3 K6s4vmDH0d6hr/2GaJoMcKDzVE5mfFcXO9QoeUBHsr8RmmZ0gyjknZz05GgFRReEPEn9 vpPg== X-Gm-Message-State: AIkVDXJuDFEqgYDAIyHtG6lwaKG7kS1UBTHKFUJ2d35hW9HbFy3q1RwEu54FuV7jKIN34p8t X-Received: by 10.84.136.75 with SMTP id 69mr454246plk.172.1484147329255; Wed, 11 Jan 2017 07:08:49 -0800 (PST) Received: from localhost ([104.237.91.103]) by smtp.googlemail.com with ESMTPSA id t21sm14653063pfa.1.2017.01.11.07.08.47 (version=TLS1_2 cipher=AES128-SHA bits=128/128); Wed, 11 Jan 2017 07:08:48 -0800 (PST) From: Hanjun Guo To: Marc Zyngier , "Rafael J. Wysocki" , Lorenzo Pieralisi Subject: [PATCH v7 10/15] ACPI: IORT: move over to iort_node_map_platform_id() Date: Wed, 11 Jan 2017 23:06:34 +0800 Message-Id: <1484147199-4267-11-git-send-email-hanjun.guo@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1484147199-4267-1-git-send-email-hanjun.guo@linaro.org> References: <1484147199-4267-1-git-send-email-hanjun.guo@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170111_070911_434926_B93BF4A0 X-CRM114-Status: GOOD ( 14.87 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: huxinwei@huawei.com, Kefeng Wang , Matthias Brugger , Jon Masters , yimin@huawei.com, Greg KH , linux-kernel@vger.kernel.org, linuxarm@huawei.com, Sinan Kaya , linux-acpi@vger.kernel.org, Xinwei Kong , Hanjun Guo , Tomasz Nowicki , Thomas Gleixner , Agustin Vega-Frias , linux-arm-kernel@lists.infradead.org, Ma Jun MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP iort_node_map_platform_id() includes the function of iort_node_get_id(), so update current iort_node_get_id() users and move them over to iort_node_map_platform_id(). type handing in iort_node_get_id() is duplicate with iort_node_map_platform_id(), so clean up a little bit to make the code simpler. Signed-off-by: Hanjun Guo Cc: Lorenzo Pieralisi Cc: Tomasz Nowicki --- drivers/acpi/arm64/iort.c | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/drivers/acpi/arm64/iort.c b/drivers/acpi/arm64/iort.c index 95fd20b..a6c8d2d 100644 --- a/drivers/acpi/arm64/iort.c +++ b/drivers/acpi/arm64/iort.c @@ -30,7 +30,6 @@ #define IORT_MSI_TYPE (1 << ACPI_IORT_NODE_ITS_GROUP) #define IORT_IOMMU_TYPE ((1 << ACPI_IORT_NODE_SMMU) | \ (1 << ACPI_IORT_NODE_SMMU_V3)) -#define IORT_TYPE_ANY (IORT_MSI_TYPE | IORT_IOMMU_TYPE) struct iort_its_msi_chip { struct list_head list; @@ -319,8 +318,7 @@ static int iort_id_map(struct acpi_iort_id_mapping *map, u8 type, u32 rid_in, static struct acpi_iort_node *iort_node_get_id(struct acpi_iort_node *node, - u32 *id_out, u8 type_mask, - int index) + u32 *id_out, int index) { struct acpi_iort_node *parent; struct acpi_iort_id_mapping *map; @@ -342,9 +340,6 @@ struct acpi_iort_node *iort_node_get_id(struct acpi_iort_node *node, parent = ACPI_ADD_PTR(struct acpi_iort_node, iort_table, map->output_reference); - if (!(IORT_TYPE_MASK(parent->type) & type_mask)) - return NULL; - if (map->flags & ACPI_IORT_ID_SINGLE_MAPPING) { if (node->type == ACPI_IORT_NODE_NAMED_COMPONENT || node->type == ACPI_IORT_NODE_PCI_ROOT_COMPLEX) { @@ -416,7 +411,7 @@ struct acpi_iort_node *iort_node_map_platform_id(struct acpi_iort_node *node, u32 id; /* step 1: retrieve the initial dev id */ - parent = iort_node_get_id(node, &id, IORT_TYPE_ANY, index); + parent = iort_node_get_id(node, &id, index); if (!parent) return NULL; @@ -424,7 +419,7 @@ struct acpi_iort_node *iort_node_map_platform_id(struct acpi_iort_node *node, * optional step 2: map the initial dev id if its parent is not * the target type we wanted, map it again for the use cases such * as NC (named component) -> SMMU -> ITS. If the type is matched, - * return the parent pointer directly. + * return the initial dev id and its parent pointer directly. */ if (!(IORT_TYPE_MASK(parent->type) & type_mask)) parent = iort_node_map_id(parent, id, id_out, type_mask); @@ -660,14 +655,15 @@ const struct iommu_ops *iort_iommu_configure(struct device *dev) if (!node) return NULL; - parent = iort_node_get_id(node, &streamid, - IORT_IOMMU_TYPE, i++); + parent = iort_node_map_platform_id(node, &streamid, + IORT_IOMMU_TYPE, i++); while (parent) { ops = iort_iommu_xlate(dev, parent, streamid); - parent = iort_node_get_id(node, &streamid, - IORT_IOMMU_TYPE, i++); + parent = iort_node_map_platform_id(node, &streamid, + IORT_IOMMU_TYPE, + i++); } }