Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp1024717iog; Wed, 15 Jun 2022 18:41:05 -0700 (PDT) X-Google-Smtp-Source: AGRyM1tTu9FhmD4D98UBUTZlx2CTnzV+0W5Sv6zog0chTDVAavdziXBIlE4otliSwwcUisVwU/1A X-Received: by 2002:a17:906:5344:b0:711:f8fa:f16a with SMTP id j4-20020a170906534400b00711f8faf16amr2371217ejo.638.1655343665695; Wed, 15 Jun 2022 18:41:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655343665; cv=none; d=google.com; s=arc-20160816; b=euozRDWHjOoW7FmlhPaOL/1+vhADu3GtPN65dhRRmEWZQPB7ZlAwndkr3fUHZhYGR7 c6fixO64N//0aYRCafhZD/bZQx4jV+XpuJGhM3+AydWEpZZUb+SLPVERewAljP1nePa4 nVUr7X9bIoj8tT3UXtfFLa0auql5cZgTSdLgk7lQRr4EyoIQ2K94ymHRZVfoLD/UkU/b jS2Y9pfeaKrONrhiwV6ul9MiEsm+qYHfs2RqujpJkApW4hZ15plfiEhVZLowcQ6FjA8O 2Z24DRdvvQAdFkbzMvSTjxsRJS7yg+IZpUlaKWYhg2v2Tt0GbW+1Iy4ZFiqyhUKck0/Q BXDA== 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=wKTJZTS4t7az2GJI7jEzDuSKLi7v9IiEPZUWv0d18/c=; b=SskquR1zu8GVMX//IGyfvshbzj3Uy/yO+dNpaGvwMl2kXoB3T2jk2IWWxF+6iooOlY uWKBJ3ME+Bxfm0yQRXgC51QjphQ5KpFF7tov5rAPBpmzWbh3fDP994pO4+D+HYO8mxxl kudmL6Nkv+bvee5ExI41kYSBRtani1ESwSLGZueUjzSQGwfkqLw4VYGqgd8LH56t54vw +ndQeqfHsjJQRkOGIfpja1R7/OlDCjZKWUglTOq2VlKo2vc+yH/jpr65oAyFE7VPZe+U xqjK3U5YfwtiXvp9VA+5kyuMXI2LbebqEDjjnuII5X8JxG4mRfgWYJH2v5GtU1BM+QIA XOtA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=SyPuJJkl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l4-20020aa7c3c4000000b0042e15364b0fsi194286edr.273.2022.06.15.18.40.40; Wed, 15 Jun 2022 18:41:05 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=SyPuJJkl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348431AbiFPAxo (ORCPT + 99 others); Wed, 15 Jun 2022 20:53:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54778 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229711AbiFPAxm (ORCPT ); Wed, 15 Jun 2022 20:53:42 -0400 Received: from mail-pj1-x1032.google.com (mail-pj1-x1032.google.com [IPv6:2607:f8b0:4864:20::1032]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7CAF737A15 for ; Wed, 15 Jun 2022 17:53:41 -0700 (PDT) Received: by mail-pj1-x1032.google.com with SMTP id k12-20020a17090a404c00b001eaabc1fe5dso373496pjg.1 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=W1+SujLUNbhVKNv71chlDvYOWUAoTw1JLb4AbkJO0f7wen1RbqBDlZzGRCiSgPuVnj gBC9hwG43rS3jp0upUVRgvKu9CBhCbHJmpXVq7W83ih2S0+WsK4tYFAIVZyEKcMCPaWr VQhEhhDqUv2bcOOg4NV3bptVr6tGNGeWEhMrdym/UF3heEsYtyZWTQMYifzOTUnhEcVB giqecwHBA23i5fSCdtpYu+Tt9qWGyEv1SVWtmc4w+Lb9xk2THgGfHXEPRo46deN/g67H vHcwtY6y4H8fWvak0iEVNGUFhyA1vZzAGo5w0H5K1AUtxUDDSXL24h4IMEiEqZvIWugv Kvfg== X-Gm-Message-State: AJIora+Sc7QmYYeqpLwWBX8ABJaXcvClth7y6jhXkNgs7xYxXGQ1nbwk FCXu7nWiDKvE1URS/O/6jns3Vg== 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 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham 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 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: -- 2.34.1