From patchwork Wed Jun 17 13:42:22 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomeu Vizoso X-Patchwork-Id: 6626301 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 3526CC0020 for ; Wed, 17 Jun 2015 13:51:38 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 481C82062F for ; Wed, 17 Jun 2015 13:51:37 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id C922E204AD for ; Wed, 17 Jun 2015 13:51:31 +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 1Z5DhK-0007N7-AH; Wed, 17 Jun 2015 13:48:10 +0000 Received: from mail-wg0-x236.google.com ([2a00:1450:400c:c00::236]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Z5Dd0-00030S-2Y for linux-arm-kernel@lists.infradead.org; Wed, 17 Jun 2015 13:43:43 +0000 Received: by wgez8 with SMTP id z8so37414543wge.0 for ; Wed, 17 Jun 2015 06:43:20 -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=Anr2zHKF71m2QLD4WXx8PdUSudX0KPthbieKBQqswuA=; b=K1ccqLZaXhmOLCcS/h5kI8sg6huOSRNSm1Xgc140UGkbRwQjJYUc3CTIEcfvAhhYPh 5NWaa6GocaOc/kOyL2/pCXw13jXxA5WaCTw9xZtZzRECYM1saI6t5Uing0z7WNe9NGEB CDme5YzamHzOwes9EJzf2Fzs9EZqyPdGXKmDs5pkUS9GDd/NPFjlA4Q0M94cKvfe/n5D 7S9IJnqBbnbbHILFNqdqrZzlYXT8QZG2B1QLc4+kWPX74L2PfpY+IGZ2L2X9xBfmxXgA fHQnh3oYG9C93iRjGY4zDUGHp2EEd8b5RYPi0/gKvE+2utRyFLC5YmB734CNvGf7P/Tn XHYQ== X-Received: by 10.180.187.82 with SMTP id fq18mr17795966wic.47.1434548600170; Wed, 17 Jun 2015 06:43:20 -0700 (PDT) Received: from cizrna.lan ([109.72.12.132]) by mx.google.com with ESMTPSA id v3sm6920361wja.31.2015.06.17.06.43.17 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 17 Jun 2015 06:43:19 -0700 (PDT) From: Tomeu Vizoso To: linux-arm-kernel@lists.infradead.org Subject: [PATCH 12/13] device property: add fwnode_get_name() Date: Wed, 17 Jun 2015 15:42:22 +0200 Message-Id: <1434548543-22949-13-git-send-email-tomeu.vizoso@collabora.com> X-Mailer: git-send-email 2.4.1 In-Reply-To: <1434548543-22949-1-git-send-email-tomeu.vizoso@collabora.com> References: <1434548543-22949-1-git-send-email-tomeu.vizoso@collabora.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150617_064342_409292_14698BA3 X-CRM114-Status: GOOD ( 10.47 ) X-Spam-Score: -0.7 (/) Cc: Mark Rutland , Krzysztof Kozlowski , Linus Walleij , Andrzej Hajda , Thierry Reding , Lv Zheng , Alexander Holler , Alexandre Courbot , Russell King , Pawel Moll , Stephen Warren , Robert Moore , Grant Likely , Len Brown , Arnd Bergmann , Ian Campbell , Rob Herring , =?UTF-8?q?Terje=20Bergstr=C3=B6m?= , Tomeu Vizoso , Greg Kroah-Hartman , Dmitry Torokhov , "Rafael J. Wysocki" , linux-kernel@vger.kernel.org, Mark Brown , Kumar Gala , Javier Martinez Canillas X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , 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=-4.7 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 --- 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 28645a9..05e45f8 100644 --- a/drivers/base/property.c +++ b/drivers/base/property.c @@ -542,3 +542,18 @@ struct fwnode_handle *fwnode_get_parent(struct fwnode_handle *fwnode) return NULL; } EXPORT_SYMBOL_GPL(fwnode_get_parent); + +/** + * 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(fwnode)->full_name; + else if (is_acpi_node(fwnode)) + return acpi_dev_name(acpi_node(fwnode)); + + return NULL; +} +EXPORT_SYMBOL_GPL(fwnode_get_name); diff --git a/include/linux/property.h b/include/linux/property.h index 01e0483..7b7c0e8 100644 --- a/include/linux/property.h +++ b/include/linux/property.h @@ -65,6 +65,8 @@ struct fwnode_handle *device_get_next_child_node(struct device *dev, struct fwnode_handle *fwnode_get_parent(struct fwnode_handle *fwnode); +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))