From patchwork Fri May 20 15:51:23 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Edgar E. Iglesias" X-Patchwork-Id: 9129867 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 CD79A6048B for ; Fri, 20 May 2016 15:53:39 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BDFB321BED for ; Fri, 20 May 2016 15:53:39 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B2EAD27BFE; Fri, 20 May 2016 15:53:39 +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_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 6A2A521BED for ; Fri, 20 May 2016 15:53:39 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1b3miK-0007I4-O3; Fri, 20 May 2016 15:51:48 +0000 Received: from mail6.bemta6.messagelabs.com ([85.158.143.247]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1b3miJ-0007HT-NL for xen-devel@lists.xen.org; Fri, 20 May 2016 15:51:47 +0000 Received: from [85.158.143.35] by server-2.bemta-6.messagelabs.com id E1/01-09532-3923F375; Fri, 20 May 2016 15:51:47 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprPIsWRWlGSWpSXmKPExsXiVRvkrDvJyD7 c4O5acYslHxezODB6HN39mymAMYo1My8pvyKBNWPv8jssBd94KrqXTWFvYLzE1cXIxSEkMIlR 4s3aoywgDovASxaJe8ufMYI4EgL9rBJN92aydjFyAjkxEvs3f2OEsKskTr1ZxgZiCwmoS5x+t 4MNYtQMJolpr0+BJdgETCT2/nnABGKLCEhLXPt8GayZWcBX4ubO42BxYQFLidWrp7GA2CwCqh JTD/8E6+UV8JBob21n72LkAFomJ7HgQjpImFPAU6J9xTlGiL0eEi07DrJMYBRYwMiwilG9OLW oLLVI11AvqSgzPaMkNzEzR9fQwEwvN7W4ODE9NScxqVgvOT93EyMwsBiAYAfjzudOhxglOZiU RHnVxO3DhfiS8lMqMxKLM+KLSnNSiw8xynBwKEnwrjQEygkWpaanVqRl5gBDHCYtwcGjJMIbA 5LmLS5IzC3OTIdInWLU5dgy9d5aJiGWvPy8VClx3giQIgGQoozSPLgRsHi7xCgrJczLCHSUEE 9BalFuZgmq/CtGcQ5GJWHerSBTeDLzSuA2vQI6ggnoiFtiNiBHlCQipKQaGP2PMqwu123mkLy bI5x29r+487XsH8YW5w6vtlt0ZmLTzAfVaan2+fsznkaEibz48DT6he+p02UHT4tF+nqkpd7Z evg0N2N6wnxZl6jzp9cLf9j06vZGrQgV1wNME2secbFObbk8NXSqzevkXf7T9Xj3c688K1Le9 cDPIrG2mbGV48y9XxL6KkosxRmJhlrMRcWJAJ+ek2ayAgAA X-Env-Sender: edgar.iglesias@gmail.com X-Msg-Ref: server-9.tower-21.messagelabs.com!1463759506!15115713!1 X-Originating-IP: [74.125.82.67] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 8.34; banners=-,-,- X-VirusChecked: Checked Received: (qmail 54277 invoked from network); 20 May 2016 15:51:46 -0000 Received: from mail-wm0-f67.google.com (HELO mail-wm0-f67.google.com) (74.125.82.67) by server-9.tower-21.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 20 May 2016 15:51:46 -0000 Received: by mail-wm0-f67.google.com with SMTP id n129so30292726wmn.1 for ; Fri, 20 May 2016 08:51:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=rHJUKw0krI59nnt4H+5GLxQ2/2MBpMObqNQqecbpM30=; b=pYS2p39UAILnfLwIE+gr5epa8U6mYxoDPv2TqqauTRirI/byP0HiuVkwk3c5ye6pH5 Rhi2twR5Kr7llRRBFni5WPQQH4OlO0fRWJmOj0C6cmRt6NeYhQFNTefn42RIjDEFoU/L 97IxRqj5zmOkmSMl30JQid54CxaKXJNS78DeiL9SwtBdOcoRqwBJbtx14NjPPv0YlWRY C6wJ+/sHGuRTjkgMtZmpMxS8+HZJUA3fs/ofDTRDzbHj/nhjLrLDfpv8ukAdN+ELNCnz lYbLmT8IK1RXO09wKxIhtXKm9dVgnfkuV1bPZr6nYIDGhHlWpqQpEHYxLZQK3KZF8pW2 54Rw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=rHJUKw0krI59nnt4H+5GLxQ2/2MBpMObqNQqecbpM30=; b=efjGuXlQunfHLT4k5fZZGQFHvpm9zelYwscKpoLvmrhpw8JbgymXmCNqLMey0aQkcG H+ov6zQJXlopcwY/aYLLU98BnMSSRF/p6SOUsGKcAKVg0UO7ZK/+Etlv17ng24GGqmWN xOBYSVrw9ASIjLu59x/j9oD7ce3QErrZKwYcXof0q4yxD86c5ewjNjV0fdQdyxOmnLP2 zoGIrkKc94BLfjtnShEc0/H1GhWGq8kUNGoQKfB9Bq4pPdter7qyhBOpMFogTMZDc4K/ 5GkTIKqXbYEqnyiFnl5GHN72n7uvdNDPZG9GEJusPMqcRiyWWnZLvz5dA+RH24Wh2KBv rRLw== X-Gm-Message-State: AOPr4FVhhz8UTAU4F39nhNowyzZ2nAgdzuze8Gvkf257C9HA3MMV2nCpSvSusn0mLwmUCw== X-Received: by 10.194.106.41 with SMTP id gr9mr3990084wjb.161.1463759491081; Fri, 20 May 2016 08:51:31 -0700 (PDT) Received: from localhost (81-231-233-234-no56.tbcn.telia.com. [81.231.233.234]) by smtp.gmail.com with ESMTPSA id k1sm20381452wjx.22.2016.05.20.08.51.30 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 20 May 2016 08:51:30 -0700 (PDT) From: "Edgar E. Iglesias" To: xen-devel@lists.xen.org Date: Fri, 20 May 2016 17:51:23 +0200 Message-Id: <1463759488-11900-2-git-send-email-edgar.iglesias@gmail.com> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1463759488-11900-1-git-send-email-edgar.iglesias@gmail.com> References: <1463759488-11900-1-git-send-email-edgar.iglesias@gmail.com> Cc: edgar.iglesias@xilinx.com, julien.grall@arm.com, sstabellini@kernel.org Subject: [Xen-devel] [RFC for-4.8 1/6] xen/arm: Add device_get_desc() X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: "Edgar E. Iglesias" Add device_get_desc, a function to lookup the device descriptor for a DT node. This is in preparation for adding per device mapping implementations. Signed-off-by: Edgar E. Iglesias --- xen/arch/arm/device.c | 15 +++++++++++++++ xen/include/asm-arm/device.h | 1 + 2 files changed, 16 insertions(+) diff --git a/xen/arch/arm/device.c b/xen/arch/arm/device.c index a0072c1..1b934b9 100644 --- a/xen/arch/arm/device.c +++ b/xen/arch/arm/device.c @@ -83,6 +83,21 @@ enum device_class device_get_class(const struct dt_device_node *dev) return DEVICE_UNKNOWN; } +const struct device_desc *device_get_desc(const struct dt_device_node *dev) +{ + const struct device_desc *desc; + + ASSERT(dev != NULL); + + for ( desc = _sdevice; desc != _edevice; desc++ ) + { + if ( dt_match_node(desc->dt_match, dev) ) + return desc; + } + + return NULL; +} + /* * Local variables: * mode: C diff --git a/xen/include/asm-arm/device.h b/xen/include/asm-arm/device.h index 6734ae8..1a40a02 100644 --- a/xen/include/asm-arm/device.h +++ b/xen/include/asm-arm/device.h @@ -89,6 +89,7 @@ int __init device_init(struct dt_device_node *dev, enum device_class class, * Return the device type on success or DEVICE_ANY on failure */ enum device_class device_get_class(const struct dt_device_node *dev); +const struct device_desc *device_get_desc(const struct dt_device_node *dev); #define DT_DEVICE_START(_name, _namestr, _class) \ static const struct device_desc __dev_desc_##_name __used \