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
parent
8fe94fd6f1
commit
18a3d84bb8
18
checks.c
18
checks.c
|
@ -620,6 +620,22 @@ WARNING_IF_NOT_STRING(label_is_string, "label");
|
||||||
|
|
||||||
WARNING_IF_NOT_STRING_LIST(compatible_is_string_list, "compatible");
|
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,
|
static void fixup_addr_size_cells(struct check *c, struct dt_info *dti,
|
||||||
struct node *node)
|
struct node *node)
|
||||||
{
|
{
|
||||||
|
@ -1271,7 +1287,7 @@ static struct check *check_table[] = {
|
||||||
&device_type_is_string, &model_is_string, &status_is_string,
|
&device_type_is_string, &model_is_string, &status_is_string,
|
||||||
&label_is_string,
|
&label_is_string,
|
||||||
|
|
||||||
&compatible_is_string_list,
|
&compatible_is_string_list, &names_is_string_list,
|
||||||
|
|
||||||
&property_name_chars_strict,
|
&property_name_chars_strict,
|
||||||
&node_name_chars_strict,
|
&node_name_chars_strict,
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
status = <0xdeadbeef>;
|
status = <0xdeadbeef>;
|
||||||
label = <0xdeadbeef>;
|
label = <0xdeadbeef>;
|
||||||
|
|
||||||
|
foobar-names = "foo", <1>;
|
||||||
|
|
||||||
node {
|
node {
|
||||||
compatible = "good", <0xdeadbeef>;
|
compatible = "good", <0xdeadbeef>;
|
||||||
|
|
|
@ -546,7 +546,7 @@ dtc_tests () {
|
||||||
check_tests bad-name-property.dts name_properties
|
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-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-reg-ranges.dts reg_format ranges_format
|
||||||
check_tests bad-empty-ranges.dts ranges_format
|
check_tests bad-empty-ranges.dts ranges_format
|
||||||
check_tests reg-ranges-root.dts reg_format ranges_format
|
check_tests reg-ranges-root.dts reg_format ranges_format
|
||||||
|
|
Loading…
Reference in New Issue