All of lore.kernel.org
 help / color / mirror / Atom feed
From: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
To: Arnd Bergmann <arnd@arndb.de>, Olof Johansson <olof@lixom.net>,
	arm@kernel.org, soc@kernel.org,
	Dmitry Torokhov <dmitry.torokhov@gmail.com>,
	Rob Herring <robh+dt@kernel.org>,
	Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>,
	linux-input@vger.kernel.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org
Cc: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Subject: [PATCH v2 01/48] dt-bindings: input: gpio-keys: enforce node names to match all properties
Date: Thu,  9 Jun 2022 13:38:43 +0200	[thread overview]
Message-ID: <20220609113843.380260-1-krzysztof.kozlowski@linaro.org> (raw)
In-Reply-To: <20220609113721.379932-1-krzysztof.kozlowski@linaro.org>

The gpio-keys DT schema matches all properties with a wide pattern and
applies specific schema to children.  This has drawback - all regular
properties are also matched and are silently ignored, even if they are
not described in schema.  Basically this allows any non-object property
to be present.

Enforce specific naming pattern for children (keys) to narrow the
pattern thus do not match other properties.  This will require all
children to be named with 'key-' prefix or '-key' suffix.

Removal of "if:" within patternProperties causes drop of one indentation
level, but there are no other changes in the affected block.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
---
 .../devicetree/bindings/input/gpio-keys.yaml  | 157 +++++++++---------
 1 file changed, 77 insertions(+), 80 deletions(-)

diff --git a/Documentation/devicetree/bindings/input/gpio-keys.yaml b/Documentation/devicetree/bindings/input/gpio-keys.yaml
index 645dfa1e0d07..27bb5c6ab8d9 100644
--- a/Documentation/devicetree/bindings/input/gpio-keys.yaml
+++ b/Documentation/devicetree/bindings/input/gpio-keys.yaml
@@ -16,86 +16,83 @@ properties:
       - gpio-keys-polled
 
 patternProperties:
-  ".*":
-    if:
-      type: object
-    then:
-      $ref: input.yaml#
-
-      properties:
-        gpios:
-          maxItems: 1
-
-        interrupts:
-          maxItems: 1
-
-        label:
-          description: Descriptive name of the key.
-
-        linux,code:
-          description: Key / Axis code to emit.
-
-        linux,input-type:
-          default: 1  # EV_KEY
-
-        linux,input-value:
-          description: |
-            If linux,input-type is EV_ABS or EV_REL then this
-            value is sent for events this button generates when pressed.
-            EV_ABS/EV_REL axis will generate an event with a value of 0
-            when all buttons with linux,input-type == type and
-            linux,code == axis are released. This value is interpreted
-            as a signed 32 bit value, e.g. to make a button generate a
-            value of -1 use:
-
-            linux,input-value = <0xffffffff>; /* -1 */
-
-          $ref: /schemas/types.yaml#/definitions/uint32
-
-        debounce-interval:
-          description:
-            Debouncing interval time in milliseconds. If not specified defaults to 5.
-          $ref: /schemas/types.yaml#/definitions/uint32
-
-          default: 5
-
-        wakeup-source:
-          description: Button can wake-up the system.
-
-        wakeup-event-action:
-          description: |
-            Specifies whether the key should wake the system when asserted, when
-            deasserted, or both. This property is only valid for keys that wake up the
-            system (e.g., when the "wakeup-source" property is also provided).
-
-            Supported values are defined in linux-event-codes.h:
-
-              EV_ACT_ANY        - both asserted and deasserted
-              EV_ACT_ASSERTED   - asserted
-              EV_ACT_DEASSERTED - deasserted
-          $ref: /schemas/types.yaml#/definitions/uint32
-          enum: [0, 1, 2]
-
-        linux,can-disable:
-          description:
-            Indicates that button is connected to dedicated (not shared) interrupt
-            which can be disabled to suppress events from the button.
-          type: boolean
-
-      required:
-        - linux,code
-
-      anyOf:
-        - required:
-            - interrupts
-        - required:
-            - gpios
-
-      dependencies:
-        wakeup-event-action: [ wakeup-source ]
-        linux,input-value: [ gpios ]
-
-      unevaluatedProperties: false
+  "^(button|event|key|switch|(button|event|key|switch)-[a-z0-9-]+|[a-z0-9-]+-(button|event|key|switch))$":
+    $ref: input.yaml#
+
+    properties:
+      gpios:
+        maxItems: 1
+
+      interrupts:
+        maxItems: 1
+
+      label:
+        description: Descriptive name of the key.
+
+      linux,code:
+        description: Key / Axis code to emit.
+
+      linux,input-type:
+        default: 1  # EV_KEY
+
+      linux,input-value:
+        description: |
+          If linux,input-type is EV_ABS or EV_REL then this
+          value is sent for events this button generates when pressed.
+          EV_ABS/EV_REL axis will generate an event with a value of 0
+          when all buttons with linux,input-type == type and
+          linux,code == axis are released. This value is interpreted
+          as a signed 32 bit value, e.g. to make a button generate a
+          value of -1 use:
+
+          linux,input-value = <0xffffffff>; /* -1 */
+
+        $ref: /schemas/types.yaml#/definitions/uint32
+
+      debounce-interval:
+        description:
+          Debouncing interval time in milliseconds. If not specified defaults to 5.
+        $ref: /schemas/types.yaml#/definitions/uint32
+
+        default: 5
+
+      wakeup-source:
+        description: Button can wake-up the system.
+
+      wakeup-event-action:
+        description: |
+          Specifies whether the key should wake the system when asserted, when
+          deasserted, or both. This property is only valid for keys that wake up the
+          system (e.g., when the "wakeup-source" property is also provided).
+
+          Supported values are defined in linux-event-codes.h:
+
+            EV_ACT_ANY        - both asserted and deasserted
+            EV_ACT_ASSERTED   - asserted
+            EV_ACT_DEASSERTED - deasserted
+        $ref: /schemas/types.yaml#/definitions/uint32
+        enum: [0, 1, 2]
+
+      linux,can-disable:
+        description:
+          Indicates that button is connected to dedicated (not shared) interrupt
+          which can be disabled to suppress events from the button.
+        type: boolean
+
+    required:
+      - linux,code
+
+    anyOf:
+      - required:
+          - interrupts
+      - required:
+          - gpios
+
+    dependencies:
+      wakeup-event-action: [ wakeup-source ]
+      linux,input-value: [ gpios ]
+
+    unevaluatedProperties: false
 
 if:
   properties:
-- 
2.34.1


  reply	other threads:[~2022-06-09 11:39 UTC|newest]

Thread overview: 159+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-09 11:37 [PATCH v2 00/48] dt-bindings: input: gpio-keys: rework matching children Krzysztof Kozlowski
2022-06-09 11:37 ` Krzysztof Kozlowski
2022-06-09 11:37 ` Krzysztof Kozlowski
2022-06-09 11:37 ` Krzysztof Kozlowski
2022-06-09 11:37 ` Krzysztof Kozlowski
2022-06-09 11:38 ` Krzysztof Kozlowski [this message]
2022-06-09 15:17   ` [PATCH v2 01/48] dt-bindings: input: gpio-keys: enforce node names to match all properties Rob Herring
2022-06-09 11:39 ` [PATCH v2 02/48] dt-bindings: input: gpio-keys: reference input.yaml and document properties Krzysztof Kozlowski
2022-06-09 15:18   ` Rob Herring
2022-06-09 11:39 ` [PATCH v2 03/48] dt-bindings: input: gpio-keys: accept also interrupt-extended Krzysztof Kozlowski
2022-06-09 15:21   ` Rob Herring
2022-06-09 11:39 ` [PATCH v2 04/48] dt-bindings: pinctrl: nuvoton,wpcm450-pinctrl: align key node name Krzysztof Kozlowski
2022-06-09 15:20   ` Jonathan Neuschäfer
2022-06-09 15:20     ` Jonathan Neuschäfer
2022-06-09 15:31     ` Krzysztof Kozlowski
2022-06-09 15:31       ` Krzysztof Kozlowski
2022-06-09 11:39 ` [PATCH v2 05/48] arm64: dts: allwinner: align gpio-key node names with dtschema Krzysztof Kozlowski
2022-06-09 11:39   ` Krzysztof Kozlowski
2022-06-13 21:00   ` Jernej Škrabec
2022-06-13 21:00     ` Jernej Škrabec
2022-06-14 20:29     ` Jernej Škrabec
2022-06-14 20:29       ` Jernej Škrabec
2022-06-09 11:39 ` [PATCH v2 06/48] ARM: " Krzysztof Kozlowski
2022-06-09 11:39   ` Krzysztof Kozlowski
2022-06-13 21:02   ` Jernej Škrabec
2022-06-13 21:02     ` Jernej Škrabec
2022-06-14 20:29     ` Jernej Škrabec
2022-06-14 20:29       ` Jernej Škrabec
2022-06-09 11:39 ` [PATCH v2 07/48] arm64: dts: amlogic: correct gpio-keys properties Krzysztof Kozlowski
2022-06-09 11:39   ` Krzysztof Kozlowski
2022-06-09 11:39   ` Krzysztof Kozlowski
2022-06-09 20:03   ` Martin Blumenstingl
2022-06-09 20:03     ` Martin Blumenstingl
2022-06-09 20:03     ` Martin Blumenstingl
2022-06-09 11:39 ` [PATCH v2 08/48] arm64: dts: amlogic: align gpio-key node names with dtschema Krzysztof Kozlowski
2022-06-09 11:39   ` Krzysztof Kozlowski
2022-06-09 11:39   ` Krzysztof Kozlowski
2022-06-09 20:04   ` Martin Blumenstingl
2022-06-09 20:04     ` Martin Blumenstingl
2022-06-09 20:04     ` Martin Blumenstingl
2022-06-09 11:39 ` [PATCH v2 09/48] arm64: dts: apm: correct gpio-keys properties Krzysztof Kozlowski
2022-06-09 11:39 ` [PATCH v2 10/48] arm64: dts: broadcom: align gpio-key node names with dtschema Krzysztof Kozlowski
2022-06-09 11:39 ` [PATCH v2 11/48] ARM: " Krzysztof Kozlowski
2022-06-09 11:39   ` Krzysztof Kozlowski
2022-06-13 17:54   ` Florian Fainelli
2022-06-13 17:54     ` Florian Fainelli
2022-06-09 11:39 ` [PATCH v2 12/48] ARM: dts: broadcom: correct gpio-keys properties Krzysztof Kozlowski
2022-06-09 11:39   ` Krzysztof Kozlowski
2022-06-13 17:55   ` Florian Fainelli
2022-06-13 17:55     ` Florian Fainelli
2022-06-09 11:39 ` [PATCH v2 13/48] arm64: dts: freescale: align gpio-key node names with dtschema Krzysztof Kozlowski
2022-06-09 11:39   ` Krzysztof Kozlowski
2022-06-19  8:10   ` Shawn Guo
2022-06-19  8:10     ` Shawn Guo
2022-06-09 11:39 ` [PATCH v2 14/48] arm64: dts: freescale: align led " Krzysztof Kozlowski
2022-06-09 11:39   ` Krzysztof Kozlowski
2022-06-19  8:12   ` Shawn Guo
2022-06-19  8:12     ` Shawn Guo
2022-06-09 11:39 ` [PATCH v2 15/48] arm64: dts: hisilicon: align gpio-key " Krzysztof Kozlowski
2022-06-09 11:39   ` Krzysztof Kozlowski
2022-06-09 11:39 ` [PATCH v2 16/48] arm64: dts: hisilicon: correct gpio-keys properties Krzysztof Kozlowski
2022-06-09 11:39   ` Krzysztof Kozlowski
2022-06-09 11:39 ` [PATCH v2 17/48] arm64: dts: marvell: align gpio-key node names with dtschema Krzysztof Kozlowski
2022-06-09 11:39   ` Krzysztof Kozlowski
2022-06-09 11:39 ` [PATCH v2 18/48] arm64: dts: marvell: armada-3720: align lednode " Krzysztof Kozlowski
2022-06-09 11:39   ` Krzysztof Kozlowski
2022-06-09 11:39 ` [PATCH v2 19/48] ARM: dts: marvell: align gpio-key node " Krzysztof Kozlowski
2022-06-09 11:39   ` Krzysztof Kozlowski
2022-06-09 11:39 ` [PATCH v2 20/48] ARM: dts: marvell: correct gpio-keys properties Krzysztof Kozlowski
2022-06-09 11:39   ` Krzysztof Kozlowski
2022-06-09 11:39 ` [PATCH v2 21/48] arm64: dts: mediatek: align gpio-key node names with dtschema Krzysztof Kozlowski
2022-06-09 11:39   ` Krzysztof Kozlowski
2022-06-09 11:39   ` Krzysztof Kozlowski
2022-06-09 11:39 ` [PATCH v2 22/48] arm64: dts: mediatek: mt7622-bananapi-bpi-r64: align led " Krzysztof Kozlowski
2022-06-09 11:39   ` Krzysztof Kozlowski
2022-06-09 11:39   ` Krzysztof Kozlowski
2022-06-09 11:39 ` [PATCH v2 23/48] arm64: dts: mediatek: mt7622-rfb1: correct gpio-keys properties Krzysztof Kozlowski
2022-06-09 11:39   ` Krzysztof Kozlowski
2022-06-09 11:39   ` Krzysztof Kozlowski
2022-06-09 11:39 ` [PATCH v2 24/48] ARM: dts: mediatek: align gpio-key node names with dtschema Krzysztof Kozlowski
2022-06-09 11:39   ` Krzysztof Kozlowski
2022-06-09 11:39   ` Krzysztof Kozlowski
2022-06-09 11:39 ` [PATCH v2 25/48] arm64: dts: tegra: " Krzysztof Kozlowski
2022-06-09 11:39 ` [PATCH v2 26/48] ARM: " Krzysztof Kozlowski
2022-06-09 11:40 ` [PATCH v2 27/48] arm64: dts: qcom: " Krzysztof Kozlowski
2022-06-09 11:40 ` [PATCH v2 28/48] arm64: dts: qcom: correct gpio-keys properties Krzysztof Kozlowski
2022-06-09 11:40 ` [PATCH v2 29/48] arm64: dts: qcom: sdm630-sony-xperia-nile: drop unneeded status from gpio-keys Krzysztof Kozlowski
2022-06-09 11:40 ` [PATCH v2 30/48] arm64: dts: qcom: align led node names with dtschema Krzysztof Kozlowski
2022-06-09 11:40 ` [PATCH v2 31/48] ARM: dts: qcom: align gpio-key " Krzysztof Kozlowski
2022-06-09 11:40 ` [PATCH v2 32/48] arm64: dts: rockchip: " Krzysztof Kozlowski
2022-06-09 11:40   ` Krzysztof Kozlowski
2022-06-09 11:40   ` Krzysztof Kozlowski
2022-06-09 13:57   ` Maya Matuszczyk
2022-06-09 13:57     ` Maya Matuszczyk
2022-06-09 13:57     ` Maya Matuszczyk
2022-06-09 14:15     ` Krzysztof Kozlowski
2022-06-09 14:15       ` Krzysztof Kozlowski
2022-06-09 14:15       ` Krzysztof Kozlowski
2022-06-09 14:56       ` Heiko Stübner
2022-06-09 14:56         ` Heiko Stübner
2022-06-09 14:56         ` Heiko Stübner
2022-06-09 15:05         ` Krzysztof Kozlowski
2022-06-09 15:05           ` Krzysztof Kozlowski
2022-06-09 15:05           ` Krzysztof Kozlowski
2022-06-09 15:55           ` Heiko Stübner
2022-06-09 15:55             ` Heiko Stübner
2022-06-09 15:55             ` Heiko Stübner
2022-06-09 11:40 ` [PATCH v2 33/48] ARM: " Krzysztof Kozlowski
2022-06-09 11:40   ` Krzysztof Kozlowski
2022-06-09 11:40   ` Krzysztof Kozlowski
2022-06-09 11:40 ` [PATCH v2 34/48] ARM: dts: rockchip: rk3288-tinker: correct gpio-keys properties Krzysztof Kozlowski
2022-06-09 11:40   ` Krzysztof Kozlowski
2022-06-09 11:40   ` Krzysztof Kozlowski
2022-06-09 11:40 ` [PATCH v2 35/48] arm64: dts: ti: align gpio-key node names with dtschema Krzysztof Kozlowski
2022-06-09 11:40   ` Krzysztof Kozlowski
2022-06-09 11:40 ` [PATCH v2 36/48] arm64: dts: xilinx: " Krzysztof Kozlowski
2022-06-09 11:40   ` Krzysztof Kozlowski
2022-06-09 11:40 ` [PATCH v2 37/48] ARM: " Krzysztof Kozlowski
2022-06-09 11:40   ` Krzysztof Kozlowski
2022-06-09 11:40 ` [PATCH v2 38/48] ARM: dts: omap: " Krzysztof Kozlowski
2022-06-09 11:40 ` [PATCH v2 39/48] ARM: dts: omap: correct gpio-keys properties Krzysztof Kozlowski
2022-06-09 11:40 ` [PATCH v2 40/48] ARM: dts: animeo: align gpio-key node names with dtschema Krzysztof Kozlowski
2022-06-09 11:40 ` [PATCH v2 41/48] ARM: dts: animeo: correct gpio-keys properties Krzysztof Kozlowski
2022-06-09 11:40 ` [PATCH v2 42/48] ARM: dts: aspeed: align gpio-key node names with dtschema Krzysztof Kozlowski
2022-06-09 11:40   ` Krzysztof Kozlowski
2022-06-09 11:40 ` [PATCH v2 43/48] ARM: dts: aspeed: correct gpio-keys properties Krzysztof Kozlowski
2022-06-09 11:40   ` Krzysztof Kozlowski
2022-06-09 11:40 ` [PATCH v2 44/48] ARM: dts: at91: align gpio-key node names with dtschema Krzysztof Kozlowski
2022-06-09 11:40   ` Krzysztof Kozlowski
2022-06-10  7:12   ` Claudiu.Beznea
2022-06-10  7:12     ` Claudiu.Beznea
2022-06-10 10:05     ` Krzysztof Kozlowski
2022-06-10 10:05       ` Krzysztof Kozlowski
2022-06-10 12:30       ` Claudiu.Beznea
2022-06-10 12:30         ` Claudiu.Beznea
2022-06-09 11:40 ` [PATCH v2 45/48] ARM: dts: at91: correct gpio-keys properties Krzysztof Kozlowski
2022-06-09 11:40   ` Krzysztof Kozlowski
2022-06-10  7:12   ` Claudiu.Beznea
2022-06-10  7:12     ` Claudiu.Beznea
2022-06-09 11:40 ` [PATCH v2 46/48] ARM: dts: at91: drop unneeded status from gpio-keys Krzysztof Kozlowski
2022-06-09 11:40   ` Krzysztof Kozlowski
2022-06-10  7:12   ` Claudiu.Beznea
2022-06-10  7:12     ` Claudiu.Beznea
2022-06-09 11:40 ` [PATCH v2 47/48] ARM: dts: exynos: align gpio-key node names with dtschema Krzysztof Kozlowski
2022-06-09 11:40   ` Krzysztof Kozlowski
2022-06-16  0:48   ` (subset) " Krzysztof Kozlowski
2022-06-16  0:48     ` Krzysztof Kozlowski
2022-06-09 11:40 ` [PATCH v2 48/48] ARM: dts: s5pv210: " Krzysztof Kozlowski
2022-06-09 11:40   ` Krzysztof Kozlowski
2022-06-16  0:48   ` (subset) " Krzysztof Kozlowski
2022-06-16  0:48     ` Krzysztof Kozlowski
2022-06-10  6:37 ` (subset) [PATCH v2 00/48] dt-bindings: input: gpio-keys: rework matching children Neil Armstrong
2022-06-10  6:37   ` Neil Armstrong
2022-06-10  6:37   ` Neil Armstrong
2022-06-10  6:37   ` Neil Armstrong
2022-06-10  6:37   ` Neil Armstrong
2022-07-03  3:56 ` Bjorn Andersson
2022-07-03  3:56   ` Bjorn Andersson
2022-07-03  3:56   ` Bjorn Andersson

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=20220609113843.380260-1-krzysztof.kozlowski@linaro.org \
    --to=krzysztof.kozlowski@linaro.org \
    --cc=arm@kernel.org \
    --cc=arnd@arndb.de \
    --cc=devicetree@vger.kernel.org \
    --cc=dmitry.torokhov@gmail.com \
    --cc=krzysztof.kozlowski+dt@linaro.org \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=olof@lixom.net \
    --cc=robh+dt@kernel.org \
    --cc=soc@kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.