Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp3322114imm; Sun, 14 Oct 2018 17:27:28 -0700 (PDT) X-Google-Smtp-Source: ACcGV61CmJWIh5eu3xpQcBPEPfHuniMmD9qKJInZC3tcH5oZbDCt3dDQ2wr+sxaZ0VzxeTkzG3n6 X-Received: by 2002:a63:7506:: with SMTP id q6-v6mr13861583pgc.137.1539563248912; Sun, 14 Oct 2018 17:27:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539563248; cv=none; d=google.com; s=arc-20160816; b=eQLPxOGF1+OBGf+83PBl4o0ept/cZaRkuKjxU337E2ZldBO6qgUvII9m4d0FoIn28M 9yL21KIWAVyErlR7rnEFjAf7Yzn8DRrrevi8EQe1R9SBLuGbMloii5cpekEH1YpULfaQ 7OK8ncC44qRte/ZVZab/bYHN6l1hc4W8qkJFTviFtLTGyndcE1Hb/kbN+B2Aehyfej4j kp0lnjtSYsfPaLOh/fe/6dQtZkZ3U6PthJgZav1mygNZlUGTDrm0pMv3SAeCqcRnugaT 2ooNG9JdeNO3VpZOHOWbC1c7rc/nFjw03mjSzs6r73308D0SYFGVxqjtpU+OyDDGxHjj 085w== 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:dkim-signature; bh=M4dGHNWK9yvMCplN74sEUY4ZcqWQ+poGeb6zjVC5TlY=; b=p/NNbfr7RkEg4cq87zqDvFkDD5zgWN0aM5kHZy/Mm1m0gMeoo+9Sa875Y5Y6qHfZBA ekk+Het47LqO9HnmwS/FR9g5P6julYOEcw2FIHRpphkM8Er+yXY+5fWoONwQ/g8RqkzJ SAgIlUN1UUq/EdomIO9t6Cs8scM1JTzuWoKhPYj4mQYS32Yn9tsEU/Pj27fFw/l+0K/6 9piouV/IPUSSSxmUF+I/yg0PIe1e2GLTC5atDlMBl/61kcknYfjhJZ5sgGH2AEexnXKW ejwxyU5PWjzByNvfWuDROrWAbWMP5UPS6U6Sm55uI292nRorLSSkO78lWHm/PUrROyb5 6T0g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=gWyRcxwj; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m3-v6si7018336pld.281.2018.10.14.17.27.14; Sun, 14 Oct 2018 17:27:28 -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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=gWyRcxwj; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727038AbeJOIJ3 (ORCPT + 99 others); Mon, 15 Oct 2018 04:09:29 -0400 Received: from mail-pg1-f195.google.com ([209.85.215.195]:36256 "EHLO mail-pg1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726541AbeJOIJI (ORCPT ); Mon, 15 Oct 2018 04:09:08 -0400 Received: by mail-pg1-f195.google.com with SMTP id f18-v6so8309106pgv.3; Sun, 14 Oct 2018 17:26:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=M4dGHNWK9yvMCplN74sEUY4ZcqWQ+poGeb6zjVC5TlY=; b=gWyRcxwjcQIHmXE3ZziNd+GcsFcruZnlEBbPXRlGsVou9U8Iw0tlYr3VAR3cBksx9G N7tySGgEP/HFuxeC843p+3bnWGpTsgKPZ03NxEqjRm7gPsftSfRTCzU4G6eXXA8mG9IG zr4r8HyF9JyNyuWc52elnRofPsuMQYZKkZ3xBs+MBcN8+e49lHo0aXHnwqenZptAuVH5 Fr0duPpaar6ht3gsyjM9U1eKgG3fX7JLhD4pit240ydQvLfc7hWQNxHlxNZDjqSPMfXP TscVakrTjOgukthrFt2MNfub0PK2ZsovcKCxPI3kt5e6DwO1BMdXfNwHH0pC8YObF7vy JWFw== 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=M4dGHNWK9yvMCplN74sEUY4ZcqWQ+poGeb6zjVC5TlY=; b=RliUFaNpp7/7+HRK/VrJBWxP7l/fCVtVcEoCtj+8zNzKfxnJbMzhkRbsvQsTDs4uQK VJtR+m0qRZ7W+7bBmEXW1i8YkOZPBXu9rUeCqeD2/3dQWzb86KxyGnWYdQNf6tWhO1qH ge0ILnd4jy7tURiopeKS2PHqniSVijPX0MlM33fldU7HrsGb58EOQzZkWsDoTSqgCatB zhCCZlgC/jK0gRwUmyFVSqf+fLtgas6fH6OhmqHVizPNfnjQmFRa9VMUdGJhxtXVcUep XaRq9vch6R4J7vQ4JiWwwDI04/GaEhmsnJ/jHfGwRCdo/d4q3ZJeCWFkiotCRRvpAptl TygA== X-Gm-Message-State: ABuFfoinrnFWONJpk8PVNX9yRwh4slfbePEHkVx+k/EZEVymeRg+yt/x a1fuyd32RLkZnaDpR/VUyCI= X-Received: by 2002:a63:f5a:: with SMTP id 26-v6mr14016650pgp.100.1539563179957; Sun, 14 Oct 2018 17:26:19 -0700 (PDT) Received: from localhost.localdomain (c-24-6-192-50.hsd1.ca.comcast.net. [24.6.192.50]) by smtp.gmail.com with ESMTPSA id j14-v6sm11387110pgh.52.2018.10.14.17.26.18 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 14 Oct 2018 17:26:19 -0700 (PDT) From: frowand.list@gmail.com To: Rob Herring , Pantelis Antoniou , Michael Ellerman , Benjamin Herrenschmidt , Paul Mackerras , Alan Tull , Moritz Fischer Cc: linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, devicetree@vger.kernel.org, linux-fpga@vger.kernel.org Subject: [PATCH v3 16/18] of: unittest: allow base devicetree to have symbol metadata Date: Sun, 14 Oct 2018 17:24:28 -0700 Message-Id: <1539563070-12969-17-git-send-email-frowand.list@gmail.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1539563070-12969-1-git-send-email-frowand.list@gmail.com> References: <1539563070-12969-1-git-send-email-frowand.list@gmail.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Frank Rowand The overlay metadata nodes in the FDT created from testcases.dts are not handled properly. The __fixups__ and __local_fixups__ node were added to the live devicetree, but should not be. Only the first property in the /__symbols__ node was added to the live devicetree if the live devicetree already contained a /__symbols node. All of the node's properties must be added. Signed-off-by: Frank Rowand --- drivers/of/unittest.c | 43 +++++++++++++++++++++++++++++++++++-------- 1 file changed, 35 insertions(+), 8 deletions(-) diff --git a/drivers/of/unittest.c b/drivers/of/unittest.c index 6d80f474c8f2..1c2bd8503095 100644 --- a/drivers/of/unittest.c +++ b/drivers/of/unittest.c @@ -1057,20 +1057,44 @@ static void __init of_unittest_platform_populate(void) * of np into dup node (present in live tree) and * updates parent of children of np to dup. * - * @np: node already present in live tree + * @np: node whose properties are being added to the live tree * @dup: node present in live tree to be updated */ static void update_node_properties(struct device_node *np, struct device_node *dup) { struct property *prop; + struct property *save_next; struct device_node *child; - - for_each_property_of_node(np, prop) - of_add_property(dup, prop); + int ret; for_each_child_of_node(np, child) child->parent = dup; + + /* + * "unittest internal error: unable to add testdata property" + * + * If this message reports a property in node '/__symbols__' then + * the respective unittest overlay contains a label that has the + * same name as a label in the live devicetree. The label will + * be in the live devicetree only if the devicetree source was + * compiled with the '-@' option. If you encounter this error, + * please consider renaming __all__ of the labels in the unittest + * overlay dts files with an odd prefix that is unlikely to be + * used in a real devicetree. + */ + + /* + * open code for_each_property_of_node() because of_add_property() + * sets prop->next to NULL + */ + for (prop = np->properties; prop != NULL; prop = save_next) { + save_next = prop->next; + ret = of_add_property(dup, prop); + if (ret) + pr_err("unittest internal error: unable to add testdata property %pOF/%s", + np, prop->name); + } } /** @@ -1079,18 +1103,23 @@ static void update_node_properties(struct device_node *np, * * @np: Node to attach to live tree */ -static int attach_node_and_children(struct device_node *np) +static void attach_node_and_children(struct device_node *np) { struct device_node *next, *dup, *child; unsigned long flags; const char *full_name; full_name = kasprintf(GFP_KERNEL, "%pOF", np); + + if (!strcmp(full_name, "/__local_fixups__") || + !strcmp(full_name, "/__fixups__")) + return; + dup = of_find_node_by_path(full_name); kfree(full_name); if (dup) { update_node_properties(np, dup); - return 0; + return; } child = np->child; @@ -1111,8 +1140,6 @@ static int attach_node_and_children(struct device_node *np) attach_node_and_children(child); child = next; } - - return 0; } /** -- Frank Rowand