@@ -313,9 +313,27 @@ def fixup_sub_schema(schema, path=[]):
313313
314314
315315def fixup_node_props (schema ):
316+ if not {'unevaluatedProperties' , 'additionalProperties' } & schema .keys ():
317+ return
318+
319+ keys = []
320+ if 'properties' in schema :
321+ keys .extend (schema ['properties' ].keys ())
322+ if 'patternProperties' in schema :
323+ keys .extend (schema ['patternProperties' ])
324+
325+ if "clocks" in keys and "assigned-clocks" not in keys :
326+ schema ['properties' ]['assigned-clocks' ] = True
327+ schema ['properties' ]['assigned-clock-rates-u64' ] = True
328+ schema ['properties' ]['assigned-clock-rates' ] = True
329+ schema ['properties' ]['assigned-clock-parents' ] = True
330+
331+ # 'dma-ranges' allowed when 'ranges' is present
332+ if 'ranges' in keys :
333+ schema ['properties' ].setdefault ('dma-ranges' , True )
334+
316335 # If no restrictions on undefined properties, then no need to add any implicit properties
317- if (not {'unevaluatedProperties' , 'additionalProperties' } & schema .keys ()) or \
318- ('additionalProperties' in schema and schema ['additionalProperties' ] is True ) or \
336+ if ('additionalProperties' in schema and schema ['additionalProperties' ] is True ) or \
319337 ('unevaluatedProperties' in schema and schema ['unevaluatedProperties' ] is True ):
320338 return
321339
@@ -330,14 +348,6 @@ def fixup_node_props(schema):
330348 schema ['properties' ].setdefault ('bootph-some-ram' , True )
331349 schema ['properties' ].setdefault ('bootph-all' , True )
332350
333- # 'dma-ranges' allowed when 'ranges' is present
334- if 'ranges' in schema ['properties' ]:
335- schema ['properties' ].setdefault ('dma-ranges' , True )
336-
337- keys = list (schema ['properties' ].keys ())
338- if 'patternProperties' in schema :
339- keys .extend (schema ['patternProperties' ])
340-
341351 for key in keys :
342352 if re .match (r'^pinctrl-[0-9]' , key ):
343353 break
@@ -346,12 +356,6 @@ def fixup_node_props(schema):
346356 schema .setdefault ('patternProperties' , dict ())
347357 schema ['patternProperties' ]['pinctrl-[0-9]+' ] = True
348358
349- if "clocks" in keys and "assigned-clocks" not in keys :
350- schema ['properties' ]['assigned-clocks' ] = True
351- schema ['properties' ]['assigned-clock-rates-u64' ] = True
352- schema ['properties' ]['assigned-clock-rates' ] = True
353- schema ['properties' ]['assigned-clock-parents' ] = True
354-
355359
356360# Convert to standard types from ruamel's CommentedMap/Seq
357361def convert_to_dict (schema ):
0 commit comments