From patchwork Tue Aug 28 15:52:51 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rob Herring X-Patchwork-Id: 145349 Delivered-To: patch@linaro.org Received: by 2002:a2e:1648:0:0:0:0:0 with SMTP id 8-v6csp1348004ljw; Tue, 28 Aug 2018 08:53:22 -0700 (PDT) X-Google-Smtp-Source: ANB0Vda+HkUMkbZVmqYYmvkDPqozugd42LMgeHsEFL0vUTO0wv5cCv3S2RWNIMUlcP5dsSZCWGZG X-Received: by 2002:a17:902:1ab:: with SMTP id b40-v6mr2185559plb.55.1535471602193; Tue, 28 Aug 2018 08:53:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535471602; cv=none; d=google.com; s=arc-20160816; b=DYP2kWHuBdETN+fGNyp24Gv7TCuHFWan0dK1elY1mg1ts32mK2BaN/WAAGz1rB+7ku 7ZvqP9Zwq4+zO+n/2s30HlA55xH/mauuC5uvG9XzITQLuXhByAlM0i8eZHxFppdKgWPa 0ceFfwl4Yjifn1EeS1/v/bx6hyuZWbYUuR4O05bXnXccC2lTlFT1YvQDVuk2LAZHefzL IPIJVVyZaLucBaNsl08stzXTwATy3NTQU86WH4FS9+EhIfRf/J6R3rzmHzstZ+9Lp10g u1oY310BvUnlZ2WxFH6n/K1d6dqhfM3OapdL7RRl/IuWC5W2lSySwXJs8wuRrXP/CziJ Or0w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=T+l961YCM6AdnrRoLX9dDKYctXA+LHBCEcRJLbcGhSU=; b=PIxrEgYEx2eJzEBf/iFUD9MX84spm9rHkgz6ENS+x63n4dfFFcWpEX2SbiJ15jQ9Z2 QOQIRSk315c8vK/oHyWGJcxNBzdD5lNQg84xmfhTScA4xiYQBwNGPV4UNHiEcM7Ky87Y Ac7WsWLKyMz/2TlZ0ZfvJHOZiflJgmZ1aVv07rCiWk0pdOGY9L5CoIuA+4UloRNwCjX3 8/ZObZKske/UP2dqB06dRVSY6Dl8nziwncdySeUAfD9O86o++EH1MWjZ0xVT3DZHNlnr 5wvqTVF6MCMW8e1PQze4Y2X+htUovmjz1n/0HMcDYafI5i/fmOofngx7p1JnfIFwsX5T 2RYA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g2-v6si1375080pgg.83.2018.08.28.08.53.21; Tue, 28 Aug 2018 08:53:22 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728144AbeH1Tpg (ORCPT + 32 others); Tue, 28 Aug 2018 15:45:36 -0400 Received: from mail-oi0-f68.google.com ([209.85.218.68]:45313 "EHLO mail-oi0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727020AbeH1TpN (ORCPT ); Tue, 28 Aug 2018 15:45:13 -0400 Received: by mail-oi0-f68.google.com with SMTP id t68-v6so3675776oie.12; Tue, 28 Aug 2018 08:52:57 -0700 (PDT) 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=T+l961YCM6AdnrRoLX9dDKYctXA+LHBCEcRJLbcGhSU=; b=n3yWlcRERckvfQj4ERatcNR7EfGXhr8eUG5w5h7DulWPBIlz0ApS/NtvMR/u0JdPRm jbKOOTOrOz2q0oJ+AL7fSTjefnwstAFJ+TupjMhh5n0iRUgqyjis7iVCBD6BU0Jar7Hw BiY9QaBkERRujBqBtDlrNpQggolIhwd9QbuhHNOgAhZl86sH+nYcxOW0hQihCuZZOX7C 8N79wKm9T2JbgN46tNBjwkkyxtLTLcVS+kSxqw7yDtVyAeNi8rLziOxAxJuJGxXoQ+ZW bpjPXyx/XYdo9rGTPPE5oOXlMKFkcxMTP/rKXFl2mIhNbMtQEhCJp7CwUdggvFHkwdJf 0pGQ== X-Gm-Message-State: APzg51DyAnAJEJWpJ60hIMfQxYSxXibB0HxboHzZQsruombx/LSFGa7R K24F4rCoY2Krl+s3v84NPg== X-Received: by 2002:aca:4d56:: with SMTP id a83-v6mr1563136oib.205.1535471576633; Tue, 28 Aug 2018 08:52:56 -0700 (PDT) Received: from xps15.herring.priv (24-155-109-49.dyn.grandenetworks.net. [24.155.109.49]) by smtp.googlemail.com with ESMTPSA id o68-v6sm2902294oik.56.2018.08.28.08.52.55 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 28 Aug 2018 08:52:55 -0700 (PDT) From: Rob Herring To: Frank Rowand , devicetree@vger.kernel.org Cc: linux-kernel@vger.kernel.org Subject: [PATCH 1/4] of/unittest: remove use of node name pointer in overlay high level test Date: Tue, 28 Aug 2018 10:52:51 -0500 Message-Id: <20180828155254.10709-2-robh@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180828155254.10709-1-robh@kernel.org> References: <20180828155254.10709-1-robh@kernel.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org In preparation for removing the node name pointer, it needs to be removed from of_unittest_overlay_high_level. However, it's not really correct to use the node name without the unit-address and we should use the full node name. This most easily done by iterating over the child nodes with for_each_child_of_node() which is what of_get_child_by_name() does internally. While at it, we might as well convert the outer loop to use for_each_child_of_node() too instead of open coding it. Cc: Frank Rowand Signed-off-by: Rob Herring --- drivers/of/unittest.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) -- 2.17.1 diff --git a/drivers/of/unittest.c b/drivers/of/unittest.c index 722537e14848..69a522e48970 100644 --- a/drivers/of/unittest.c +++ b/drivers/of/unittest.c @@ -2347,10 +2347,12 @@ static __init void of_unittest_overlay_high_level(void) } } - for (np = overlay_base_root->child; np; np = np->sibling) { - if (of_get_child_by_name(of_root, np->name)) { - unittest(0, "illegal node name in overlay_base %s", - np->name); + for_each_child_of_node(overlay_base_root, np) { + struct device_node *base_child; + for_each_child_of_node(of_root, base_child) { + if (!strcmp(np->full_name, base_child->full_name)) + unittest(0, "illegal node name in overlay_base %pOFn", + np); return; } } From patchwork Tue Aug 28 15:52:53 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rob Herring X-Patchwork-Id: 145347 Delivered-To: patch@linaro.org Received: by 2002:a2e:1648:0:0:0:0:0 with SMTP id 8-v6csp1347703ljw; Tue, 28 Aug 2018 08:53:02 -0700 (PDT) X-Google-Smtp-Source: ANB0VdYGGvPU+ppvJR05DubPwBJjmUSXC4tTj2hqb4KsTXINpA2wfCgoHHSLfojhT0cROGkoFCaM X-Received: by 2002:a17:902:a413:: with SMTP id p19-v6mr2140082plq.220.1535471582137; Tue, 28 Aug 2018 08:53:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535471582; cv=none; d=google.com; s=arc-20160816; b=SoOJclBIAFw1/e3+8rDy6hYKzR7FldTc562wD+pR6HooOdATjLNNbDkRHr0ioy8d0q mk+V8BrfEIgNSBdo5XJE6J9eERs2JZlWw3BEZHo9DTUuJK7+gEz8B40wz7OyN+q0Sm30 i6KI69bnW9wEAOyshoGnKGeqfVl4rHqipdYJZn8pqKw+Z5UtFQJbtgC10EwJ9UQ1WSyn 6oWbqI2tBHtmuLn8676kbJAdJZ/BuIp20ePcX/+q+X5cbhE4XujKmbPnyrA1WPjWzOmw JbGcqgXvoZyxmpKQKJs2491lHKmo1vgmHGqK3XDyRuWu8BxeZDFPkEDWBzuhFlDwYGRS 81NA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=MNm0gRPsyFlr2esmw5DnNxNac32G1LKICofHULJsyvM=; b=vysPjwNI1papznqL6+/QfIrbfLv70NDda0Oafx1fvHbH9KtyTJoP9f17TGiz82svy/ +LmX6kNvbbaeasQk6OEFY6j67Wv9sMQrWFkgFODpnMgq01XhmYECPNswA1iR8ZwhUyCF V68rX5LmfzN9qLfPsvK3IHPcVWEEVK1aBTIidLNsthm2mG9CElRhop9lu/n4wscGKhLK profa9YzCC+bskKIsK/oCN9k7czlHzT0Y+JJ2GbuWOS0LbyzEa8c6E6jCxVyG2Bp51Mo UT2MDTwSdwNh+iLKAX3TYpXmRqAqvtlDvLqjGDGCLw8kJwHib98YMCa1N382/cfLDAVO L5sw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o20-v6si1360455pgk.120.2018.08.28.08.53.01; Tue, 28 Aug 2018 08:53:02 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728109AbeH1TpQ (ORCPT + 32 others); Tue, 28 Aug 2018 15:45:16 -0400 Received: from mail-oi0-f65.google.com ([209.85.218.65]:37656 "EHLO mail-oi0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728044AbeH1TpQ (ORCPT ); Tue, 28 Aug 2018 15:45:16 -0400 Received: by mail-oi0-f65.google.com with SMTP id p84-v6so3731298oic.4; Tue, 28 Aug 2018 08:52:59 -0700 (PDT) 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=MNm0gRPsyFlr2esmw5DnNxNac32G1LKICofHULJsyvM=; b=WqlBg5I295R30bVgOyoZnPWprGxhBTo1dF9ujstF257nOyQctq4Iobd9Iy2EDht9YO Pqh7C1/28nOoDfke3x1C00u/5xrBbRo0kKZ1uX1B8HP8FTfimnxfv+jY+hQ1YTKCjkm2 2C2DPyE1DPbjTKKG7ZNpjMuJ6A4v5Ua9mXu+UdcP0t96Ab6X2hcCXsEeiQPHjYLtMnj4 v/+biihs1sgrAqsYONhCyTKcr/3jY5keyYyaU4gKOLsnsi7y2pTZo0tIlqlQC1Hql6FE ERWNdnk58sYZxF0ystK62vqChxQM0zYWGNm94s6am9xQROQRKJNHyS8wnYX6wZnYVYTp Jd8A== X-Gm-Message-State: APzg51AFBIOcId8M8h6GmGh1wyH6xc7LpOuwPTj5aSB+4Rl9VHhnpXGz kISGl0KZOnk5d9AUSdgn0w== X-Received: by 2002:aca:3ec5:: with SMTP id l188-v6mr1554263oia.181.1535471578723; Tue, 28 Aug 2018 08:52:58 -0700 (PDT) Received: from xps15.herring.priv (24-155-109-49.dyn.grandenetworks.net. [24.155.109.49]) by smtp.googlemail.com with ESMTPSA id o68-v6sm2902294oik.56.2018.08.28.08.52.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 28 Aug 2018 08:52:58 -0700 (PDT) From: Rob Herring To: Frank Rowand , devicetree@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Andrew Lunn , Florian Fainelli , netdev@vger.kernel.org Subject: [PATCH 3/4] of: Convert to using %pOFn instead of device_node.name Date: Tue, 28 Aug 2018 10:52:53 -0500 Message-Id: <20180828155254.10709-4-robh@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180828155254.10709-1-robh@kernel.org> References: <20180828155254.10709-1-robh@kernel.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org In preparation to remove the node name pointer from struct device_node, convert printf users to use the %pOFn format specifier. Cc: Frank Rowand Cc: Andrew Lunn Cc: Florian Fainelli Cc: devicetree@vger.kernel.org Cc: netdev@vger.kernel.org Signed-off-by: Rob Herring --- drivers/of/device.c | 4 ++-- drivers/of/of_mdio.c | 12 ++++++------ drivers/of/of_numa.c | 4 ++-- drivers/of/overlay.c | 4 ++-- drivers/of/platform.c | 8 ++++---- drivers/of/unittest.c | 12 ++++++------ 6 files changed, 22 insertions(+), 22 deletions(-) -- 2.17.1 diff --git a/drivers/of/device.c b/drivers/of/device.c index 5957cd4fa262..daa075d87317 100644 --- a/drivers/of/device.c +++ b/drivers/of/device.c @@ -219,7 +219,7 @@ static ssize_t of_device_get_modalias(struct device *dev, char *str, ssize_t len return -ENODEV; /* Name & Type */ - csize = snprintf(str, len, "of:N%sT%s", dev->of_node->name, + csize = snprintf(str, len, "of:N%pOFnT%s", dev->of_node, dev->of_node->type); tsize = csize; len -= csize; @@ -298,7 +298,7 @@ void of_device_uevent(struct device *dev, struct kobj_uevent_env *env) if ((!dev) || (!dev->of_node)) return; - add_uevent_var(env, "OF_NAME=%s", dev->of_node->name); + add_uevent_var(env, "OF_NAME=%pOFn", dev->of_node); add_uevent_var(env, "OF_FULLNAME=%pOF", dev->of_node); if (dev->of_node->type && strcmp("", dev->of_node->type) != 0) add_uevent_var(env, "OF_TYPE=%s", dev->of_node->type); diff --git a/drivers/of/of_mdio.c b/drivers/of/of_mdio.c index e92391d6d1bd..5ad1342f5682 100644 --- a/drivers/of/of_mdio.c +++ b/drivers/of/of_mdio.c @@ -97,8 +97,8 @@ static int of_mdiobus_register_phy(struct mii_bus *mdio, return rc; } - dev_dbg(&mdio->dev, "registered phy %s at address %i\n", - child->name, addr); + dev_dbg(&mdio->dev, "registered phy %pOFn at address %i\n", + child, addr); return 0; } @@ -127,8 +127,8 @@ static int of_mdiobus_register_device(struct mii_bus *mdio, return rc; } - dev_dbg(&mdio->dev, "registered mdio device %s at address %i\n", - child->name, addr); + dev_dbg(&mdio->dev, "registered mdio device %pOFn at address %i\n", + child, addr); return 0; } @@ -263,8 +263,8 @@ int of_mdiobus_register(struct mii_bus *mdio, struct device_node *np) continue; /* be noisy to encourage people to set reg property */ - dev_info(&mdio->dev, "scan phy %s at address %i\n", - child->name, addr); + dev_info(&mdio->dev, "scan phy %pOFn at address %i\n", + child, addr); if (of_mdiobus_child_is_phy(child)) { rc = of_mdiobus_register_phy(mdio, child, addr); diff --git a/drivers/of/of_numa.c b/drivers/of/of_numa.c index 27d9b4bba535..67d3386195bf 100644 --- a/drivers/of/of_numa.c +++ b/drivers/of/of_numa.c @@ -163,8 +163,8 @@ int of_node_to_nid(struct device_node *device) np = of_get_next_parent(np); } if (np && r) - pr_warn("Invalid \"numa-node-id\" property in node %s\n", - np->name); + pr_warn("Invalid \"numa-node-id\" property in node %pOFn\n", + np); of_node_put(np); /* diff --git a/drivers/of/overlay.c b/drivers/of/overlay.c index eda57ef12fd0..42b1f73ac5f6 100644 --- a/drivers/of/overlay.c +++ b/drivers/of/overlay.c @@ -425,8 +425,8 @@ static int build_changeset_next_level(struct overlay_changeset *ovcs, for_each_child_of_node(overlay_node, child) { ret = add_changeset_node(ovcs, target_node, child); if (ret) { - pr_debug("Failed to apply node @%pOF/%s, err=%d\n", - target_node, child->name, ret); + pr_debug("Failed to apply node @%pOF/%pOFn, err=%d\n", + target_node, child, ret); of_node_put(child); return ret; } diff --git a/drivers/of/platform.c b/drivers/of/platform.c index 7ba90c290a42..868905f2d638 100644 --- a/drivers/of/platform.c +++ b/drivers/of/platform.c @@ -91,8 +91,8 @@ static void of_device_make_bus_id(struct device *dev) */ reg = of_get_property(node, "reg", NULL); if (reg && (addr = of_translate_address(node, reg)) != OF_BAD_ADDR) { - dev_set_name(dev, dev_name(dev) ? "%llx.%s:%s" : "%llx.%s", - (unsigned long long)addr, node->name, + dev_set_name(dev, dev_name(dev) ? "%llx.%pOFn:%s" : "%llx.%pOFn", + (unsigned long long)addr, node, dev_name(dev)); return; } @@ -142,8 +142,8 @@ struct platform_device *of_device_alloc(struct device_node *np, WARN_ON(rc); } if (of_irq_to_resource_table(np, res, num_irq) != num_irq) - pr_debug("not all legacy IRQ resources mapped for %s\n", - np->name); + pr_debug("not all legacy IRQ resources mapped for %pOFn\n", + np); } dev->dev.of_node = of_node_get(np); diff --git a/drivers/of/unittest.c b/drivers/of/unittest.c index 9def7be9c111..d9d012198ca5 100644 --- a/drivers/of/unittest.c +++ b/drivers/of/unittest.c @@ -212,8 +212,8 @@ static int __init of_unittest_check_node_linkage(struct device_node *np) for_each_child_of_node(np, child) { if (child->parent != np) { - pr_err("Child node %s links to wrong parent %s\n", - child->name, np->name); + pr_err("Child node %pOFn links to wrong parent %pOFn\n", + child, np); rc = -EINVAL; goto put_child; } @@ -1040,16 +1040,16 @@ static void __init of_unittest_platform_populate(void) for_each_child_of_node(np, child) { for_each_child_of_node(child, grandchild) unittest(of_find_device_by_node(grandchild), - "Could not create device for node '%s'\n", - grandchild->name); + "Could not create device for node '%pOFn'\n", + grandchild); } of_platform_depopulate(&test_bus->dev); for_each_child_of_node(np, child) { for_each_child_of_node(child, grandchild) unittest(!of_find_device_by_node(grandchild), - "device didn't get destroyed '%s'\n", - grandchild->name); + "device didn't get destroyed '%pOFn'\n", + grandchild); } platform_device_unregister(test_bus);