On Thu, Dec 14, 2023 at 10:13 AM Conor Dooley <conor@xxxxxxxxxx> wrote: > > On Sun, Dec 10, 2023 at 09:37:49AM -0600, Rob Herring wrote: > > On Sun, Dec 10, 2023 at 02:52:45PM +0000, Conor Dooley wrote: > > > On Sat, Dec 09, 2023 at 05:59:17PM -0300, Fabio Estevam wrote: > > > > Hi Conor, > > > > > > > > On 09/12/2023 17:23, Conor Dooley wrote: > > > > > > > > > You're adding the constraints and items at the wrong level AFAICT. > > > > > I think something like the below better matches your constraints? > > > > > > > > Thanks for your example. > > > > > > > > With your change the fsl,imx93-tmu case works correctly: > > > > if I pass the number of fsl,tmu-range entries different than 7, > > > > dt_binding_check correctly complains. > > > > > > > > However, if I pass 7 entries to fsl,qoriq-tmu it should complain as it > > > > expects 4, but it > > > > > > btw, unrelated - minItems seems (from a grep) like it needs to be 2 not > > > 4. > > > > > > > does not. > > > > > > > > On top of your patch: > > > > > > > > --- a/Documentation/devicetree/bindings/thermal/qoriq-thermal.yaml > > > > +++ b/Documentation/devicetree/bindings/thermal/qoriq-thermal.yaml > > > > @@ -104,7 +104,7 @@ additionalProperties: false > > > > examples: > > > > - | > > > > tmu@f0000 { > > > > - compatible = "fsl,imx93-tmu"; > > > > + compatible = "fsl,qoriq-tmu"; > > > > reg = <0xf0000 0x1000>; > > > > interrupts = <18 2 0 0>; > > > > fsl,tmu-range = <0x000a0000 0x00090026 0x0008004a 0x0001006a 0 0 > > > > 0>; > > > > > > > > make dt_binding_check DT_SCHEMA_FILES=qoriq-thermal.yaml > > > > LINT Documentation/devicetree/bindings > > > > DTEX > > > > Documentation/devicetree/bindings/thermal/qoriq-thermal.example.dts > > > > CHKDT Documentation/devicetree/bindings/processed-schema.json > > > > SCHEMA Documentation/devicetree/bindings/processed-schema.json > > > > DTC_CHK > > > > Documentation/devicetree/bindings/thermal/qoriq-thermal.example.dtb > > > > > > > > Any suggestions? > > > > > > I dunno. I spent far far longer than I would like to admit trying to fix > > > this. Firstly my suggestion here is crap I think and only applies to > > > ___matrices___. I think it needs to be the way you had it in your diff, > > > but I cannot figure out why it doesn't apply the maxItems constraint. > > > > > > Perhaps Rob or Krzysztof can figure out what we were overlooking. > > > The diff in question was something like: > > > > I suspect something is going afoul in the fixups. Will look at it > > tomorrow. > > Did you manage to figure out what was causing this btw? Yes. There's not really an immediate fix I see. The issue is in the if/then schemas we don't have enough information to know the type of fsl,tmu-range. To work correctly, it needs to be transformed to: fsl,tmu-range: items: minItems: 7 maxItems: 7 This goes back to everything gets encoded into a 2 dim matrix, but the schemas try to hide this encoding. My plan here is to eventually drop doing that and decode properties to their correct type. That will drop a lot of the fixups. I have patches to do that, but then it has other corner cases. So short term, I'd just leave things such that they don't warn or just drop the conditional. Rob