[PATCH 17/43] dt-bindings: phy: qcom,qmp-pcie: add missing child node schema

Johan Hovold johan at kernel.org
Tue Jul 5 23:06:12 PDT 2022


On Tue, Jul 05, 2022 at 08:21:12PM +0200, Krzysztof Kozlowski wrote:
> On 05/07/2022 14:11, Johan Hovold wrote:

> > Ok, so you want to flatten this by repeating also the register
> > descriptions?
> > 
> > That wouldn't hurt readability as much, but doing so would be more error
> > prone as it's easy to miss adding a new compatible in every group of
> > conditionals and there's no else clause to catch the mistake.
> > 
> > Right know the logic is
> > 
> > 	if dual-lane
> > 		items = 6
> > 	else
> > 		items = 3 or 4
> > 		if single-lane-exception
> > 			items = 3
> > 		else
> > 			items = 4
> > 
> > Flattening this gives
> > 
> > 	if dual-lane
> > 		items = 6
> > 	if single-lane-normal
> > 		items = 4
> > 	if single-lane-exception
> > 		items = 3
> > 
> > Which means that every compatible must now be listed in one of the
> > conditionals.
> 
> Yes, because it's explicit and easy to read. Handling compatibles in
> 'else' makes it opposite - one cannot use grep and cannot easily find
> what is actually covered by maxItems:4 (you need to check all 7
> compatibles to find what is not covered here).

I'll go with that then.

Johan



More information about the linux-phy mailing list