From patchwork Tue Jul 28 13:19:34 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomeu Vizoso X-Patchwork-Id: 6884881 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 43DC29F380 for ; Tue, 28 Jul 2015 13:24:06 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 60BD62065B for ; Tue, 28 Jul 2015 13:24:05 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 8EE6E2072E for ; Tue, 28 Jul 2015 13:24:04 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZK4pg-0005g8-Nr; Tue, 28 Jul 2015 13:22:12 +0000 Received: from mail-wi0-x22a.google.com ([2a00:1450:400c:c05::22a]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZK4oV-0004ta-IJ for linux-arm-kernel@lists.infradead.org; Tue, 28 Jul 2015 13:21:01 +0000 Received: by wicgb10 with SMTP id gb10so156489904wic.1 for ; Tue, 28 Jul 2015 06:20:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=w/upimIhl18Qwx7yVfwxAEX7K0BeDShcsrBK3/o4ONQ=; b=xpsaRFPACOnk6oWGYZFg9dm1tDfi77D+LKVCygEulloN946KUL+lT6ZUksUESxgR0A 8HwIsvi4GvFtiFGwZ0IxvkLmgc3kHejwXm+gGWxjLrPIIpOxMNfjX3D4wfI3AL3M1IYR csmvk1k6/2xVCHhWYidpYDwuWadSSedeuEa230aBPQMEmXJTyKsPQi0yJYv3wmnwv8gH f2YOPFszsDwESZaTiT6LB0NqbqQmqpVLf35NS97MNOshYAuV5b75PX7mzKWo5edVrc9O 485UkcekMDPYxIICUgLRJpPHwbMUiYDiRTUKDa5W/fbp9d1Y7e1HQF38zSlAevbBTZLt 0DsQ== X-Received: by 10.195.11.202 with SMTP id ek10mr67725577wjd.12.1438089637926; Tue, 28 Jul 2015 06:20:37 -0700 (PDT) Received: from cizrna.lan ([109.72.12.179]) by smtp.gmail.com with ESMTPSA id h9sm33265696wjx.20.2015.07.28.06.20.36 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 28 Jul 2015 06:20:36 -0700 (PDT) From: Tomeu Vizoso To: linux-kernel@vger.kernel.org Subject: [PATCH v2 03/22] device property: add fwnode_get_name() Date: Tue, 28 Jul 2015 15:19:34 +0200 Message-Id: <1438089593-7696-4-git-send-email-tomeu.vizoso@collabora.com> X-Mailer: git-send-email 2.4.3 In-Reply-To: <1438089593-7696-1-git-send-email-tomeu.vizoso@collabora.com> References: <1438089593-7696-1-git-send-email-tomeu.vizoso@collabora.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150728_062059_986962_7434E74C X-CRM114-Status: GOOD ( 12.05 ) X-Spam-Score: -2.4 (--) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, linux-acpi@vger.kernel.org, Arnd Bergmann , Stephen Warren , Greg Kroah-Hartman , Linus Walleij , Dmitry Torokhov , "Rafael J. Wysocki" , Tomeu Vizoso , Javier Martinez Canillas , Mark Brown , Thierry Reding , linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-5.5 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Getting a textual representation of a device node can be very useful for debugging. Signed-off-by: Tomeu Vizoso --- Changes in v2: - Use of_node_full_name() drivers/base/property.c | 15 +++++++++++++++ include/linux/property.h | 2 ++ 2 files changed, 17 insertions(+) diff --git a/drivers/base/property.c b/drivers/base/property.c index f3f6d167f3f1..efa74803af30 100644 --- a/drivers/base/property.c +++ b/drivers/base/property.c @@ -533,3 +533,18 @@ bool device_dma_is_coherent(struct device *dev) return coherent; } EXPORT_SYMBOL_GPL(device_dma_is_coherent); + +/** + * fwnode_get_name - return the name of a device node + * @fwnode: Device node to find the name of + */ +const char *fwnode_get_name(struct fwnode_handle *fwnode) +{ + if (is_of_node(fwnode)) + return of_node_full_name(to_of_node(fwnode)); + else if (is_acpi_node(fwnode)) + return acpi_dev_name(to_acpi_node(fwnode)); + + return NULL; +} +EXPORT_SYMBOL_GPL(fwnode_get_name); diff --git a/include/linux/property.h b/include/linux/property.h index 76ebde9c11d4..826f156f7288 100644 --- a/include/linux/property.h +++ b/include/linux/property.h @@ -63,6 +63,8 @@ int fwnode_property_read_string(struct fwnode_handle *fwnode, struct fwnode_handle *device_get_next_child_node(struct device *dev, struct fwnode_handle *child); +const char *fwnode_get_name(struct fwnode_handle *fwnode); + #define device_for_each_child_node(dev, child) \ for (child = device_get_next_child_node(dev, NULL); child; \ child = device_get_next_child_node(dev, child))