Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

dt-bindings: input: gpio-keys: enforce node names to match all properties

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 properly prefixed or suffixed (button, event, switch or
key).

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>
Reviewed-by: Rob Herring <robh@kernel.org>
Link: https://lore.kernel.org/r/20220705120356.94876-2-krzysztof.kozlowski@linaro.org
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>

authored by

Krzysztof Kozlowski and committed by
Dmitry Torokhov
5eb56522 538c6406

+58 -61
+58 -61
Documentation/devicetree/bindings/input/gpio-keys.yaml
··· 16 16 - gpio-keys-polled 17 17 18 18 patternProperties: 19 - ".*": 20 - if: 21 - type: object 22 - then: 23 - $ref: input.yaml# 19 + "^(button|event|key|switch|(button|event|key|switch)-[a-z0-9-]+|[a-z0-9-]+-(button|event|key|switch))$": 20 + $ref: input.yaml# 24 21 25 - properties: 26 - gpios: 27 - maxItems: 1 22 + properties: 23 + gpios: 24 + maxItems: 1 28 25 29 - interrupts: 30 - maxItems: 1 26 + interrupts: 27 + maxItems: 1 31 28 32 - label: 33 - description: Descriptive name of the key. 29 + label: 30 + description: Descriptive name of the key. 34 31 35 - linux,code: 36 - description: Key / Axis code to emit. 32 + linux,code: 33 + description: Key / Axis code to emit. 37 34 38 - linux,input-type: 39 - default: 1 # EV_KEY 35 + linux,input-type: 36 + default: 1 # EV_KEY 40 37 41 - linux,input-value: 42 - description: | 43 - If linux,input-type is EV_ABS or EV_REL then this 44 - value is sent for events this button generates when pressed. 45 - EV_ABS/EV_REL axis will generate an event with a value of 0 46 - when all buttons with linux,input-type == type and 47 - linux,code == axis are released. This value is interpreted 48 - as a signed 32 bit value, e.g. to make a button generate a 49 - value of -1 use: 38 + linux,input-value: 39 + description: | 40 + If linux,input-type is EV_ABS or EV_REL then this 41 + value is sent for events this button generates when pressed. 42 + EV_ABS/EV_REL axis will generate an event with a value of 0 43 + when all buttons with linux,input-type == type and 44 + linux,code == axis are released. This value is interpreted 45 + as a signed 32 bit value, e.g. to make a button generate a 46 + value of -1 use: 50 47 51 - linux,input-value = <0xffffffff>; /* -1 */ 48 + linux,input-value = <0xffffffff>; /* -1 */ 52 49 53 - $ref: /schemas/types.yaml#/definitions/uint32 50 + $ref: /schemas/types.yaml#/definitions/uint32 54 51 55 - debounce-interval: 56 - description: 57 - Debouncing interval time in milliseconds. If not specified defaults to 5. 58 - $ref: /schemas/types.yaml#/definitions/uint32 52 + debounce-interval: 53 + description: 54 + Debouncing interval time in milliseconds. If not specified defaults to 5. 55 + $ref: /schemas/types.yaml#/definitions/uint32 59 56 60 - default: 5 57 + default: 5 61 58 62 - wakeup-source: 63 - description: Button can wake-up the system. 59 + wakeup-source: 60 + description: Button can wake-up the system. 64 61 65 - wakeup-event-action: 66 - description: | 67 - Specifies whether the key should wake the system when asserted, when 68 - deasserted, or both. This property is only valid for keys that wake up the 69 - system (e.g., when the "wakeup-source" property is also provided). 62 + wakeup-event-action: 63 + description: | 64 + Specifies whether the key should wake the system when asserted, when 65 + deasserted, or both. This property is only valid for keys that wake up the 66 + system (e.g., when the "wakeup-source" property is also provided). 70 67 71 - Supported values are defined in linux-event-codes.h: 68 + Supported values are defined in linux-event-codes.h: 72 69 73 - EV_ACT_ANY - both asserted and deasserted 74 - EV_ACT_ASSERTED - asserted 75 - EV_ACT_DEASSERTED - deasserted 76 - $ref: /schemas/types.yaml#/definitions/uint32 77 - enum: [0, 1, 2] 70 + EV_ACT_ANY - both asserted and deasserted 71 + EV_ACT_ASSERTED - asserted 72 + EV_ACT_DEASSERTED - deasserted 73 + $ref: /schemas/types.yaml#/definitions/uint32 74 + enum: [0, 1, 2] 78 75 79 - linux,can-disable: 80 - description: 81 - Indicates that button is connected to dedicated (not shared) interrupt 82 - which can be disabled to suppress events from the button. 83 - type: boolean 76 + linux,can-disable: 77 + description: 78 + Indicates that button is connected to dedicated (not shared) interrupt 79 + which can be disabled to suppress events from the button. 80 + type: boolean 84 81 85 - required: 86 - - linux,code 82 + required: 83 + - linux,code 87 84 88 - anyOf: 89 - - required: 90 - - interrupts 91 - - required: 92 - - gpios 85 + anyOf: 86 + - required: 87 + - interrupts 88 + - required: 89 + - gpios 93 90 94 - dependencies: 95 - wakeup-event-action: [ wakeup-source ] 96 - linux,input-value: [ gpios ] 91 + dependencies: 92 + wakeup-event-action: [ wakeup-source ] 93 + linux,input-value: [ gpios ] 97 94 98 - unevaluatedProperties: false 95 + unevaluatedProperties: false 99 96 100 97 if: 101 98 properties: