Message ID | 20201111090853.14112-2-Sergey.Semin@baikalelectronics.ru (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | dt-bindings: usb: Add generic USB HCD, xHCI, DWC USB3 DT schema | expand |
On Wed, 11 Nov 2020 12:08:36 +0300, Serge Semin wrote: > There can be three distinctive types of the USB controllers: USB hosts, > USB peripherals/gadgets and USB OTG, which can switch from one role to > another. In order to have that hierarchy handled in the DT binding files, > we need to collect common properties in a common DT schema and specific > properties in dedicated schemas. Seeing the usb-hcd.yaml DT schema is > dedicated for the USB host controllers only, let's move some common > properties from there into the usb.yaml schema. So the later would be > available to evaluate all currently supported types of the USB > controllers. > > While at it add an explicit "additionalProperties: true" into the > usb-hcd.yaml as setting the additionalProperties/unevaluateProperties > properties is going to be get mandatory soon. > > Signed-off-by: Serge Semin <Sergey.Semin@baikalelectronics.ru> > > --- > > Changelog v4: > - This is a new patch created as a result of the comment left > by Chunfeng Yun in v3 > --- > .../devicetree/bindings/usb/usb-hcd.yaml | 14 ++------- > .../devicetree/bindings/usb/usb.yaml | 29 +++++++++++++++++++ > 2 files changed, 32 insertions(+), 11 deletions(-) > create mode 100644 Documentation/devicetree/bindings/usb/usb.yaml > My bot found errors running 'make dt_binding_check' on your patch: yamllint warnings/errors: ./Documentation/devicetree/bindings/usb/usb-hcd.yaml:17:1: [error] duplication of key "additionalProperties" in mapping (key-duplicates) dtschema/dtc warnings/errors: Traceback (most recent call last): File "/usr/local/bin/dt-extract-example", line 45, in <module> binding = yaml.load(open(args.yamlfile, encoding='utf-8').read()) File "/usr/local/lib/python3.8/dist-packages/ruamel/yaml/main.py", line 343, in load return constructor.get_single_data() File "/usr/local/lib/python3.8/dist-packages/ruamel/yaml/constructor.py", line 113, in get_single_data return self.construct_document(node) File "/usr/local/lib/python3.8/dist-packages/ruamel/yaml/constructor.py", line 123, in construct_document for _dummy in generator: File "/usr/local/lib/python3.8/dist-packages/ruamel/yaml/constructor.py", line 723, in construct_yaml_map value = self.construct_mapping(node) File "/usr/local/lib/python3.8/dist-packages/ruamel/yaml/constructor.py", line 440, in construct_mapping return BaseConstructor.construct_mapping(self, node, deep=deep) File "/usr/local/lib/python3.8/dist-packages/ruamel/yaml/constructor.py", line 257, in construct_mapping if self.check_mapping_key(node, key_node, mapping, key, value): File "/usr/local/lib/python3.8/dist-packages/ruamel/yaml/constructor.py", line 295, in check_mapping_key raise DuplicateKeyError(*args) ruamel.yaml.constructor.DuplicateKeyError: while constructing a mapping in "<unicode string>", line 4, column 1 found duplicate key "additionalProperties" with value "True" (original value: "True") in "<unicode string>", line 17, column 1 To suppress this check see: http://yaml.readthedocs.io/en/latest/api.html#duplicate-keys Duplicate keys will become an error in future releases, and are errors by default when using the new API. make[1]: *** [Documentation/devicetree/bindings/Makefile:20: Documentation/devicetree/bindings/usb/usb-hcd.example.dts] Error 1 make[1]: *** Deleting file 'Documentation/devicetree/bindings/usb/usb-hcd.example.dts' make[1]: *** Waiting for unfinished jobs.... make[1]: *** [Documentation/devicetree/bindings/Makefile:59: Documentation/devicetree/bindings/processed-schema-examples.json] Error 123 make: *** [Makefile:1364: dt_binding_check] Error 2 See https://patchwork.ozlabs.org/patch/1398034 The base for the patch is generally the last rc1. Any dependencies should be noted. If you already ran 'make dt_binding_check' and didn't see the above error(s), then make sure 'yamllint' is installed and dt-schema is up to date: pip3 install dtschema --upgrade Please check and re-submit.
On Wed, Nov 11, 2020 at 01:16:40PM -0600, Rob Herring wrote: > On Wed, 11 Nov 2020 12:08:36 +0300, Serge Semin wrote: > > There can be three distinctive types of the USB controllers: USB hosts, > > USB peripherals/gadgets and USB OTG, which can switch from one role to > > another. In order to have that hierarchy handled in the DT binding files, > > we need to collect common properties in a common DT schema and specific > > properties in dedicated schemas. Seeing the usb-hcd.yaml DT schema is > > dedicated for the USB host controllers only, let's move some common > > properties from there into the usb.yaml schema. So the later would be > > available to evaluate all currently supported types of the USB > > controllers. > > > > While at it add an explicit "additionalProperties: true" into the > > usb-hcd.yaml as setting the additionalProperties/unevaluateProperties > > properties is going to be get mandatory soon. > > > > Signed-off-by: Serge Semin <Sergey.Semin@baikalelectronics.ru> > > > > --- > > > > Changelog v4: > > - This is a new patch created as a result of the comment left > > by Chunfeng Yun in v3 > > --- > > .../devicetree/bindings/usb/usb-hcd.yaml | 14 ++------- > > .../devicetree/bindings/usb/usb.yaml | 29 +++++++++++++++++++ > > 2 files changed, 32 insertions(+), 11 deletions(-) > > create mode 100644 Documentation/devicetree/bindings/usb/usb.yaml > > > > > My bot found errors running 'make dt_binding_check' on your patch: > > yamllint warnings/errors: > ./Documentation/devicetree/bindings/usb/usb-hcd.yaml:17:1: [error] duplication of key "additionalProperties" in mapping (key-duplicates) Oh my. Don't know how this has slipped in. It's even more weird given that I've performed dt_binding_check before sending the patches out. Anyway I'll fix the duplication in v5. Please proceed with the series review. -Sergey > > dtschema/dtc warnings/errors: > Traceback (most recent call last): > File "/usr/local/bin/dt-extract-example", line 45, in <module> > binding = yaml.load(open(args.yamlfile, encoding='utf-8').read()) > File "/usr/local/lib/python3.8/dist-packages/ruamel/yaml/main.py", line 343, in load > return constructor.get_single_data() > File "/usr/local/lib/python3.8/dist-packages/ruamel/yaml/constructor.py", line 113, in get_single_data > return self.construct_document(node) > File "/usr/local/lib/python3.8/dist-packages/ruamel/yaml/constructor.py", line 123, in construct_document > for _dummy in generator: > File "/usr/local/lib/python3.8/dist-packages/ruamel/yaml/constructor.py", line 723, in construct_yaml_map > value = self.construct_mapping(node) > File "/usr/local/lib/python3.8/dist-packages/ruamel/yaml/constructor.py", line 440, in construct_mapping > return BaseConstructor.construct_mapping(self, node, deep=deep) > File "/usr/local/lib/python3.8/dist-packages/ruamel/yaml/constructor.py", line 257, in construct_mapping > if self.check_mapping_key(node, key_node, mapping, key, value): > File "/usr/local/lib/python3.8/dist-packages/ruamel/yaml/constructor.py", line 295, in check_mapping_key > raise DuplicateKeyError(*args) > ruamel.yaml.constructor.DuplicateKeyError: while constructing a mapping > in "<unicode string>", line 4, column 1 > found duplicate key "additionalProperties" with value "True" (original value: "True") > in "<unicode string>", line 17, column 1 > > To suppress this check see: > http://yaml.readthedocs.io/en/latest/api.html#duplicate-keys > > Duplicate keys will become an error in future releases, and are errors > by default when using the new API. > > make[1]: *** [Documentation/devicetree/bindings/Makefile:20: Documentation/devicetree/bindings/usb/usb-hcd.example.dts] Error 1 > make[1]: *** Deleting file 'Documentation/devicetree/bindings/usb/usb-hcd.example.dts' > make[1]: *** Waiting for unfinished jobs.... > make[1]: *** [Documentation/devicetree/bindings/Makefile:59: Documentation/devicetree/bindings/processed-schema-examples.json] Error 123 > make: *** [Makefile:1364: dt_binding_check] Error 2 > > > See https://patchwork.ozlabs.org/patch/1398034 > > The base for the patch is generally the last rc1. Any dependencies > should be noted. > > If you already ran 'make dt_binding_check' and didn't see the above > error(s), then make sure 'yamllint' is installed and dt-schema is up to > date: > > pip3 install dtschema --upgrade > > Please check and re-submit. >
On Wed, 2020-11-11 at 12:08 +0300, Serge Semin wrote: > There can be three distinctive types of the USB controllers: USB hosts, > USB peripherals/gadgets and USB OTG, which can switch from one role to > another. In order to have that hierarchy handled in the DT binding files, > we need to collect common properties in a common DT schema and specific > properties in dedicated schemas. Seeing the usb-hcd.yaml DT schema is > dedicated for the USB host controllers only, let's move some common > properties from there into the usb.yaml schema. So the later would be > available to evaluate all currently supported types of the USB > controllers. > > While at it add an explicit "additionalProperties: true" into the > usb-hcd.yaml as setting the additionalProperties/unevaluateProperties > properties is going to be get mandatory soon. > > Signed-off-by: Serge Semin <Sergey.Semin@baikalelectronics.ru> > > --- > > Changelog v4: > - This is a new patch created as a result of the comment left > by Chunfeng Yun in v3 > --- > .../devicetree/bindings/usb/usb-hcd.yaml | 14 ++------- > .../devicetree/bindings/usb/usb.yaml | 29 +++++++++++++++++++ > 2 files changed, 32 insertions(+), 11 deletions(-) > create mode 100644 Documentation/devicetree/bindings/usb/usb.yaml > > diff --git a/Documentation/devicetree/bindings/usb/usb-hcd.yaml b/Documentation/devicetree/bindings/usb/usb-hcd.yaml > index 7263b7f2b510..81f3ad1419d8 100644 > --- a/Documentation/devicetree/bindings/usb/usb-hcd.yaml > +++ b/Documentation/devicetree/bindings/usb/usb-hcd.yaml > @@ -9,18 +9,10 @@ title: Generic USB Host Controller Device Tree Bindings > maintainers: > - Greg Kroah-Hartman <gregkh@linuxfoundation.org> > > -properties: > - $nodename: > - pattern: "^usb(@.*)?" > +allOf: > + - $ref: usb.yaml# > > - phys: > - $ref: /schemas/types.yaml#/definitions/phandle-array > - description: > - List of all the USB PHYs on this HCD > - > - phy-names: > - description: > - Name specifier for the USB PHY > +additionalProperties: true This seems already added by the applied patch 6a0e321ea735 "dt-bindings: Explicitly allow additional properties in common schemas" > > examples: > - | > diff --git a/Documentation/devicetree/bindings/usb/usb.yaml b/Documentation/devicetree/bindings/usb/usb.yaml > new file mode 100644 > index 000000000000..941ad59fbac5 > --- /dev/null > +++ b/Documentation/devicetree/bindings/usb/usb.yaml > @@ -0,0 +1,29 @@ > +# SPDX-License-Identifier: GPL-2.0 > +%YAML 1.2 > +--- > +$id: http://devicetree.org/schemas/usb/usb.yaml# > +$schema: http://devicetree.org/meta-schemas/core.yaml# > + > +title: Generic USB Controller Device Tree Bindings > + > +maintainers: > + - Greg Kroah-Hartman <gregkh@linuxfoundation.org> > + > +select: false > + > +properties: > + $nodename: > + pattern: "^usb(@.*)?" > + > + phys: > + $ref: /schemas/types.yaml#/definitions/phandle-array > + description: > + List of all the USB PHYs on this HCD > + > + phy-names: > + description: > + Name specifier for the USB PHY > + > +additionalProperties: true > + > +...
diff --git a/Documentation/devicetree/bindings/usb/usb-hcd.yaml b/Documentation/devicetree/bindings/usb/usb-hcd.yaml index 7263b7f2b510..81f3ad1419d8 100644 --- a/Documentation/devicetree/bindings/usb/usb-hcd.yaml +++ b/Documentation/devicetree/bindings/usb/usb-hcd.yaml @@ -9,18 +9,10 @@ title: Generic USB Host Controller Device Tree Bindings maintainers: - Greg Kroah-Hartman <gregkh@linuxfoundation.org> -properties: - $nodename: - pattern: "^usb(@.*)?" +allOf: + - $ref: usb.yaml# - phys: - $ref: /schemas/types.yaml#/definitions/phandle-array - description: - List of all the USB PHYs on this HCD - - phy-names: - description: - Name specifier for the USB PHY +additionalProperties: true examples: - | diff --git a/Documentation/devicetree/bindings/usb/usb.yaml b/Documentation/devicetree/bindings/usb/usb.yaml new file mode 100644 index 000000000000..941ad59fbac5 --- /dev/null +++ b/Documentation/devicetree/bindings/usb/usb.yaml @@ -0,0 +1,29 @@ +# SPDX-License-Identifier: GPL-2.0 +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/usb/usb.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Generic USB Controller Device Tree Bindings + +maintainers: + - Greg Kroah-Hartman <gregkh@linuxfoundation.org> + +select: false + +properties: + $nodename: + pattern: "^usb(@.*)?" + + phys: + $ref: /schemas/types.yaml#/definitions/phandle-array + description: + List of all the USB PHYs on this HCD + + phy-names: + description: + Name specifier for the USB PHY + +additionalProperties: true + +...
There can be three distinctive types of the USB controllers: USB hosts, USB peripherals/gadgets and USB OTG, which can switch from one role to another. In order to have that hierarchy handled in the DT binding files, we need to collect common properties in a common DT schema and specific properties in dedicated schemas. Seeing the usb-hcd.yaml DT schema is dedicated for the USB host controllers only, let's move some common properties from there into the usb.yaml schema. So the later would be available to evaluate all currently supported types of the USB controllers. While at it add an explicit "additionalProperties: true" into the usb-hcd.yaml as setting the additionalProperties/unevaluateProperties properties is going to be get mandatory soon. Signed-off-by: Serge Semin <Sergey.Semin@baikalelectronics.ru> --- Changelog v4: - This is a new patch created as a result of the comment left by Chunfeng Yun in v3 --- .../devicetree/bindings/usb/usb-hcd.yaml | 14 ++------- .../devicetree/bindings/usb/usb.yaml | 29 +++++++++++++++++++ 2 files changed, 32 insertions(+), 11 deletions(-) create mode 100644 Documentation/devicetree/bindings/usb/usb.yaml