linux-renesas-soc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Simon Horman <horms@verge.net.au>
To: Rob Herring <robh+dt@kernel.org>
Cc: Mark Rutland <mark.rutland@arm.com>,
	Geert Uytterhoeven <geert+renesas@glider.be>,
	Magnus Damm <magnus.damm@gmail.com>,
	Yoshihiro Kaneko <ykaneko0929@gmail.com>,
	devicetree@vger.kernel.org,
	"open list:MEDIA DRIVERS FOR RENESAS - FCP" 
	<linux-renesas-soc@vger.kernel.org>
Subject: Re: [PATCH 1/2] dt-bindings: bus: simple-pm-bus: convert bindings to json-schema
Date: Mon, 23 Sep 2019 13:53:28 +0200	[thread overview]
Message-ID: <20190923115328.lpb5qeu6poacrb6y@verge.net.au> (raw)
In-Reply-To: <CAL_Jsq+y5o-jBX9emVpW+q7n+Tde2ON0TqHmm9gFj7emUURL7Q@mail.gmail.com>

On Thu, Sep 19, 2019 at 02:33:58PM -0500, Rob Herring wrote:
> On Thu, Sep 19, 2019 at 10:10 AM Simon Horman <horms@verge.net.au> wrote:
> >
> > On Tue, Sep 17, 2019 at 07:12:16AM -0500, Rob Herring wrote:
> > > On Mon, Sep 16, 2019 at 10:35 AM Simon Horman
> > > <horms+renesas@verge.net.au> wrote:

...

> > > > +
> > > > +  power-domains:
> > > > +    # Required if clocks is absent, optional otherwise
> > > > +    minItems: 1
> > > > +
> > > > +required:
> > > > +  - compatible
> > > > +  - '#address-cells'
> > > > +  - '#size-cells'
> > > > +  - ranges
> > >
> > > This will capture what you commented above:
> > >
> > > oneOf:
> > >   - required:
> > >       - clocks
> > >   - required:
> > >       - power-domains
> >
> > Thanks. Unfortunately dtbs_check does not seem happy
> > if both clocks and power-domains are present.
> 
> I was thinking it was either or. Use 'anyOf' instead.

Thanks, perhaps the tooling needs updating to handle this.

I now have:

required:
  - compatible
  - '#address-cells'
  - '#size-cells'
  - ranges

anyOf:
  - required:
      - clocks
  - required:
      - power-domains

And see:

# cr make dtbs_check DT_SCHEMA_FILES=Documentation/devicetree/bindings/bus/simple-pm-bus.yaml
...

Traceback (most recent call last):
  File "/usr/local/lib/python3.7/dist-packages/dtschema/lib.py", line 429, in process_schema
    DTValidator.check_schema(schema)
  File "/usr/local/lib/python3.7/dist-packages/dtschema/lib.py", line 575, in check_schema
    raise jsonschema.SchemaError.create_from(error)
jsonschema.exceptions.SchemaError: Additional properties are not allowed ('anyOf' was unexpected)

Failed validating 'additionalProperties' in metaschema['allOf'][0]:
    {'$id': 'http://devicetree.org/meta-schemas/base.yaml#',
     '$schema': 'http://json-schema.org/draft-07/schema#',
     'additionalProperties': False,
     'allOf': [{'$ref': 'http://json-schema.org/draft-07/schema#'}],
     'description': 'Metaschema for devicetree binding documentation',
     'properties': {'$id': {'pattern': 'http://devicetree.org/schemas/.*\\.yaml#'},
                    '$schema': {'enum': ['http://devicetree.org/meta-schemas/core.yaml#',
                                         'http://devicetree.org/meta-schemas/base.yaml#']},
                    'additionalProperties': {'type': 'boolean'},
                    'allOf': {'items': {'propertyNames': {'enum': ['$ref',
                                                                   'if',
                                                                   'then',
                                                                   'else']}}},
                    'definitions': True,
                    'dependencies': True,
                    'description': True,
                    'else': True,
                    'examples': {'items': {'type': 'string'},
                                 'type': 'array'},
                    'if': True,
                    'maintainers': {'items': {'format': 'email',
                                              'type': 'string'},
                                    'type': 'array'},
                    'oneOf': True,
                    'patternProperties': True,
                    'properties': True,
                    'required': True,
                    'select': {'allOf': [{'$ref': 'http://json-schema.org/draft-07/schema#'},
                                         {'oneOf': [{'properties': {'properties': True,
                                                                    'required': True},
                                                     'type': 'object'},
                                                    {'type': 'boolean'}]}]},
                    'then': True,
                    'title': {'maxLength': 100},
                    'unevaluatedProperties': {'type': 'boolean'}},
     'required': ['$id', '$schema', 'title', 'maintainers']}

On schema:
    {'$id': 'http://devicetree.org/schemas/bus/simple-pm-bus.yaml#',
     '$schema': 'http://devicetree.org/meta-schemas/core.yaml#',
     'anyOf': [{'required': ['clocks']}, {'required': ['power-domains']}],
     'description': 'A Simple Power-Managed Bus is a transparent bus that '
                    "doesn't need a real\n"
                    "driver, as it's typically initialized by the boot "
                    'loader.\n'
                    '\n'
                    'However, its bus controller is part of a PM domain, '
                    'or under the control\n'
                    "of a functional clock.  Hence, the bus controller's "
                    'PM domain and/or\n'
                    'clock must be enabled for child devices connected to '
                    'the bus (either\n'
                    'on-SoC or externally) to function.\n'
                    '\n'
                    'While "simple-pm-bus" follows the "simple-bus" set of '
                    'properties, as\n'
                    'specified in the Devicetree Specification, it is not '
                    'an extension of\n'
                    '"simple-bus".\n',
     'examples': ['#include <dt-bindings/clock/qcom,gcc-msm8996.h>\n'
                  '#include <dt-bindings/interrupt-controller/irq.h>\n'
                  '\n'
                  'bus@0 {\n'
                  '    power-domains = <&gcc AGGRE0_NOC_GDSC>;\n'
                  '    compatible = "simple-pm-bus";\n'
                  '    #address-cells = <1>;\n'
                  '    #size-cells = <1>;\n'
                  '    ranges;\n'
                  '};\n'],
     'maintainers': ['Geert Uytterhoeven <geert+renesas@glider.be>'],
     'properties': {'#address-cells': {'const': 1},
                    '#size-cells': {'enum': [1, 2]},
                    '$nodename': {'pattern': '^bus@[0-9a-f]+$'},
                    'clocks': True,
                    'compatible': {'contains': {'const': 'simple-pm-bus'},
                                   'description': 'Shall contain '
                                                  '"simple-pm-bus" in '
                                                  'addition to a optional '
                                                  'bus-specific compatible '
                                                  'strings defined in '
                                                  'individual pm-bus '
                                                  'bindings.'},
                    'power-domains': {'minItems': 1},
                    'ranges': True},
     'required': ['compatible', '#address-cells', '#size-cells', 'ranges'],
     'title': 'Simple Power-Managed Bus'}

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/bin/dt-mk-schema", line 32, in <module>
    schemas = dtschema.process_schemas(args.schemas, core_schema=(not args.useronly))
  File "/usr/local/lib/python3.7/dist-packages/dtschema/lib.py", line 470, in process_schemas
    sch = process_schema(os.path.abspath(filename))
  File "/usr/local/lib/python3.7/dist-packages/dtschema/lib.py", line 431, in process_schema
    print(filename + ": ignoring, error in schema '%s'" % exc.path[-1])
IndexError: deque index out of range

  reply	other threads:[~2019-09-23 11:53 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-16 15:33 [PATCH 0/2] dt-bindings: bus: simple-pm-bus, renesas-bsc: convert bindings to json-schema Simon Horman
2019-09-16 15:33 ` [PATCH 1/2] dt-bindings: bus: simple-pm-bus: " Simon Horman
2019-09-17 10:43   ` Ulrich Hecht
2019-09-17 11:29   ` Simon Horman
2019-09-17 12:48     ` Rob Herring
2019-09-19 14:59       ` Simon Horman
2019-09-17 12:12   ` Rob Herring
2019-09-17 12:44     ` Geert Uytterhoeven
2019-09-19 15:10     ` Simon Horman
2019-09-19 19:33       ` Rob Herring
2019-09-23 11:53         ` Simon Horman [this message]
2019-09-23 12:40           ` Rob Herring
2019-09-24  9:22             ` Simon Horman
2019-09-16 15:33 ` [PATCH 2/2] dt-bindings: bus: renesas-bsc: " Simon Horman
2019-09-17 10:43   ` Ulrich Hecht
2019-09-17 11:08     ` Simon Horman
2019-09-17 12:41       ` Rob Herring
2019-09-17 11:09   ` Simon Horman
2019-09-17 11:12     ` Simon Horman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190923115328.lpb5qeu6poacrb6y@verge.net.au \
    --to=horms@verge.net.au \
    --cc=devicetree@vger.kernel.org \
    --cc=geert+renesas@glider.be \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=magnus.damm@gmail.com \
    --cc=mark.rutland@arm.com \
    --cc=robh+dt@kernel.org \
    --cc=ykaneko0929@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).