Received: by 2002:a5d:9c59:0:0:0:0:0 with SMTP id 25csp49667iof; Sun, 5 Jun 2022 20:45:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzc4axAf9mQNbrdYLcerphHEuDYrUMVyCbJdi+5BmKo1bDLRVBY6uxuCmLcg5yYeY920fEB X-Received: by 2002:a63:524a:0:b0:3fc:7f18:685d with SMTP id s10-20020a63524a000000b003fc7f18685dmr19598947pgl.387.1654487140575; Sun, 05 Jun 2022 20:45:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654487140; cv=none; d=google.com; s=arc-20160816; b=lI+wy+6qMRBT1FLVwk+QvO1QGOE4q9PgzbMCrqLiH5XPEVKsyB1NRMjHdgqXwBbtAl wqhCQ3Z9Bfvv3/mmqJREfTisrYBx3vRUqDDJ8qhNq6LzkXIuBA4mZH2PHVz5/PgRsm18 i8RHR8aCrZhEjHjBxDlmuIOylx5H6r4PKBgVu9QZ97Q9txX8E1mjvswh3hcTGo61+Xmz GJH6YxAZBSzf+7dYsdIvLgylcoiKBATd1RaCJIMlnQvJyQ5Lg6G35xiRs0++fEQBP/Er l/jawdDxWtHMprgHStyZuK9WdtW0Id2s9wY+Qu4kxXxw55vcZ6ldco8IRN0rHsRhi+1L 2LgQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=yZFAC5hWrGSMWW4pyqq2o7yeNquu3KMJXhoGaGFmlr0=; b=EvPLr4nXnIdh6V+BZ/TKkiUfE6ANg+XWTtkOvQbCjmv4VSfXKmxnEmPM0vJH+KBC7n 7uyVhVoMLuiwAoHIKjnYQ1L6r74FMLRmuojPiLAPOLHd7luZjKYnAl/IdhdnbduodQVc g1w6nzT+eQMl21lMEZCIPMJUMScqM1t1z2HntqVBdrKWs2i+WbkgYXfnC/tXuukKn6Lj fzsccf3FGsJg6e8raDnfVmNW45bA0HwfadKlVikyu1UjIUI8FcHqAarz6eKA4tNUyvbL ibNSNyNbOcEHcjEloUzRcndcxDqjDhneDor5C61C8EKakkz1bWHONFARNW910duXSF6N hR/g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=oX8X9YLS; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id s64-20020a17090a2f4600b001e2d6f186fasi24054217pjd.183.2022.06.05.20.45.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 05 Jun 2022 20:45:40 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=oX8X9YLS; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 15F7B541B8; Sun, 5 Jun 2022 20:39:32 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229664AbiFCKQ0 (ORCPT + 99 others); Fri, 3 Jun 2022 06:16:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59336 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243465AbiFCKQR (ORCPT ); Fri, 3 Jun 2022 06:16:17 -0400 Received: from mail-ej1-x62a.google.com (mail-ej1-x62a.google.com [IPv6:2a00:1450:4864:20::62a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 718A63B287 for ; Fri, 3 Jun 2022 03:16:15 -0700 (PDT) Received: by mail-ej1-x62a.google.com with SMTP id y19so15008630ejq.6 for ; Fri, 03 Jun 2022 03:16:15 -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=yZFAC5hWrGSMWW4pyqq2o7yeNquu3KMJXhoGaGFmlr0=; b=oX8X9YLS/Jsx0u1jbFF0uduCaT9bKzIBMyGUILwxem9MnPfIqcoOlbcE8c9an3Ff7t rRQkrGFai/k/rZNByLDvlyU1tApFj52T3xGEs1p5Sz8XkfGQtUj9ebnNzhcytNoksfAD 5c4zScx+BY0VQe8PO5wfpBP/8loe8OdBgLY6S5XYfyyU8BxmYpRMw0lC9Vk+mbjtUAzF 6DP4lM5C3hOdp6au9AyouUGJvKRJMTu0T3ujI1o5ReU4K6Hyd24nKnfMeNO4trnxT8f0 ObqguMLm3NTauna3b89FttwbfD31jFdU7o6Cq2nf5kcwgVzLzD8cskNkjuFqOHzcsbaB M+ow== 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=yZFAC5hWrGSMWW4pyqq2o7yeNquu3KMJXhoGaGFmlr0=; b=etrPzx6gaVrnlLC5Pt9wuRgJMcB2Xn7mrjvk8q9QOGXq6XhSq3hJ2Oi0TG27/lMJma 9eL8oMThhUyG8J6NOEpF84CBBi4msLsU+SJ7Ypjm3GMqwKqV9ctMO1ZjK/JEoJt9NI11 kW94emgC2YwBiMc9NxsoF5GKt//pRA3By2ehqZ/+PAmtmcGxfSFZLurGt+ml7mXNTnMW XNXd553dzeTEZAYK9T0Dd74bTprh8bAEpL38YwezLCX4yferRGN5FBpiQYVo8TAhNMjy YzZA/B1rxsYXVES9aGllxT9Lrpyyb4tRK35A2hGMnt17V1Wr/tTMt91xgX9Oowvdm+++ nNrQ== X-Gm-Message-State: AOAM533I/uwbdV+x8RmCqNHCqkni/xuGI367Jt0PFg7PEZB/ohruEbg+ QvmPS1AgAsU6l+NwKWR1cPYBQQ== X-Received: by 2002:a17:907:1686:b0:70e:d428:f8ab with SMTP id hc6-20020a170907168600b0070ed428f8abmr1441372ejc.433.1654251373983; Fri, 03 Jun 2022 03:16:13 -0700 (PDT) Received: from localhost.localdomain (xdsl-188-155-176-92.adslplus.ch. [188.155.176.92]) by smtp.gmail.com with ESMTPSA id j15-20020a170906430f00b006f3ef214dc7sm2779008ejm.45.2022.06.03.03.16.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Jun 2022 03:16:13 -0700 (PDT) From: Krzysztof Kozlowski To: Dmitry Torokhov , Rob Herring , Krzysztof Kozlowski , linux-input@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Stefan Hansson , Andreas Kemnade , Krzysztof Kozlowski Subject: [RFC PATCH 1/2] dt-bindings: input: gpio-keys: enforce node names to match all properties Date: Fri, 3 Jun 2022 12:16:00 +0200 Message-Id: <20220603101601.542054-2-krzysztof.kozlowski@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220603101601.542054-1-krzysztof.kozlowski@linaro.org> References: <20220603101601.542054-1-krzysztof.kozlowski@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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 named with 'key-' prefix or '-key' suffix. Signed-off-by: Krzysztof Kozlowski --- .../devicetree/bindings/input/gpio-keys.yaml | 169 +++++++++--------- 1 file changed, 83 insertions(+), 86 deletions(-) diff --git a/Documentation/devicetree/bindings/input/gpio-keys.yaml b/Documentation/devicetree/bindings/input/gpio-keys.yaml index 93f601c58984..49d388dc8d78 100644 --- a/Documentation/devicetree/bindings/input/gpio-keys.yaml +++ b/Documentation/devicetree/bindings/input/gpio-keys.yaml @@ -16,92 +16,89 @@ 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. - $ref: /schemas/types.yaml#/definitions/uint32 - - linux,input-type: - description: - Specify event type this button/key generates. If not specified defaults to - <1> == EV_KEY. - $ref: /schemas/types.yaml#/definitions/uint32 - - default: 1 - - 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 + "^(key|key-[a-z0-9-]+|[a-z0-9-]+-key)$": + $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. + $ref: /schemas/types.yaml#/definitions/uint32 + + linux,input-type: + description: + Specify event type this button/key generates. If not specified defaults to + <1> == EV_KEY. + $ref: /schemas/types.yaml#/definitions/uint32 + + default: 1 + + 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