From patchwork Fri Nov 17 14:45:15 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rob Herring X-Patchwork-Id: 119158 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp606582qgn; Fri, 17 Nov 2017 06:45:25 -0800 (PST) X-Google-Smtp-Source: AGs4zMaWRpwDz3lmhoIZQfsKK479mZkC+xXoioJ9CnRDXM5RbOEsxr5TK+Py8DLRmwqccckPIteA X-Received: by 10.99.124.24 with SMTP id x24mr5300141pgc.196.1510929925420; Fri, 17 Nov 2017 06:45:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1510929925; cv=none; d=google.com; s=arc-20160816; b=iOvIb+ytp0euTqzw/R4IuBpkYoxXe7SF17Pi9bv0XBu8i6fUNb/XHw10nuL9/JEnl6 p2Ee8FeD1Ua2bDBZqOXreUF3gDf4AHh57HzIexHx6WSKNPyISGxeyrN+1pXMktEfK3v7 khV01arn2Cr1wM2H8PaQpyPGneruXtdNoUF9R1e2LEzUbdxkHkOPE20xc3+7zU3UixXJ oCEhx2Q38SSLZVvwGaqGxwbx3jUETOdspNZPsagD3/Fvtk2tFucdsdMObWtISgGfoCYx 0Z1np6YKCWdfb6dI6P3CII4fyTGrhWZtMaPKb6LQdYhD40s0cWc2ywD4ieATtYud4d1m IhiQ== 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=1yi5R2e9ROvYYNr1qJZfatvxadCgWULvldwk8oFHOfg=; b=TqrAalTKwGmXyAbLJx1fMUPOG38kCHKEgC2KYNBkMHQ1iYnmF2UIlBQkRrTIXazXGG 2dvIUDnZF9ognOw8QI4WqMDA54Fdc/jaegLmG5EQ1AJZnXVKEy2LeFSkbfXz20jsin8Z ZAXL34FSdvZHsgV2tvNgPtcXni1wZmvQSE05AfUEdx0TKXeFl0+/QtX440e10EdWNFx2 yWKWOT7qg+YkpL+y8lytoolKeKYBCYOZ/fKX9SGEEis4Yomts/vXlVmWEO+lg3kE0708 sG8f6hPraIsCmlXVPqQtKaDRS8+rDfojdWchErLzN5JHKdP7eSxcbRq9EnVdGzKe1ofe kGlg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=devicetree-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q8si3129534pfa.310.2017.11.17.06.45.25; Fri, 17 Nov 2017 06:45:25 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of devicetree-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 devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=devicetree-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S964988AbdKQOpY (ORCPT + 6 others); Fri, 17 Nov 2017 09:45:24 -0500 Received: from mail-ot0-f193.google.com ([74.125.82.193]:33402 "EHLO mail-ot0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S964966AbdKQOpW (ORCPT ); Fri, 17 Nov 2017 09:45:22 -0500 Received: by mail-ot0-f193.google.com with SMTP id s12so2186208otc.0; Fri, 17 Nov 2017 06:45:21 -0800 (PST) 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=vbhrcyd9gJsdP297UmKQcnUxSORQHsQHkpvi+qJfEiw=; b=kmd7J0sVnZQvqbtQt3F+VnPvSJ5ZXCkr5+xuFDKChAJbTyHSVFDH4jNEpG+Y6hG+Ln 0t0JBVBzd8e2kRQdkeqTohMUsz3bFExZUV6QwpuBJABC46JBz0kb29WPNIM0qAo/xbzO szkcc0b3vwV8KVooZdNAiMQaFfREyJaUJrJcxPIl3rBEPBbca40xu9J8HPIusMH3qPX4 UQPHd420LoSl8300uRKFy669P2BaoxsUu7Z9NmZIXp1VBhSK5WHEWbbqAr1qOKq4m/wm ZsauN847JK68V3nD9KfUlvrmIE56ahMEnHxlHJlUgV0gPxYc9w6m091ChHuc/AZBsg89 ZcNA== X-Gm-Message-State: AJaThX4XKRdyk0jRsZVETWc5eZXsS5hlXZ36+4fp5ptXtuwLNpRvkr7M 9oHbNvsw6dvohfjhHXEVgdczLV4= X-Received: by 10.157.11.229 with SMTP id 92mr1770010oth.264.1510929921070; Fri, 17 Nov 2017 06:45:21 -0800 (PST) Received: from xps15.herring.priv (216-188-254-6.dyn.grandenetworks.net. [216.188.254.6]) by smtp.googlemail.com with ESMTPSA id i6sm1529906oiy.37.2017.11.17.06.45.20 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 17 Nov 2017 06:45:20 -0800 (PST) From: Rob Herring To: devicetree-compiler@vger.kernel.org Cc: devicetree@vger.kernel.org Subject: [PATCH 5/5] checks: add aliases node checks Date: Fri, 17 Nov 2017 08:45:15 -0600 Message-Id: <20171117144515.10870-6-robh@kernel.org> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20171117144515.10870-1-robh@kernel.org> References: <20171117144515.10870-1-robh@kernel.org> Sender: devicetree-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org Add checks for aliases node that properties are a valid path and that the alias property names are a known, standard name. Signed-off-by: Rob Herring --- checks.c | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) -- 2.14.1 -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/checks.c b/checks.c index a785b81bea07..2c5b6c2eacb3 100644 --- a/checks.c +++ b/checks.c @@ -637,6 +637,48 @@ static void check_names_is_string_list(struct check *c, struct dt_info *dti, } WARNING(names_is_string_list, check_names_is_string_list, NULL); +static void check_alias_paths(struct check *c, struct dt_info *dti, + struct node *node) +{ + struct property *prop; + + if (!streq(node->name, "aliases")) + return; + + for_each_property(node, prop) { + if (!prop->val.val || !get_node_by_path(dti->dt, prop->val.val)) + FAIL(c, dti, "aliases property '%s' is not a valid node (%s)", + prop->name, prop->val.val); + } +} +WARNING(alias_paths, check_alias_paths, NULL); + +static void check_known_aliases(struct check *c, struct dt_info *dti, + struct node *node) +{ + int i; + struct property *prop; + static char *aliases_strings[] = { + "ethernet", "gpio", "i2c", "rtc", "serial", "spi" + }; + + if (!streq(node->name, "aliases")) + return; + + for_each_property(node, prop) { + for (i = 0; i < ARRAY_SIZE(aliases_strings); i++) { + if (strstarts(prop->name, aliases_strings[i])) + break; + } + + if (i == ARRAY_SIZE(aliases_strings)) { + FAIL(c, dti, "unknown alias name %s", prop->name); + continue; + } + } +} +WARNING(known_aliases, check_known_aliases, NULL); + static void fixup_addr_size_cells(struct check *c, struct dt_info *dti, struct node *node) { @@ -1355,6 +1397,8 @@ static struct check *check_table[] = { &gpios_property, &interrupts_property, + &known_aliases, &alias_paths, + &always_fail, };