[PATCH v2 1/2] dt-bindings: pwm: Allow decimal format in addition to hex format

Tony Lindgren tony at atomide.com
Tue Nov 22 02:37:26 PST 2022


* Uwe Kleine-König <u.kleine-koenig at pengutronix.de> [221122 09:26]:
> On Tue, Nov 22, 2022 at 06:43:55AM +0200, Tony Lindgren wrote:
> > * Krzysztof Kozlowski <krzysztof.kozlowski at linaro.org> [221121 16:05]:
> > > On 21/11/2022 15:48, Tony Lindgren wrote:
> > > > * Uwe Kleine-König <u.kleine-koenig at pengutronix.de> [221121 14:30]:
> > > >> On Mon, Nov 21, 2022 at 01:55:24PM +0200, Tony Lindgren wrote:
> > > >>> Let's allow node numbering in decimal format too.
> > > >>>
> > > >>> Simple human-readable increments/IDs are usually decimal, hex is only for
> > > >>> addresses as noted by Krzysztof Kozlowski <krzysztof.kozlowski at linaro.org>.
> > > >>>
> > > >>> Cc: Thierry Reding <thierry.reding at gmail.com>
> > > >>> Cc: Uwe Kleine-König <u.kleine-koenig at pengutronix.de>
> > > >>> Suggested-by: Krzysztof Kozlowski <krzysztof.kozlowski at linaro.org>
> > > >>> Signed-off-by: Tony Lindgren <tony at atomide.com>
> > > >>> ---
> > > >>>  Documentation/devicetree/bindings/pwm/pwm.yaml | 2 +-
> > > >>>  1 file changed, 1 insertion(+), 1 deletion(-)
> > > >>>
> > > >>> diff --git a/Documentation/devicetree/bindings/pwm/pwm.yaml b/Documentation/devicetree/bindings/pwm/pwm.yaml
> > > >>> --- a/Documentation/devicetree/bindings/pwm/pwm.yaml
> > > >>> +++ b/Documentation/devicetree/bindings/pwm/pwm.yaml
> > > >>> @@ -13,7 +13,7 @@ select: false
> > > >>>  
> > > >>>  properties:
> > > >>>    $nodename:
> > > >>> -    pattern: "^pwm(@.*|-[0-9a-f])*$"
> > > >>> +    pattern: "^pwm(@.*|-([0-9a-f]|1[0-5]))*$"
> > > >>
> > > >> I wonder why you don't make this:
> > > >>
> > > >> +    pattern: "^pwm(@.*|-[0-9a-f]*)$"
> > > 
> > > Yes, the '*' should be within ().
> > 
> > Sorry I guess I don't follow. So for what type of naming is the second '*'
> > actually needed here, or is it needed at all?
> > 
> > We only want to match the following:
> > 
> > pwm at 1234
> > 
> > pwm-0
> > ...
> > pwm-f
> > 
> > And now also:
> > 
> > pwm-0
> > ...
> > pwm-15
> > 
> > Is there yet another format I'm missing?
> 
> I think there is a misunderstanding about the type of pattern here. Do
> we talk about a shell pattern where "[0-9a-f]*" matches a name starting
> with a hex digit followed by any number of any caracter, or is it a
> regexp where the * means "any number of the preceding pattern", so
> effectively a word consisting of only hex digits.
> 
> The .* part makes me think we're talking about a regexp, so the old
> pattern ("^pwm(@.*|-[0-9a-f])*$") means that
> 
> 	pwm-1-2-3-4
> 
> is allowed but
> 
> 	pwm-10
> 
> isn't. And I think what we want is:
> 
> 	"^pwm(@.*|-[0-9a-f]*)$"

Heh so this fails for just node name pwm:

pwm: $nodename:0: 'pwm' does not match '^pwm(@.*|-[0-9a-f]*)$'

Maybe that's why the second '..)*$' was there originally for?
And adding it back there fixes pwm but allows pwm-1-2-3..

> (or maybe better "^pwm(@.+|-[0-9a-f]+)$" ?)

And this too fails for just pwm node name.

Regards,

Tony



More information about the linux-arm-kernel mailing list