From patchwork Fri Nov 17 14:45:11 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Rob Herring \(Arm\)" X-Patchwork-Id: 119154 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp606483qgn; Fri, 17 Nov 2017 06:45:20 -0800 (PST) X-Google-Smtp-Source: AGs4zMaeRRZCIQoVQJ7SqKbcuxmtO8h946yygPtI+LcvSmy+araFj8CqVmZPkhwe+holi0e/cSGB X-Received: by 10.99.124.73 with SMTP id l9mr5342558pgn.330.1510929920777; Fri, 17 Nov 2017 06:45:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1510929920; cv=none; d=google.com; s=arc-20160816; b=BaRe9YDyfvY11dozlp0ugR7i05Wj73Q1JQEZWVGPQR+L+yS27uEiDPfYt0UFv3Msa0 yhEcOL5Xr4lIe6InDnMnbc7zDXbtmEft7ElVXoHOQxeaJrqIgNivl+bIAG46458hyyOf izEUYqm4VxrnEAWDYeSgEeV0SuKgzDfVg9soAQH/tfKD/uk6T1rosf6StUZdTvReSdxQ ilV+bc0NX1n/vz8mcijG+vkMvFUly2We5qJUsDrC/M1Kx7wEH5qFSW8vOFoZodxCkNtJ iF+zwH2oTYIpun5BTR5Q2SQCfGd/lM+2gMLg823BRkY/ijjVPrDL/P5jGs0TGP48QJYm poIA== 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=7VbzLwcQ9SAS0GrpwiWmv+Z1jcO6dFleXsdCRtOjG0E=; b=FzkJRPaS23cYS8SHcUTUnaNtRIJUyjMKcXBFwADqpanjMXM9PDtIu0dK9pQ8V6I5Qa DisPI6zIg6CxNFFW5nQoA3OZuTOW8iXyMGDEfPI0WaaHuHo/Jz5q5WTzESwZy6XI1lHC HG+4Wo/C2ybi/94gD8n/DbrmR6TpFlD6F5gp0N2GOm668Txh6Ol3qCh3ds2o/TD53E+T 6SJW1INA7td6U0Vf2Zn3Q89yqot6OyJpX11GEzRAsfUU4Tp/TD8jAodqbuoU849cdR8Z 0ztcJnPlYhBvUGkEMnVs99DEQB5tUbIOqG8atjdB+g9BeARkkSti8/K9tv3cTsHIQpaD Aldg== 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.20; Fri, 17 Nov 2017 06:45:20 -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 S964952AbdKQOpT (ORCPT + 6 others); Fri, 17 Nov 2017 09:45:19 -0500 Received: from mail-ot0-f195.google.com ([74.125.82.195]:43034 "EHLO mail-ot0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1030298AbdKQOpS (ORCPT ); Fri, 17 Nov 2017 09:45:18 -0500 Received: by mail-ot0-f195.google.com with SMTP id 105so2170477oth.10; Fri, 17 Nov 2017 06:45:17 -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=zZxMbg03bS0/8uHy9jUz4INwgGzJJ2OqDEkBnsdAt8I=; b=V5aKkF9ErM6LmM57e6HYWOU8ZusebI+bAly4uCd4K/0tkE4lFXmsHok3JJM9rvMvLg UHwopn/Rj4CkBZwbvnzyu/R5teJknY/YfkYy1d08XnkcudrjAc4fjgh0ZbHqPoGWQYlm +BGZWXl/FBPYkfcGiiqQwWBAqPMIshGOFNyKJ113NWb8U8QlnrBvGRB3jdwD1bVKwD0u Hm/LsQYfEJoVolTR3MZ/BMrAfhZ2sCtDwMr5NFDIxdU23aPchQHF5m67bJDMMhjF1daS zV7wHZi/WXFkRs6HT+dFbmLKTdMPl0zeYsnXN0+p23sPMzbGsUIafHDqHzXS1oTF8F8H YHBQ== X-Gm-Message-State: AJaThX6DUrqEa5oZ9fXPaoOJZjP1NKSYVHRGRQAVTshcELWgntejltDn b967EP7QRuv9Eya92Urm7tUbGUc= X-Received: by 10.157.83.38 with SMTP id g38mr1734431oth.340.1510929917314; Fri, 17 Nov 2017 06:45:17 -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.16 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 17 Nov 2017 06:45:16 -0800 (PST) From: Rob Herring To: devicetree-compiler@vger.kernel.org Cc: devicetree@vger.kernel.org Subject: [PATCH 1/5] checks: add a string checks for label, bootargs and stdout-path Date: Fri, 17 Nov 2017 08:45:11 -0600 Message-Id: <20171117144515.10870-2-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 more string property checks for label, bootargs, and stdout-path. Signed-off-by: Rob Herring --- checks.c | 4 ++++ tests/bad-string-props.dts | 3 +++ tests/run_tests.sh | 2 +- 3 files changed, 8 insertions(+), 1 deletion(-) -- 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 f5bf5f97a3ad..a4a9d37ca19b 100644 --- a/checks.c +++ b/checks.c @@ -586,6 +586,9 @@ WARNING_IF_NOT_CELL(interrupt_cells_is_cell, "#interrupt-cells"); WARNING_IF_NOT_STRING(device_type_is_string, "device_type"); WARNING_IF_NOT_STRING(model_is_string, "model"); WARNING_IF_NOT_STRING(status_is_string, "status"); +WARNING_IF_NOT_STRING(label_is_string, "label"); +WARNING_IF_NOT_STRING(bootargs_is_string, "bootargs"); +WARNING_IF_NOT_STRING(stdout_path_is_string, "stdout-path"); static void fixup_addr_size_cells(struct check *c, struct dt_info *dti, struct node *node) @@ -1236,6 +1239,7 @@ static struct check *check_table[] = { &address_cells_is_cell, &size_cells_is_cell, &interrupt_cells_is_cell, &device_type_is_string, &model_is_string, &status_is_string, + &label_is_string, &bootargs_is_string, &stdout_path_is_string, &property_name_chars_strict, &node_name_chars_strict, diff --git a/tests/bad-string-props.dts b/tests/bad-string-props.dts index 396f82069cf7..9b5a7a1736ee 100644 --- a/tests/bad-string-props.dts +++ b/tests/bad-string-props.dts @@ -4,4 +4,7 @@ device_type = <0xdeadbeef>; model = <0xdeadbeef>; status = <0xdeadbeef>; + bootargs = <0xdeadbeef>; + stdout-path = <0xdeadbeef>; + label = <0xdeadbeef>; }; diff --git a/tests/run_tests.sh b/tests/run_tests.sh index 850bc165e757..c610aaeb053e 100755 --- a/tests/run_tests.sh +++ b/tests/run_tests.sh @@ -546,7 +546,7 @@ dtc_tests () { check_tests bad-name-property.dts name_properties check_tests bad-ncells.dts address_cells_is_cell size_cells_is_cell interrupt_cells_is_cell - check_tests bad-string-props.dts device_type_is_string model_is_string status_is_string + check_tests bad-string-props.dts device_type_is_string model_is_string status_is_string bootargs_is_string stdout_path_is_string label_is_string check_tests bad-reg-ranges.dts reg_format ranges_format check_tests bad-empty-ranges.dts ranges_format check_tests reg-ranges-root.dts reg_format ranges_format From patchwork Fri Nov 17 14:45:12 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Rob Herring \(Arm\)" X-Patchwork-Id: 119155 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp606505qgn; Fri, 17 Nov 2017 06:45:21 -0800 (PST) X-Google-Smtp-Source: AGs4zMZdmYLPSugCIQ8InAcvL7X2v6XH7Lz81d7OvuTlkC9zhC792YQOeByVV3yTIHfCIogCXjpn X-Received: by 10.84.245.22 with SMTP id i22mr1226391pll.123.1510929921805; Fri, 17 Nov 2017 06:45:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1510929921; cv=none; d=google.com; s=arc-20160816; b=atCAPN1qKQAWePu8df46m5LJY5slJd+8LicFhXQYhcNAwx6YiM6uFPvP/Hz5p+WuuC H3B3ZB87Ex8ma5gJT4ZMtVu+M2u98uymZEq2zoGap/G4hswY0K37jTn6KL/ObbtXFR/a VKPH4SSOALVOzDUsJQZ0tVX63b41zaOyjXpow5fqjze4Otjl5homZz8zlsAD7hoarjL6 Si1790VkeRecZbjux2zUtXyzR+Gy4v+MHocEcEv9g1Y4iZDqZAfRbqKVY72Y35Bn33/F +jg1c/ai63cmEw3Ml6ynNeQfjpdzdXHc8vyivGVkytG3YnVLA3mm6xQVi14Lafn6WUXE n0PQ== 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=s4DGpd8F8+z+90ABOpYyhrHKynKGHHnqWmHzUNJno3A=; b=pt/HsruI6QZo7Opgpt2F8S+hhBqcd+qlNTytWWqkm+pvO+DrVdG3RxUh9YxR+FZhKE shM3bh4pmXArJLXc9xRmRkNIwt314mTT2N3JdyjxX0DeoVOty4Q2uconV0q9FPyGRTIn 1KR26RI1oFpRCrAf/Wfjz+19xADv15wsRQ9c/NbMLGiXCcMqFa75R7RiQG3h0KjLY1d0 G9FarIy4R3qcjiQoxF41N6VhsEMwVj9zl6+ejP+sgh8isNxxAlIG39C8Ljd1OkfNrro/ 1A5mNw+Y5iPEohxZfJPWtyp3n3tsraeEJV32tcOIFb6UMmq8fU95GCYfWyxBHAuwK/zi Qsrg== 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.21; Fri, 17 Nov 2017 06:45:21 -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 S964974AbdKQOpU (ORCPT + 6 others); Fri, 17 Nov 2017 09:45:20 -0500 Received: from mail-ot0-f193.google.com ([74.125.82.193]:38663 "EHLO mail-ot0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1030297AbdKQOpT (ORCPT ); Fri, 17 Nov 2017 09:45:19 -0500 Received: by mail-ot0-f193.google.com with SMTP id b49so2177059otj.5; Fri, 17 Nov 2017 06:45:18 -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=Q4ZEifLASPHbm6/ux1S/lfGTEIudQjt9BuSPz9pEKWk=; b=Sz3vap8OOfYYsfRlLiM23BRY2fHNX06S9U1fajqtY94kowIGAPOKobU2bmFFBOTEwD YP8wCdWqpovoBrfbI5r8+El7zaLb+u0xTAWq/vqSlXQq8qFhdNVAcMsXx+GNvDBRvjL2 AtOFug5AynJVxXw18H/PvDiRdSzNMI1oW/j711xQUnGSDdAteFQkogaxbi9ixCsREDwu 403ylYlvlXfvXPl7GYhri0bkSY+/ELiRBRDHN2+lxyZn7pJqLHwPp2hvkw8EtWVlVE9Z FIhFR5l2zvIO0ZjFItKl8ynLiD635dmJ1I2mhPtLB4+eVv/OphMY3W5WPDBVp1EP3bLc bUXA== X-Gm-Message-State: AJaThX4uYjWBy4J4WHLrlVFB4abln1OjK35qB0MDBw0nVWhXkXCVE5Pt Jam2UFfMpRgME5TdYhHbqtKGYqg= X-Received: by 10.157.3.43 with SMTP id 40mr1592300otv.156.1510929918264; Fri, 17 Nov 2017 06:45:18 -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.17 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 17 Nov 2017 06:45:17 -0800 (PST) From: Rob Herring To: devicetree-compiler@vger.kernel.org Cc: devicetree@vger.kernel.org Subject: [PATCH 2/5] checks: add string list check Date: Fri, 17 Nov 2017 08:45:12 -0600 Message-Id: <20171117144515.10870-3-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 a check for string list properties with compatible being the first check. Signed-off-by: Rob Herring --- checks.c | 34 ++++++++++++++++++++++++++++++++++ tests/bad-string-props.dts | 8 ++++++++ tests/run_tests.sh | 2 +- 3 files changed, 43 insertions(+), 1 deletion(-) -- 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 Reviewed-by: David Gibson diff --git a/checks.c b/checks.c index a4a9d37ca19b..4e23f29486bb 100644 --- a/checks.c +++ b/checks.c @@ -179,6 +179,36 @@ static void check_is_string(struct check *c, struct dt_info *dti, #define ERROR_IF_NOT_STRING(nm, propname) \ ERROR(nm, check_is_string, (propname)) +static void check_is_string_list(struct check *c, struct dt_info *dti, + struct node *node) +{ + int rem, l; + struct property *prop; + char *propname = c->data; + char *str; + + prop = get_property(node, propname); + if (!prop) + return; /* Not present, assumed ok */ + + str = prop->val.val; + rem = prop->val.len; + while (rem > 0) { + l = strnlen(str, rem); + if (l == rem) { + FAIL(c, dti, "\"%s\" property in %s is not a string list", + propname, node->fullpath); + break; + } + rem -= l + 1; + str += l + 1; + } +} +#define WARNING_IF_NOT_STRING_LIST(nm, propname) \ + WARNING(nm, check_is_string_list, (propname)) +#define ERROR_IF_NOT_STRING_LIST(nm, propname) \ + ERROR(nm, check_is_string_list, (propname)) + static void check_is_cell(struct check *c, struct dt_info *dti, struct node *node) { @@ -590,6 +620,8 @@ WARNING_IF_NOT_STRING(label_is_string, "label"); WARNING_IF_NOT_STRING(bootargs_is_string, "bootargs"); WARNING_IF_NOT_STRING(stdout_path_is_string, "stdout-path"); +WARNING_IF_NOT_STRING_LIST(compatible_is_string_list, "compatible"); + static void fixup_addr_size_cells(struct check *c, struct dt_info *dti, struct node *node) { @@ -1241,6 +1273,8 @@ static struct check *check_table[] = { &device_type_is_string, &model_is_string, &status_is_string, &label_is_string, &bootargs_is_string, &stdout_path_is_string, + &compatible_is_string_list, + &property_name_chars_strict, &node_name_chars_strict, diff --git a/tests/bad-string-props.dts b/tests/bad-string-props.dts index 9b5a7a1736ee..5e226ce0c736 100644 --- a/tests/bad-string-props.dts +++ b/tests/bad-string-props.dts @@ -7,4 +7,12 @@ bootargs = <0xdeadbeef>; stdout-path = <0xdeadbeef>; label = <0xdeadbeef>; + + node1 { + compatible = <0xdeadbeef>; + }; + + node2 { + compatible = "good", <0xdeadbeef>; + }; }; diff --git a/tests/run_tests.sh b/tests/run_tests.sh index c610aaeb053e..f492cf78ae84 100755 --- a/tests/run_tests.sh +++ b/tests/run_tests.sh @@ -546,7 +546,7 @@ dtc_tests () { check_tests bad-name-property.dts name_properties check_tests bad-ncells.dts address_cells_is_cell size_cells_is_cell interrupt_cells_is_cell - check_tests bad-string-props.dts device_type_is_string model_is_string status_is_string bootargs_is_string stdout_path_is_string label_is_string + check_tests bad-string-props.dts device_type_is_string model_is_string status_is_string bootargs_is_string stdout_path_is_string label_is_string compatible_is_string_list check_tests bad-reg-ranges.dts reg_format ranges_format check_tests bad-empty-ranges.dts ranges_format check_tests reg-ranges-root.dts reg_format ranges_format From patchwork Fri Nov 17 14:45:13 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Rob Herring \(Arm\)" X-Patchwork-Id: 119156 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp606545qgn; Fri, 17 Nov 2017 06:45:23 -0800 (PST) X-Google-Smtp-Source: AGs4zMb5qDF2q6hfEZZ1BKECob83RddagGBjSK3+EHehMuXCmUfAGFi6tn519w4Iuak53qhmB1lP X-Received: by 10.99.139.199 with SMTP id j190mr5276088pge.375.1510929923363; Fri, 17 Nov 2017 06:45:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1510929923; cv=none; d=google.com; s=arc-20160816; b=gwhfR1sEXyzOeseJRZxGzdIJstYpnKK1up+dq0nLz6BQcSbzsnG0pnbkRUoGQ5UtzD xhDgIG+KrKVd4vWOTG4ApQ4BdJJL4mORBXE1zGL3vmkr0GknRHoOGNkUObhvNpts/jGO jnJ78UL6OBIrXRgMy27WmpOHzoRJ21F3LXB7BDIikgjusXtn92SKauS/Jp8DAHqxjrVu NfvFJEpCE407FLtSJpsopuWX7TTsX0jPupCwYVvnmkd+K7/daSEXt1s8MvD3VRx9Dy3R xfb/mildBJq+3HR4d6QBgRS+DdEpFzmaK5DVyNljGjSwDAFVUv/aes+u0YvfrzzdyIdu EJ1A== 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=0IoiKrU1GCUACG9VVtGQE0RbxPb8QKPbWgli5kkSqDc=; b=izgZq6qnqfkBVzYymD7IS29w97aNQYWLRCQApsaaLhxZ98ix964UeC7rP1onkVeHsn Idwqx0gudbO7pXfArpLtJxzzfi71vQ3QRIGK1QLrzIV8d/9gmefZdfoMGMrm1lfbi/GO vb1JzJY/5u9dDeosmxyyhaRYfxFsq7NGy2VRTHxeTkpxt5aCQ594Czyq/BJAaSexyOh4 K5DJrqy0jmRcwEZYIBGg/mDLlrMpoeYwAnsJZASrRV4wKt+WhwEPC25a31HYNXxEN6VV PrsnG++1GfJ1icCSP/WUO20JhP0hh//HeH11pbdJl7AuBLqwWbzRpTlOE95DwqzU5BCG FvRA== 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.23; Fri, 17 Nov 2017 06:45:23 -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 S964979AbdKQOpV (ORCPT + 6 others); Fri, 17 Nov 2017 09:45:21 -0500 Received: from mail-ot0-f193.google.com ([74.125.82.193]:44774 "EHLO mail-ot0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S964972AbdKQOpU (ORCPT ); Fri, 17 Nov 2017 09:45:20 -0500 Received: by mail-ot0-f193.google.com with SMTP id d27so2162687ote.11; Fri, 17 Nov 2017 06:45:19 -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=nqtTVvf29hOzAipWZmVg5dsI2U54uDMy6Jl7EXnuOW0=; b=K3j3XgA5zovhygO0DcBc+hbCYoGBZZ6PfMNuPgrwqNA/KV+HX9w2zUgbg1rs2Vk/wm j/JE512fAT2pUkzRhtsvmW5tljA1vTNa++Bfm1RebnF+GAMwuGCgcvvTB1hKfb87nqh2 /RhUI/45cgJUnRi1ryAbmHjbK/TRBxpMaaVQK8wgQOqbUlCHH4zs57AcixwelEMkzcEZ wG0StUtmjOlAlEQcLueuV7+7kMkbX5YNwlB09llZujRMNoBPZgzZaLtTEI2kj0I3FmUp QnQlvTS25u6gf1iynfbuxGvDagtejpRkSYlmXq+xLY2xTqjLIK9qWM16JiHClAFUwEa3 7fuw== X-Gm-Message-State: AJaThX7RksPdOB53zL/Vm/lqozv/Avsok1qczSsMIhKdJfAZEjW8yjaL BMN8Rt0HXj8nsxopIEoNyq+uxBU= X-Received: by 10.157.21.99 with SMTP id z32mr1553169otz.351.1510929919146; Fri, 17 Nov 2017 06:45:19 -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.18 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 17 Nov 2017 06:45:18 -0800 (PST) From: Rob Herring To: devicetree-compiler@vger.kernel.org Cc: devicetree@vger.kernel.org Subject: [PATCH 3/5] checks: add string list check for *-names properties Date: Fri, 17 Nov 2017 08:45:13 -0600 Message-Id: <20171117144515.10870-4-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 a string list check for common properties ending in "-names" such as reg-names or interrupt-names. Signed-off-by: Rob Herring --- checks.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) -- 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 4e23f29486bb..346b0256f9cb 100644 --- a/checks.c +++ b/checks.c @@ -622,6 +622,21 @@ WARNING_IF_NOT_STRING(stdout_path_is_string, "stdout-path"); WARNING_IF_NOT_STRING_LIST(compatible_is_string_list, "compatible"); +static void check_names_is_string_list(struct check *c, struct dt_info *dti, + struct node *node) +{ + struct property *prop; + + for_each_property(node, prop) { + if (!strstr(prop->name, "-names")) + continue; + + c->data = prop->name; + check_is_string_list(c, dti, node); + } +} +WARNING(names_is_string_list, check_names_is_string_list, NULL); + static void fixup_addr_size_cells(struct check *c, struct dt_info *dti, struct node *node) { @@ -1273,7 +1288,7 @@ static struct check *check_table[] = { &device_type_is_string, &model_is_string, &status_is_string, &label_is_string, &bootargs_is_string, &stdout_path_is_string, - &compatible_is_string_list, + &compatible_is_string_list, &names_is_string_list, &property_name_chars_strict, &node_name_chars_strict, From patchwork Fri Nov 17 14:45:14 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Rob Herring \(Arm\)" X-Patchwork-Id: 119157 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp606558qgn; Fri, 17 Nov 2017 06:45:24 -0800 (PST) X-Google-Smtp-Source: AGs4zMa2fiT9D3daZZpn8HFFxSqYM3tuv6VUvhx4I2WI3s1zGCKGtGzqn9vFn/mpYoql8ELv6s2A X-Received: by 10.98.214.145 with SMTP id a17mr2270133pfl.167.1510929924290; Fri, 17 Nov 2017 06:45:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1510929924; cv=none; d=google.com; s=arc-20160816; b=gXnsf5/4fIggJxXOxl/IUG7w40gcpasoxXEXtsPS+JtGl+d7GGluIDUmM100n8c5PY bLzokEKLQNEnPcwsO5/9avfnKFI3BLLhagLXjOWlo7ApCeo9t/bV+4qGNSGMk6ZLZbUd 4LEnXLB8xOFJV2mq31zwOz7Xs967Bk+drtkaDEe+vnrh5mj2MVvv7W5mxi0SUR13GLZ3 Sli1RWTAfRwQ2mrdkKcvjw7nv3flrE6WOaHJPEAv9HPrzsXr697roTF/Zq1SxZNKjEQ8 tYe7IyO0fFhwF27wr2U2LqeyvJ7Vz3HzKHbinjEHwa5i5vPHQ7XsQa97kmlNH4TnNyph PTpg== 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=8z4P2dUAnjEJZtRyTRaW2iuw9KLsGihoRpCQNsCp37s=; b=MNFqyXEqWFwBkrOsqw8MKNXsjt3eGUAOi6SSZSOLgrNst3bduxAnOo6bCkZCvmjet1 0FB/oB+yfAZxqgVg08+rlOhMbvgQKppJ4G0jNqadSIuqR21zR46HUvKMEZ0/XZxRW3q+ jy3qa2xVuRCUoppXDZM7b1amlWfzhV0Fyp7vYagXmspDiM79+xvbHeiB9keYVeTzTXe8 F/HjkCQq5k+nzoPGwq3rvHPn1c+KPypua2j5qYeWajy3KWJiE4i6xYDmsJ3eIv5D0eQc ny08pc5gZyGTGWUkNZnV/awWA3OPn+J0qNlXGjEhDxv0Dn4LBKjjNv0Ep5MinQO46pRT MUlg== 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.24; Fri, 17 Nov 2017 06:45:24 -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 S964972AbdKQOpW (ORCPT + 6 others); Fri, 17 Nov 2017 09:45:22 -0500 Received: from mail-ot0-f196.google.com ([74.125.82.196]:35822 "EHLO mail-ot0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S964975AbdKQOpV (ORCPT ); Fri, 17 Nov 2017 09:45:21 -0500 Received: by mail-ot0-f196.google.com with SMTP id b17so2190867oth.2; Fri, 17 Nov 2017 06:45:20 -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=2RHpiPteFNz/c+xV35m85oOauUuLeJgpdT32vjxr03I=; b=coK1q8Qbfi4Ew3Uz8ZsGnHHyRtd1WrsKznWzO5saHFXW4e7Ex3BU3NBTjQycIT0/gF At5W+J0LxlbeHmejUhQlA83rKEfbfRv1OhAo+cRsKOeL4Fivv8vvhaobw/A3n+fNrkeL UVDgq3kGvgHp8wfzRXpzy+42cUH3PL/Pc9wlcdSL3nqcaBRqshweEIeSQ7uruiTgeUML RYzNpcSr22p+YO3hlHpdURmWKYbWJsrxiIe9ymWq8z+m3AsC0N2ARqqoU3EphcKvWTJO wOYfwzeEat/MVlhEmbRXoj1nsL8KMBdQ6ZkFWV/Z91SczgDfWAebitXBXo+LG6Bh7HlF fcSw== X-Gm-Message-State: AJaThX5EgpUfAy1hDX63RYI762hiuuZ98wPidewfFa0rlEYXv7+957B+ 3IFkc2bxGC2doZDtobhwkdCwzpY= X-Received: by 10.157.39.134 with SMTP id c6mr1416270otb.259.1510929920120; Fri, 17 Nov 2017 06:45:20 -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.19 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 17 Nov 2017 06:45:19 -0800 (PST) From: Rob Herring To: devicetree-compiler@vger.kernel.org Cc: devicetree@vger.kernel.org Subject: [PATCH 4/5] checks: check for #{size, address}-cells without child nodes Date: Fri, 17 Nov 2017 08:45:14 -0600 Message-Id: <20171117144515.10870-5-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 nodes with a 'reg' property nor a ranges property. An exception may be an overlay that adds nodes, but this case would need Signed-off-by: Rob Herring --- checks.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 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 346b0256f9cb..a785b81bea07 100644 --- a/checks.c +++ b/checks.c @@ -982,6 +982,31 @@ static void check_avoid_default_addr_size(struct check *c, struct dt_info *dti, WARNING(avoid_default_addr_size, check_avoid_default_addr_size, NULL, &addr_size_cells); +static void check_avoid_unecessary_addr_size(struct check *c, struct dt_info *dti, + struct node *node) +{ + struct property *prop; + struct node *child; + bool has_reg = false; + + if (!node->parent || node->addr_cells < 0 || node->size_cells < 0) + return; + + if (get_property(node, "ranges") || !node->children) + return; + + for_each_child(node, child) { + prop = get_property(child, "reg"); + if (prop) + has_reg = true; + } + + if (!has_reg) + FAIL(c, dti, "unnecessary #address-cells/#size-cells without \"ranges\" or child \"reg\" property in %s", + node->fullpath); +} +WARNING(avoid_unecessary_addr_size, check_avoid_unecessary_addr_size, NULL, &avoid_default_addr_size); + static void check_obsolete_chosen_interrupt_controller(struct check *c, struct dt_info *dti, struct node *node) @@ -1306,6 +1331,7 @@ static struct check *check_table[] = { &simple_bus_reg, &avoid_default_addr_size, + &avoid_unecessary_addr_size, &obsolete_chosen_interrupt_controller, &clocks_property, 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 \(Arm\)" 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, };