[PATCH dt-schema] schemas: gpio: gpio-consumer: Fix false positives on nodes named gpio

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Just like for "gpio", nodes can be named "gpios" or
"<something>-gpio(s)", causing false positive failures.

See also commit 80120fccde170902 ("schemas: gpio: fix false positive
failures on nodes named 'gpio'").

Signed-off-by: Geert Uytterhoeven <geert+renesas@xxxxxxxxx>
---
Seen on Linux, e.g.:

    arch/arm/boot/dts/renesas/r8a7779-marzen.dtb: /: keyboard-gpio: {'compatible': ['gpio-keys-polled'], 'poll-interval': [[50]], 'pinctrl-0': [[29]], 'pinctrl-names': ['default'], 'key-3': {'gpios': [[28, 19, 1]], 'linux,code': [[4]], 'label': ['SW1-3'], 'debounce-interval': [[20]]}, 'key-4': {'gpios': [[28, 20, 1]], 'linux,code': [[5]], 'label': ['SW1-4'], 'debounce-interval': [[20]]}} is not of type 'array'
	    from schema $id: http://devicetree.org/schemas/gpio/gpio-consumer.yaml#
    arch/arm/boot/dts/renesas/r8a7779-marzen.dtb: pinctrl@fffc0000: keyboard-gpio: {'pins': ['GP_0_19', 'GP_0_20'], 'bias-pull-up': True, 'phandle': [[29]]} is not of type 'array'
	    from schema $id: http://devicetree.org/schemas/gpio/gpio-consumer.yaml#

    arch/arm/boot/dts/microchip/at91-kizbox3-hs.dtb: /: gpios: {'compatible': ['gpio'], 'status': ['okay'], 'rf_on': {'label': ['rf on'], 'gpio': [[38, 83, 0]], 'output': True, 'init-low': True}, 'wifi_on': {'label': ['wifi on'], 'gpio': [[38, 84, 0]], 'output': True, 'init-low': True}, 'zbe_test_radio': {'label': ['zbe test radio'], 'gpio': [[38, 53, 0]], 'output': True, 'init-low': True}, 'zbe_rst': {'label': ['zbe rst'], 'gpio': [[38, 57, 0]], 'output': True, 'init-low': True}, 'io_reset': {'label': ['io reset'], 'gpio': [[38, 62, 0]], 'output': True, 'init-low': True}, 'io_test_radio': {'label': ['io test radio'], 'gpio': [[38, 73, 0]], 'output': True, 'init-low': True}, 'io_boot_0': {'label': ['io boot 0'], 'gpio': [[38, 75, 0]], 'output': True, 'init-low': True}, 'io_boot_1': {'label': ['io boot 1'], 'gpio': [[38, 81, 0]], 'output': True, 'init-low': True}, 'verbose_bootloader': {'label': ['verbose bootloader'], 'gpio': [[38, 43, 0]], 'input': True}, 'nail_bed_detection': {'label': ['nail bed detection'], 'gpio': [[38, 44, 0]], 'input': True}, 'id_usba': {'label': ['id usba'], 'gpio': [[38, 64, 1]], 'input': True}} is not of type 'array'
	    from schema $id: http://devicetree.org/schemas/gpio/gpio-consumer.yaml#

For marzen, the alternative fix would be to
s/keyboard-gpio/keyboard-polled/g.
---
 dtschema/schemas/gpio/gpio-consumer.yaml | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/dtschema/schemas/gpio/gpio-consumer.yaml b/dtschema/schemas/gpio/gpio-consumer.yaml
index 1ac35244de7317bc..9572a9cd0febef19 100644
--- a/dtschema/schemas/gpio/gpio-consumer.yaml
+++ b/dtschema/schemas/gpio/gpio-consumer.yaml
@@ -17,7 +17,10 @@ select:
 
 properties:
   gpios:
-    $ref: /schemas/types.yaml#/definitions/phandle-array
+    # 'gpios' can appear as a property or node name
+    oneOf:
+      - type: object
+      - $ref: /schemas/types.yaml#/definitions/phandle-array
 
   gpio:
     # 'gpio' can appear as a property or node name
@@ -28,6 +31,9 @@ properties:
 
 patternProperties:
   "(?<!,nr)-gpios?$":
-    $ref: /schemas/types.yaml#/definitions/phandle-array
+    # these can appear as properties or node names
+    oneOf:
+      - type: object
+      - $ref: /schemas/types.yaml#/definitions/phandle-array
 
 additionalProperties: true
-- 
2.34.1





[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]


  Powered by Linux