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: 90910 Delivered-To: patch@linaro.org Received: by 10.140.20.99 with SMTP id 90csp1166497qgi; Wed, 11 Jan 2017 07:09:06 -0800 (PST) X-Received: by 10.84.169.36 with SMTP id g33mr14039727plb.36.1484147346701; Wed, 11 Jan 2017 07:09:06 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 73si6073413ple.107.2017.01.11.07.09.06; Wed, 11 Jan 2017 07:09:06 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-acpi-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org; spf=pass (google.com: best guess record for domain of linux-acpi-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-acpi-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756832AbdAKPIv (ORCPT + 7 others); Wed, 11 Jan 2017 10:08:51 -0500 Received: from mail-pg0-f48.google.com ([74.125.83.48]:34162 "EHLO mail-pg0-f48.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1764690AbdAKPIu (ORCPT ); Wed, 11 Jan 2017 10:08:50 -0500 Received: by mail-pg0-f48.google.com with SMTP id 14so37625285pgg.1 for ; Wed, 11 Jan 2017 07:08:49 -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=AD0g6Wp/lkRmyj12+7+TFq0FokQ7qKXo50m2AMtoOBZn0JhvuUBpeD+WyyaZpPWErS OFmhBbrCKRBsbrZH9xhsrJ9e0/K601nWS9SYbTd2iNVZDKa2J6KwKq4hPbnvE/SStqTh pO3LHj45X1XrmttMtlztvZs963iNpduAEH/7DLjd59wMWVc1vulg7e3LODiornG4aeZJ +/UHBpy6HsC1kh3ljCqwYMhlErzubsRfhmX/vjU4wwc0mPzi70e6PaPXZ1xusBU4dGng bGkmO123gbUNmhQWkCt7IyIBwtctQLyK2oOAXPSITMR/866L4xSMGZN0nbq4T5H2+9wY ztVQ== X-Gm-Message-State: AIkVDXLnsyHMEkul5erJqBRD7i8G5FOENdbUSawWfZA4lLgHUbRBswTtyxyjb+EahQ3C1tsm 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 Cc: linux-acpi@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linuxarm@huawei.com, Thomas Gleixner , Greg KH , Tomasz Nowicki , Ma Jun , Kefeng Wang , Agustin Vega-Frias , Sinan Kaya , huxinwei@huawei.com, yimin@huawei.com, Jon Masters , Matthias Brugger , Xinwei Kong , Hanjun Guo 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> Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org 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(-) -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-acpi" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html 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++); } }