Browse Source

checks: add string list check for *-names properties

Add a string list check for common properties ending in "-names" such as
reg-names or interrupt-names.

Signed-off-by: Rob Herring <robh@kernel.org>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
main
Rob Herring 7 years ago committed by David Gibson
parent
commit
18a3d84bb8
  1. 18
      checks.c
  2. 1
      tests/bad-string-props.dts
  3. 2
      tests/run_tests.sh

18
checks.c

@ -620,6 +620,22 @@ WARNING_IF_NOT_STRING(label_is_string, "label"); @@ -620,6 +620,22 @@ WARNING_IF_NOT_STRING(label_is_string, "label");

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) {
const char *s = strrchr(prop->name, '-');
if (!s || !streq(s, "-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)
{
@ -1271,7 +1287,7 @@ static struct check *check_table[] = { @@ -1271,7 +1287,7 @@ static struct check *check_table[] = {
&device_type_is_string, &model_is_string, &status_is_string,
&label_is_string,

&compatible_is_string_list,
&compatible_is_string_list, &names_is_string_list,

&property_name_chars_strict,
&node_name_chars_strict,

1
tests/bad-string-props.dts

@ -6,6 +6,7 @@ @@ -6,6 +6,7 @@
status = <0xdeadbeef>;
label = <0xdeadbeef>;

foobar-names = "foo", <1>;

node {
compatible = "good", <0xdeadbeef>;

2
tests/run_tests.sh

@ -546,7 +546,7 @@ dtc_tests () { @@ -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 label_is_string compatible_is_string_list
check_tests bad-string-props.dts device_type_is_string model_is_string status_is_string label_is_string compatible_is_string_list names_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

Loading…
Cancel
Save