From patchwork Thu Jun 16 00:52:54 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 12883183 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 494C6C43334 for ; Thu, 16 Jun 2022 00:53:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348586AbiFPAxp (ORCPT ); Wed, 15 Jun 2022 20:53:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54788 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348429AbiFPAxo (ORCPT ); Wed, 15 Jun 2022 20:53:44 -0400 Received: from mail-pj1-x102a.google.com (mail-pj1-x102a.google.com [IPv6:2607:f8b0:4864:20::102a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8050B52E71 for ; Wed, 15 Jun 2022 17:53:41 -0700 (PDT) Received: by mail-pj1-x102a.google.com with SMTP id z14so98080pjb.4 for ; Wed, 15 Jun 2022 17:53:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=wKTJZTS4t7az2GJI7jEzDuSKLi7v9IiEPZUWv0d18/c=; b=SyPuJJklDy1H6XojA4AIHIjZrl+9ePCIBiwQWRmYToeJarpqcQ/FBNSobV3UvGgZdk PoidlA4ccfXC+dV3BtaieQtxlwAGBWJR2FrHtPb1jc1bC0yeQMpnSAlweVOpbW+/lotW nTB7VR0IJEyhh4tnzPXUBh1HHqBBQQpes1xiTYQ+rpLkolYLAySQGYHzZnY9jOtC8+VH KvAO6vjl63YRwJHsRKY2x3371MSJ4/iERfdBYJX0/poVMsDdjhvLTp4l2w1V7fz3LYE1 Buvz5DaxfdIUfidKNd+OduGY9IDGNnuoKKssfGJXNedhjl5BSf1U+kMgdZwuiTD8ZB3h BsCw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=wKTJZTS4t7az2GJI7jEzDuSKLi7v9IiEPZUWv0d18/c=; b=FiVQh50Ncl3Skg2qV1fY+ng5H0AqmSfHbxiPMsfoYZA1M3sgku2yOTBTKtdT1t8ugn 22dsyV7EaGhtcfLLfYNYOWZL1Q8VpStKh9YxqmAOys5FbtmmDBKoZdZrN9CQdiE9aznx wKXfQgvc+YpS7SgL88kwN17WFmZnZuJj9R6glZ7SvPpGtKDh82QL7pPTpSLq+WiG0Ecf 7ijzwWQYBLVerlpNot3REwS6rQCt7hT+/mXrZ1bHVuxsGCEYwY22kloiFn/iSMeiRmo8 cr27Zte675fncV/aXg1U6L6gRS9flNUPGfl35AScLNxv+cKfFXQa0vtd7tM46GpvWUbn ukgg== X-Gm-Message-State: AJIora/vmXfF5uwP1zm/TCSLyMG8hsjN0mrby2Ur9bu8eehyB6RtGZ+M 95XwxH9w/R/C4OrSCIKTf/oejg== X-Google-Smtp-Source: AGRyM1slGubRm1jDRITvVIr2UimUdhwJ2r7riH5Iflpn7D+E8oMYwXmduVLCULNv3a3f/pF1sU+1Zw== X-Received: by 2002:a17:902:ce0c:b0:168:ca2e:c944 with SMTP id k12-20020a170902ce0c00b00168ca2ec944mr2118251plg.107.1655340820939; Wed, 15 Jun 2022 17:53:40 -0700 (PDT) Received: from krzk-bin.. ([192.77.111.2]) by smtp.gmail.com with ESMTPSA id p4-20020a170902780400b0016760c06b76sm233660pll.194.2022.06.15.17.53.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Jun 2022 17:53:40 -0700 (PDT) From: Krzysztof Kozlowski To: arm@kernel.org, soc@kernel.org, Arnd Bergmann , Olof Johansson , Dmitry Torokhov , Rob Herring , Krzysztof Kozlowski , linux-input@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Krzysztof Kozlowski , Rob Herring Subject: [PATCH v3 01/40] dt-bindings: input: gpio-keys: enforce node names to match all properties Date: Wed, 15 Jun 2022 17:52:54 -0700 Message-Id: <20220616005333.18491-1-krzysztof.kozlowski@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220616005224.18391-1-krzysztof.kozlowski@linaro.org> References: <20220616005224.18391-1-krzysztof.kozlowski@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.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 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 Reviewed-by: Rob Herring --- .../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: