From nobody Wed Feb 11 02:33:35 2026 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 B68DEC761A6 for ; Tue, 4 Apr 2023 17:22:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236007AbjDDRWn (ORCPT ); Tue, 4 Apr 2023 13:22:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49996 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235975AbjDDRWk (ORCPT ); Tue, 4 Apr 2023 13:22:40 -0400 Received: from mail-ed1-x52d.google.com (mail-ed1-x52d.google.com [IPv6:2a00:1450:4864:20::52d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9233A55A5 for ; Tue, 4 Apr 2023 10:22:23 -0700 (PDT) Received: by mail-ed1-x52d.google.com with SMTP id ek18so133630961edb.6 for ; Tue, 04 Apr 2023 10:22:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1680628942; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=gsfRezrkWzcgntEuPXChWork7/N3Q6fPF9s7UG+klPE=; b=u3p08ZoFywIgI8Ewqi/dWG7aOYhJvA8jyprnLLPiQa6zZwFAuqKigqCLYgqHJ1PLKF KTxEG1T/vWUDX3rYAkBI6c0mJsmfHPY4Br6WABD7Dmc0Mposya+CenNMH8bzAKbFDZxi mzyeZq4KoEfJUpZBIuddA1jQDVetktH3At0CXOXjoQF8ToAXaES8moyezsZONndIsuhl RP3v/KNSJmfPhR0inN3qP+mbeOpqRp94w/YwsY2f78XZxl6XWFThD438IhUwDu0AWVRg LqyI1pJ9DVwQP3SMphK1LaRT7da5i40LbjFLMZtcVBqhIwY+GsnuJ7xJrAtheyd41qyT LPgg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680628942; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=gsfRezrkWzcgntEuPXChWork7/N3Q6fPF9s7UG+klPE=; b=MRgMtuTpNuorXCRW6K9kvd4SdUSCSdITAY3lc2qSBRHA3Np8Ln2N1DuMEQUT+X8IbU pHuOF8mpweqGb4u5ovLF0DpOWGe1dquiojgTz8tDHWdJnfpHx20I3XtChMqONmrhDn+C mP0SdTxBYpyiLaZkRZqb8ZP/bjZcBMe+SgT/nzPiO0jvUTkqwNkofgQ1ujuycI6jmcnq AD/hTDVn7Uh8f3+yjX4SSiP8jrFDdFvpQx2VUWxINycm282HKxwxoxh294TdLVb3xAdU F8q4ozVsC6UPZULAWU3h4trrTQEKPCWI/08An6t3FOpQZmsQtdwII38oNJrV+IzHYlhZ 2ooQ== X-Gm-Message-State: AAQBX9eQf93lvPNQNHwLxmjPqKf/w3VkdAkuLftQEVq//5kd1pCsokkb OyqlBQavD+wwgyD/xzeFFO9ZVA== X-Google-Smtp-Source: AKy350Z8GmLJqT3Nu/TCa8MKc3a4dYI4Y4KCUmcZ4H1eYcHjEIuWBOxgb/jAq6ojWkgAvkP40sZraQ== X-Received: by 2002:a17:906:702:b0:92f:d1ec:a7d7 with SMTP id y2-20020a170906070200b0092fd1eca7d7mr50288ejb.15.1680628942079; Tue, 04 Apr 2023 10:22:22 -0700 (PDT) Received: from localhost.localdomain ([5.133.47.210]) by smtp.gmail.com with ESMTPSA id bv20-20020a170906b1d400b009447277c2aasm6208333ejb.39.2023.04.04.10.22.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 Apr 2023 10:22:21 -0700 (PDT) From: Srinivas Kandagatla To: gregkh@linuxfoundation.org Cc: linux-kernel@vger.kernel.org, Miquel Raynal , Stephen Boyd , Peter Chen , Rob Herring , Srinivas Kandagatla Subject: [PATCH 01/40] of: Fix modalias string generation Date: Tue, 4 Apr 2023 18:21:09 +0100 Message-Id: <20230404172148.82422-2-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230404172148.82422-1-srinivas.kandagatla@linaro.org> References: <20230404172148.82422-1-srinivas.kandagatla@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Miquel Raynal The helper generating an OF based modalias (of_device_get_modalias()) works fine, but due to the use of snprintf() internally it needs a buffer one byte longer than what should be needed just for the entire string (excluding the '\0'). Most users of this helper are sysfs hooks providing the modalias string to users. They all provide a PAGE_SIZE buffer which is way above the number of bytes required to fit the modalias string and hence do not suffer from this issue. There is another user though, of_device_request_module(), which is only called by drivers/usb/common/ulpi.c. This request module function is faulty, but maybe because in most cases there is an alternative, ULPI driver users have not noticed it. In this function, of_device_get_modalias() is called twice. The first time without buffer just to get the number of bytes required by the modalias string (excluding the null byte), and a second time, after buffer allocation, to fill the buffer. The allocation asks for an additional byte, in order to store the trailing '\0'. However, the buffer *length* provided to of_device_get_modalias() excludes this extra byte. The internal use of snprintf() with a length that is exactly the number of bytes to be written has the effect of using the last available byte to store a '\0', which then smashes the last character of the modalias string. Provide the actual size of the buffer to of_device_get_modalias() to fix this issue. Note: the "str[size - 1] =3D '\0';" line is not really needed as snprintf will anyway end the string with a null byte, but there is a possibility that this function might be called on a struct device_node without compatible, in this case snprintf() would not be executed. So we keep it just to avoid possible unbounded strings. Cc: Stephen Boyd Cc: Peter Chen Fixes: 9c829c097f2f ("of: device: Support loading a module with OF based mo= dalias") Signed-off-by: Miquel Raynal Reviewed-by: Rob Herring Signed-off-by: Srinivas Kandagatla --- drivers/of/device.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/of/device.c b/drivers/of/device.c index 955bfb3d1a83..c91bb5899256 100644 --- a/drivers/of/device.c +++ b/drivers/of/device.c @@ -297,12 +297,15 @@ int of_device_request_module(struct device *dev) if (size < 0) return size; =20 - str =3D kmalloc(size + 1, GFP_KERNEL); + /* Reserve an additional byte for the trailing '\0' */ + size++; + + str =3D kmalloc(size, GFP_KERNEL); if (!str) return -ENOMEM; =20 of_device_get_modalias(dev, str, size); - str[size] =3D '\0'; + str[size - 1] =3D '\0'; ret =3D request_module(str); kfree(str); =20 --=20 2.25.1 From nobody Wed Feb 11 02:33:35 2026 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 8C39BC761A6 for ; Tue, 4 Apr 2023 17:22:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236025AbjDDRWp (ORCPT ); Tue, 4 Apr 2023 13:22:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50046 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235977AbjDDRWl (ORCPT ); Tue, 4 Apr 2023 13:22:41 -0400 Received: from mail-ed1-x530.google.com (mail-ed1-x530.google.com [IPv6:2a00:1450:4864:20::530]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EEBAD1717 for ; Tue, 4 Apr 2023 10:22:24 -0700 (PDT) Received: by mail-ed1-x530.google.com with SMTP id eg48so133477145edb.13 for ; Tue, 04 Apr 2023 10:22:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1680628943; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=I4i10Nu53Bt3FeFdaaCNbwgGOLAXs2beXmn7v88uxP0=; b=nP7X/2nPRF7l16+IigXht4VSenKiHnt3mctghSd++ZKNedKaiva0CCAjAxjoZxBdin vlRSY/qROKZqZf52CIc4m5HtMdTAtqyQfKYBBUSjYvEQR15BjJfULEv/c/8RH+SwsHf+ IgFT+PJcy101yA6QFth7kbzUEgG1vleqwS6zy5YcC8SaQJwiKBh9tOoSMU2mHA8kkb+0 A+23kDJymgUD7SCRliEm4tx8gohj8hBE5Q4tywCKd9++Qp7LH6p5X1YRAxIFq/CHJqSR yRHEVcjBxI4dIQ+SNC30InFyKLwNdJrqPoNMzEoUAtDSnHzJv+JuYymgYBD9zJdEgTDd lw9Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680628943; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=I4i10Nu53Bt3FeFdaaCNbwgGOLAXs2beXmn7v88uxP0=; b=PY/KiCPmsH/Qh1YlQtWMYAR/HaUGR+Sn+3oqgGt9pkKL1a7yGrm6EB1U8QIdX9svcF hG9Pdysy4IJrjF8QmEV9X5uRicNwbhXJGz54IjxscIGqEiP60Cot6jcf0scqiDWFHhzX Y/t3HRV8h9JBLJss8lfMWCKBMusb7cRLmV3VheUgHyby93z8omEbUc3ZqNg+ly9cO7ME QkuNlQNtOSDTKWjmoInkpNH3YiINVyPCkXrjFYY3uXi2ZVilZQJ6u37ZXQwlyRYAkVgI d2//qIB29lVmScIX6kdpye2bv2l5/T/P14Ij2Edvnow6pxpc/8qvbEbWfHY+hcFJUS5V m7gg== X-Gm-Message-State: AAQBX9fgn++E+S2PBDRpheWbbBZCLadQ9BwFRYwp4fP73OXlkpr4yGOK WM70/YOLJaJRSTrhSBxXyQBIXg== X-Google-Smtp-Source: AKy350YCCfw960OjUdjDZOBMlZ3hZMSYycwEDsy99nytIwnmlzDl10aD7t23k3ygynKfOEzVEH0ioA== X-Received: by 2002:a17:907:a802:b0:8b1:7684:dfab with SMTP id vo2-20020a170907a80200b008b17684dfabmr369493ejc.38.1680628943281; Tue, 04 Apr 2023 10:22:23 -0700 (PDT) Received: from localhost.localdomain ([5.133.47.210]) by smtp.gmail.com with ESMTPSA id bv20-20020a170906b1d400b009447277c2aasm6208333ejb.39.2023.04.04.10.22.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 Apr 2023 10:22:22 -0700 (PDT) From: Srinivas Kandagatla To: gregkh@linuxfoundation.org Cc: linux-kernel@vger.kernel.org, Johan Hovold , Krzysztof Kozlowski , Srinivas Kandagatla Subject: [PATCH 02/40] dt-bindings: nvmem: qcom,spmi-sdam: fix example 'reg' property Date: Tue, 4 Apr 2023 18:21:10 +0100 Message-Id: <20230404172148.82422-3-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230404172148.82422-1-srinivas.kandagatla@linaro.org> References: <20230404172148.82422-1-srinivas.kandagatla@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Johan Hovold The SPMI PMIC register region width is fixed and should not be encoded in the devicetree. Amend the example with a parent pmic node with the expected '#address-cells' and '#size-cells' and fix up the 'reg' property. Fixes: 9664a6b54c57 ("dt-bindings: nvmem: add binding for QTI SPMI SDAM") Signed-off-by: Johan Hovold Reviewed-by: Krzysztof Kozlowski Signed-off-by: Srinivas Kandagatla --- .../bindings/nvmem/qcom,spmi-sdam.yaml | 31 +++++++++++-------- 1 file changed, 18 insertions(+), 13 deletions(-) diff --git a/Documentation/devicetree/bindings/nvmem/qcom,spmi-sdam.yaml b/= Documentation/devicetree/bindings/nvmem/qcom,spmi-sdam.yaml index e08504ef3b6e..4702f10ecca2 100644 --- a/Documentation/devicetree/bindings/nvmem/qcom,spmi-sdam.yaml +++ b/Documentation/devicetree/bindings/nvmem/qcom,spmi-sdam.yaml @@ -42,17 +42,22 @@ unevaluatedProperties: false =20 examples: - | - sdam_1: nvram@b000 { - #address-cells =3D <1>; - #size-cells =3D <1>; - compatible =3D "qcom,spmi-sdam"; - reg =3D <0xb000 0x100>; - ranges =3D <0 0xb000 0x100>; - - /* Data cells */ - restart_reason: restart@50 { - reg =3D <0x50 0x1>; - bits =3D <6 2>; - }; - }; + pmic { + #address-cells =3D <1>; + #size-cells =3D <0>; + + sdam_1: nvram@b000 { + compatible =3D "qcom,spmi-sdam"; + reg =3D <0xb000>; + #address-cells =3D <1>; + #size-cells =3D <1>; + ranges =3D <0 0xb000 0x100>; + + /* Data cells */ + restart_reason: restart@50 { + reg =3D <0x50 0x1>; + bits =3D <6 2>; + }; + }; + }; ... --=20 2.25.1 From nobody Wed Feb 11 02:33:35 2026 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 C1294C6FD1D for ; Tue, 4 Apr 2023 17:22:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236031AbjDDRWs (ORCPT ); Tue, 4 Apr 2023 13:22:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50012 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235885AbjDDRWm (ORCPT ); Tue, 4 Apr 2023 13:22:42 -0400 Received: from mail-ed1-x52d.google.com (mail-ed1-x52d.google.com [IPv6:2a00:1450:4864:20::52d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 21F7E19F for ; Tue, 4 Apr 2023 10:22:26 -0700 (PDT) Received: by mail-ed1-x52d.google.com with SMTP id ek18so133631384edb.6 for ; Tue, 04 Apr 2023 10:22:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1680628944; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=HO2ovPp2g8BY9KhfdMQrBMTwegDXLLj5jKc/ptyrY30=; b=tjhO1KpfHhc+1lR2iyt1Hk/rwcxama/wjJ7OZ99SJ9iE5PvvnClZooJL0nqUXPFW4w 8PzRygBzo62hR6aADvLBLh5zaUc9K6iHxsjI8GhSstvvF0Lj0mjG16K1nLIAgvpe3lCO IfvpySSB2i8q6tkhKqZxiq+I1G7MxQ6gEgFpY8mVOIr605DfgxdCPoHlgKjdf+DkmH7q m79NFghwh84Eqf8YGE3vMjyxAXLo15cRhi2jqwO8XbxtMGQwFbaEvZyF60IAZAT2Uukn Xy3tyVnLskveOBXY8K6of7oF+MzTS1kEAy6H9E5JdXU9fI0rQ5mTzNQBPzovDarbqu1z whUw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680628944; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=HO2ovPp2g8BY9KhfdMQrBMTwegDXLLj5jKc/ptyrY30=; b=USrEdnfVryCHpGvwB0vFkv0xIkREjgCFdXTM6uIgQJAXcNOs5mHZjFfu/NY+AoVTb3 740u/x2ta0+zU9eI2HhVzO5R63d/9n5l2YRzbleEMoZKCOg9Y2n3Q5s4Fkg5IKGNmywV ny3tQRAyNL2WzLI9eO0CIj7bZNJY3FVa1M8PdFrl1K1duY0GMTtGRPVBcGke2FXiMY0p yiK9RqsK4UEFfWtjX804BY8WPP47jcSoMmB3BIvV1vHlJq2LmhhSPF7dxVsN5fCjuk7L rB0AGO6wkGGyvN4qvSsMTo8KizsQmODnHxcNQCRVAIAGvOVQIETrmEo6I+iFR6p70aB7 Z/ig== X-Gm-Message-State: AAQBX9f0scbODw8tJCcR0K4eVl2uW6U7LqeVomX37D85LyrXWNvwvkLV xYGR9EJSP3uSVNwfdtCWcDZ+OQ== X-Google-Smtp-Source: AKy350Y26vq43+a2Aqrtc3D+K5XSDWstIaaK2jDuDL/irBvuLfTWCLG7XAeAr7fcVbJqkjEUOP1U2w== X-Received: by 2002:a17:906:f1d5:b0:870:d9a:9ebb with SMTP id gx21-20020a170906f1d500b008700d9a9ebbmr302300ejb.38.1680628944564; Tue, 04 Apr 2023 10:22:24 -0700 (PDT) Received: from localhost.localdomain ([5.133.47.210]) by smtp.gmail.com with ESMTPSA id bv20-20020a170906b1d400b009447277c2aasm6208333ejb.39.2023.04.04.10.22.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 Apr 2023 10:22:23 -0700 (PDT) From: Srinivas Kandagatla To: gregkh@linuxfoundation.org Cc: linux-kernel@vger.kernel.org, Nick Alcock , Michal Simek , Luis Chamberlain , linux-modules@vger.kernel.org, Hitomi Hasegawa , Srinivas Kandagatla , Michal Simek , linux-arm-kernel@lists.infradead.org Subject: [PATCH 03/40] nvmem: xilinx: zynqmp: make modular Date: Tue, 4 Apr 2023 18:21:11 +0100 Message-Id: <20230404172148.82422-4-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230404172148.82422-1-srinivas.kandagatla@linaro.org> References: <20230404172148.82422-1-srinivas.kandagatla@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Nick Alcock This driver has a MODULE_LICENSE but is not tristate so cannot be built as a module, unlike all its peers: make it modular to match. Signed-off-by: Nick Alcock Suggested-by: Michal Simek Cc: Luis Chamberlain Cc: linux-modules@vger.kernel.org Cc: linux-kernel@vger.kernel.org Cc: Hitomi Hasegawa Cc: Srinivas Kandagatla Cc: Michal Simek Cc: linux-arm-kernel@lists.infradead.org Signed-off-by: Srinivas Kandagatla --- drivers/nvmem/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/nvmem/Kconfig b/drivers/nvmem/Kconfig index 6dec38805041..3b3832f4dfad 100644 --- a/drivers/nvmem/Kconfig +++ b/drivers/nvmem/Kconfig @@ -368,7 +368,7 @@ config NVMEM_VF610_OCOTP be called nvmem-vf610-ocotp. =20 config NVMEM_ZYNQMP - bool "Xilinx ZYNQMP SoC nvmem firmware support" + tristate "Xilinx ZYNQMP SoC nvmem firmware support" depends on ARCH_ZYNQMP help This is a driver to access hardware related data like --=20 2.25.1 From nobody Wed Feb 11 02:33:35 2026 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 637D1C6FD1D for ; Tue, 4 Apr 2023 17:23:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236055AbjDDRXA (ORCPT ); Tue, 4 Apr 2023 13:23:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50194 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236017AbjDDRWo (ORCPT ); Tue, 4 Apr 2023 13:22:44 -0400 Received: from mail-ed1-x534.google.com (mail-ed1-x534.google.com [IPv6:2a00:1450:4864:20::534]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8D6EC558F for ; Tue, 4 Apr 2023 10:22:27 -0700 (PDT) Received: by mail-ed1-x534.google.com with SMTP id t10so133431394edd.12 for ; Tue, 04 Apr 2023 10:22:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1680628946; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=qd06AIYAawb0fyKtUMKemgYfIsiht0igGFmjHLSBjJg=; b=xloKNG8SjT0scLVISJA1hE4At/vDMlLEVvra2ZbDP3VIs3sCzN/UKqExXe39zj4iSe JkP4iFJLl651/JiaPWl8OdKqRu8UjM+IT9/qVNglRzfpBEGs7L1nG22VS00ntfOsan3e trODDalO7qC/Lz/o3YTwuzlc3dsSqvpWDu55pI7ZPVNOGUCOFo9wsvPvCxkl0beU67le jQKTD7RsXmxe/BWlRzED2jJtFESSP03FoO51VjJKxXdKKLA3GcbSJEkbyZu04NdhoxDs SYEEz1BZlST8lciC/I8FbAyJnWiSTiCdQRXhXJU/jNqa1LhLK49DUcgaBAUPe2eOp8Tk K81Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680628946; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=qd06AIYAawb0fyKtUMKemgYfIsiht0igGFmjHLSBjJg=; b=5QwUJC9a6hldti4BeBm97e7w2BHpfkPIrRkKTkYy/KSVNJH2QcTBYbhDM/EfZDfHOf Pb9QH7lhxjnebxxPyHUgYgYPMJTvz3VAw26jsfm5PKj7dDHM60PJVaeu834MEevCGwe+ P+tAaGlEvztCXanl9iQXJEapJT2tDVQW0sO/pASGLZRiNaV1L11YGYFL1Pd8Nazd01Av aAGOtJ1eb+IZMt+wbD/TVUkAjmIZKpTp2z9IS2nHaW3A8meqtomKh7jNvolYZxhAtwI6 sxBEbsPgl7yHNPCmLfr9oR7xYTVPIA7R6nGYbU+FrLRKxTBtzh4UF7wz/2gmjcB+15Nv Ftzw== X-Gm-Message-State: AAQBX9eSXVgeT93g37XmV2j1hBKBBCHfR365Y8PwJQ/FRPeYSX0dkJxF bel+T+PdRgi17v8J1D6GPSihqA== X-Google-Smtp-Source: AKy350bvEgpwRx08EA1pUHX9PMT5a1mKrEzEZkNsEmCDM8Ku2Ppks4WRI9TgaIxl+sBJXvp6Z6NTDA== X-Received: by 2002:a17:906:6b84:b0:932:8dc:5bf4 with SMTP id l4-20020a1709066b8400b0093208dc5bf4mr274186ejr.61.1680628945959; Tue, 04 Apr 2023 10:22:25 -0700 (PDT) Received: from localhost.localdomain ([5.133.47.210]) by smtp.gmail.com with ESMTPSA id bv20-20020a170906b1d400b009447277c2aasm6208333ejb.39.2023.04.04.10.22.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 Apr 2023 10:22:25 -0700 (PDT) From: Srinivas Kandagatla To: gregkh@linuxfoundation.org Cc: linux-kernel@vger.kernel.org, Neil Armstrong , Krzysztof Kozlowski , Martin Blumenstingl , Srinivas Kandagatla Subject: [PATCH 04/40] dt-bindings: nvmem: convert amlogic-meson-mx-efuse.txt to dt-schema Date: Tue, 4 Apr 2023 18:21:12 +0100 Message-Id: <20230404172148.82422-5-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230404172148.82422-1-srinivas.kandagatla@linaro.org> References: <20230404172148.82422-1-srinivas.kandagatla@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Neil Armstrong Convert the Amlogic Meson6 eFuse bindings to dt-schema. Reviewed-by: Krzysztof Kozlowski Signed-off-by: Neil Armstrong Reviewed-by: Martin Blumenstingl Signed-off-by: Srinivas Kandagatla --- .../bindings/nvmem/amlogic,meson6-efuse.yaml | 57 +++++++++++++++++++ .../bindings/nvmem/amlogic-meson-mx-efuse.txt | 22 ------- 2 files changed, 57 insertions(+), 22 deletions(-) create mode 100644 Documentation/devicetree/bindings/nvmem/amlogic,meson6-= efuse.yaml delete mode 100644 Documentation/devicetree/bindings/nvmem/amlogic-meson-m= x-efuse.txt diff --git a/Documentation/devicetree/bindings/nvmem/amlogic,meson6-efuse.y= aml b/Documentation/devicetree/bindings/nvmem/amlogic,meson6-efuse.yaml new file mode 100644 index 000000000000..84b3dfd21e09 --- /dev/null +++ b/Documentation/devicetree/bindings/nvmem/amlogic,meson6-efuse.yaml @@ -0,0 +1,57 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/nvmem/amlogic,meson6-efuse.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Amlogic Meson6 eFuse + +maintainers: + - Neil Armstrong + - Martin Blumenstingl + +allOf: + - $ref: nvmem.yaml# + +properties: + compatible: + enum: + - amlogic,meson6-efuse + - amlogic,meson8-efuse + - amlogic,meson8b-efuse + + reg: + maxItems: 1 + + clocks: + maxItems: 1 + + clock-names: + const: core + +required: + - compatible + - reg + - clocks + - clock-names + +unevaluatedProperties: false + +examples: + - | + efuse: efuse@0 { + compatible =3D "amlogic,meson6-efuse"; + reg =3D <0x0 0x2000>; + clocks =3D <&clk_efuse>; + clock-names =3D "core"; + #address-cells =3D <1>; + #size-cells =3D <1>; + + ethernet_mac_address: mac@1b4 { + reg =3D <0x1b4 0x6>; + }; + + temperature_calib: calib@1f4 { + reg =3D <0x1f4 0x4>; + }; + }; diff --git a/Documentation/devicetree/bindings/nvmem/amlogic-meson-mx-efuse= .txt b/Documentation/devicetree/bindings/nvmem/amlogic-meson-mx-efuse.txt deleted file mode 100644 index a3c63954a1a4..000000000000 --- a/Documentation/devicetree/bindings/nvmem/amlogic-meson-mx-efuse.txt +++ /dev/null @@ -1,22 +0,0 @@ -Amlogic Meson6/Meson8/Meson8b efuse - -Required Properties: -- compatible: depending on the SoC this should be one of: - - "amlogic,meson6-efuse" - - "amlogic,meson8-efuse" - - "amlogic,meson8b-efuse" -- reg: base address and size of the efuse registers -- clocks: a reference to the efuse core gate clock -- clock-names: must be "core" - -All properties and sub-nodes as well as the consumer bindings -defined in nvmem.txt in this directory are also supported. - - -Example: - efuse: nvmem@0 { - compatible =3D "amlogic,meson8-efuse"; - reg =3D <0x0 0x2000>; - clocks =3D <&clkc CLKID_EFUSE>; - clock-names =3D "core"; - }; --=20 2.25.1 From nobody Wed Feb 11 02:33:35 2026 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 B18D4C6FD1D for ; Tue, 4 Apr 2023 17:23:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236072AbjDDRXD (ORCPT ); Tue, 4 Apr 2023 13:23:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50816 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236037AbjDDRW5 (ORCPT ); Tue, 4 Apr 2023 13:22:57 -0400 Received: from mail-ed1-x533.google.com (mail-ed1-x533.google.com [IPv6:2a00:1450:4864:20::533]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CAF7BB4 for ; Tue, 4 Apr 2023 10:22:28 -0700 (PDT) Received: by mail-ed1-x533.google.com with SMTP id fi11so10093359edb.10 for ; Tue, 04 Apr 2023 10:22:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1680628947; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=/zfA4Ngq7HtermIaAG4T9GwFqQ9ZHFS3NDC9yUzF95k=; b=BmMTIYygMDz6GY2jOY5yj2MN6CC5PM16BRn80b1Itff+otfH1qEd58xS+gUDG79/TS 2VW8HHMcY6+YjHuehgzxg6slW+K2LgDlVKioRJm/75hAPTj/IZ2XPYqv8O9uup0ie6cT rn5a1Cx7U+KeXUMXgKCnsB+JcIFYcFHL2s6ryNcq9Z9seQYuD3Bc7NSeWsQdvEJDds0o NJ57dvdlX/orHre27yK1DIsSJMu/ITmJMft/NAtdB0X8yDO5L7Qm7MV9wk1AMN+/R1Up XRFOzmopje16dtp7CtS2Q8rYrhjkv3VS6UEccEi2iVqpclUVzQSksp+ttRdHSwxaWPUF Wgjw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680628947; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=/zfA4Ngq7HtermIaAG4T9GwFqQ9ZHFS3NDC9yUzF95k=; b=iZHt9mfgWy437BSfyv4OhQdwkl7LFBLQmtRoHujaZyuYlcdEFWDiW/5JTzaXBmoVEc PSNr2Qr9aoN/3Gdiv3E2oMs85apj1egs7v/e/QbqLkyVgA6eCl3ud20dreV5Ipivmt2j b7tjkKcYfGwGanyV7UB8HGZUnqQ9Il0BEkIDf574QtPuC8KpPVOMY9miQ3AqzIUXt93M jjsj16rNQzQiaM5RGhMxxkwHfl6y3AJJlEI+NfrzfXIk0hebWDAqUIzf6bBIhxKoEKxS zWos5tV++caw+hipmAANJZ3wT6VuRrxKsf885uW6TtEI76tRDKXCewB8mX90vxtwJJox zecw== X-Gm-Message-State: AAQBX9feHkncc9R7m5afBW2tE1rrzJUmAldBlrBpW0hRFYvmcHb93RJG 9FnYAHRLRahy/DFUm2Fzzl6ICw== X-Google-Smtp-Source: AKy350YIBC/CmKWxKauOjlMHan3AgNmWHOfzPlILmkuvYC+55t/Nwbikruk0qkG/Goo6vOpuKm58Uw== X-Received: by 2002:a17:906:817:b0:947:726e:f43a with SMTP id e23-20020a170906081700b00947726ef43amr350124ejd.23.1680628947420; Tue, 04 Apr 2023 10:22:27 -0700 (PDT) Received: from localhost.localdomain ([5.133.47.210]) by smtp.gmail.com with ESMTPSA id bv20-20020a170906b1d400b009447277c2aasm6208333ejb.39.2023.04.04.10.22.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 Apr 2023 10:22:26 -0700 (PDT) From: Srinivas Kandagatla To: gregkh@linuxfoundation.org Cc: linux-kernel@vger.kernel.org, Neil Armstrong , Krzysztof Kozlowski , Martin Blumenstingl , Srinivas Kandagatla Subject: [PATCH 05/40] dt-bindings: nvmem: convert amlogic-efuse.txt to dt-schema Date: Tue, 4 Apr 2023 18:21:13 +0100 Message-Id: <20230404172148.82422-6-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230404172148.82422-1-srinivas.kandagatla@linaro.org> References: <20230404172148.82422-1-srinivas.kandagatla@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Neil Armstrong Convert the Amlogic Meson GX eFuse bindings to dt-schema. Take in account the used variant with amlogic,meson-gx-efuse. Reviewed-by: Krzysztof Kozlowski Reviewed-by: Martin Blumenstingl Signed-off-by: Neil Armstrong Signed-off-by: Srinivas Kandagatla --- .../nvmem/amlogic,meson-gxbb-efuse.yaml | 57 +++++++++++++++++++ .../bindings/nvmem/amlogic-efuse.txt | 48 ---------------- 2 files changed, 57 insertions(+), 48 deletions(-) create mode 100644 Documentation/devicetree/bindings/nvmem/amlogic,meson-g= xbb-efuse.yaml delete mode 100644 Documentation/devicetree/bindings/nvmem/amlogic-efuse.t= xt diff --git a/Documentation/devicetree/bindings/nvmem/amlogic,meson-gxbb-efu= se.yaml b/Documentation/devicetree/bindings/nvmem/amlogic,meson-gxbb-efuse.= yaml new file mode 100644 index 000000000000..e49c2754ff55 --- /dev/null +++ b/Documentation/devicetree/bindings/nvmem/amlogic,meson-gxbb-efuse.yaml @@ -0,0 +1,57 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/nvmem/amlogic,meson-gxbb-efuse.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Amlogic Meson GX eFuse + +maintainers: + - Neil Armstrong + +allOf: + - $ref: nvmem.yaml# + +properties: + compatible: + oneOf: + - const: amlogic,meson-gxbb-efuse + - items: + - const: amlogic,meson-gx-efuse + - const: amlogic,meson-gxbb-efuse + + clocks: + maxItems: 1 + + secure-monitor: + description: phandle to the secure-monitor node + $ref: /schemas/types.yaml#/definitions/phandle + +required: + - compatible + - clocks + - secure-monitor + +unevaluatedProperties: false + +examples: + - | + efuse: efuse { + compatible =3D "amlogic,meson-gxbb-efuse"; + clocks =3D <&clk_efuse>; + #address-cells =3D <1>; + #size-cells =3D <1>; + secure-monitor =3D <&sm>; + + sn: sn@14 { + reg =3D <0x14 0x10>; + }; + + eth_mac: mac@34 { + reg =3D <0x34 0x10>; + }; + + bid: bid@46 { + reg =3D <0x46 0x30>; + }; + }; diff --git a/Documentation/devicetree/bindings/nvmem/amlogic-efuse.txt b/Do= cumentation/devicetree/bindings/nvmem/amlogic-efuse.txt deleted file mode 100644 index f7b3ed74db54..000000000000 --- a/Documentation/devicetree/bindings/nvmem/amlogic-efuse.txt +++ /dev/null @@ -1,48 +0,0 @@ -=3D Amlogic Meson GX eFuse device tree bindings =3D - -Required properties: -- compatible: should be "amlogic,meson-gxbb-efuse" -- clocks: phandle to the efuse peripheral clock provided by the - clock controller. -- secure-monitor: phandle to the secure-monitor node - -=3D Data cells =3D -Are child nodes of eFuse, bindings of which as described in -bindings/nvmem/nvmem.txt - -Example: - - efuse: efuse { - compatible =3D "amlogic,meson-gxbb-efuse"; - clocks =3D <&clkc CLKID_EFUSE>; - #address-cells =3D <1>; - #size-cells =3D <1>; - secure-monitor =3D <&sm>; - - sn: sn@14 { - reg =3D <0x14 0x10>; - }; - - eth_mac: eth_mac@34 { - reg =3D <0x34 0x10>; - }; - - bid: bid@46 { - reg =3D <0x46 0x30>; - }; - }; - - sm: secure-monitor { - compatible =3D "amlogic,meson-gxbb-sm"; - }; - -=3D Data consumers =3D -Are device nodes which consume nvmem data cells. - -For example: - - eth_mac { - ... - nvmem-cells =3D <ð_mac>; - nvmem-cell-names =3D "eth_mac"; - }; --=20 2.25.1 From nobody Wed Feb 11 02:33:35 2026 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 02F3CC761A6 for ; Tue, 4 Apr 2023 17:23:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236085AbjDDRXF (ORCPT ); Tue, 4 Apr 2023 13:23:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50630 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236042AbjDDRW6 (ORCPT ); Tue, 4 Apr 2023 13:22:58 -0400 Received: from mail-ed1-x52d.google.com (mail-ed1-x52d.google.com [IPv6:2a00:1450:4864:20::52d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3D2F255AD for ; Tue, 4 Apr 2023 10:22:30 -0700 (PDT) Received: by mail-ed1-x52d.google.com with SMTP id y4so133656962edo.2 for ; Tue, 04 Apr 2023 10:22:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1680628949; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=3WRr5ZoNNmYrvvcmB8++Bz7tz2TbhDH2e47FZUrzItY=; b=faQGny6wvH9NTbqTtJHiNEpgIZ5ncUCxiGMDBpYBuf1JjueNmg9oyH9amtFQ287jxU jwLWU+qxMMAT2oyKrIUK+i2g7wqcG3+CBpfY47Y4lKZnk1k4PNeQYEkrzcRyh8ttfjSr r7JgBE1S6zq4OFAPJwTAmuXrXiZIetaxIc7rVlYT8mAGzOdExmtE2/eJdytJrxPfkbf1 Syc4a5oOewFfo2y5DQbt34ijCa1Y8G0CbbYoSPFHhLT+x/ohFXVXyxcSePfftzzM+RgK u7IP3zN7Fgmce4hI0TqzZRiBKjw8PCErwMDi8TYVyCIcY5Fp5KHShWFfXvWeJ+spzrDs z/Gw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680628949; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=3WRr5ZoNNmYrvvcmB8++Bz7tz2TbhDH2e47FZUrzItY=; b=y4Won/g7fYdji6+oSnAMBoE24cwHmKoqmJNsXanDcKVMBOPB+efy13wdV39VFXKxe6 iNRJEvq+nbnl2sadhRkEt6VXlc73ejdmsZGuaFg3sotrt9FfES2bDVaqnbfV32S75U2y KSUM9/XMuXU1lnJ4roqdpUPhsAfNktRIzrzq3nV/48gCFrwMHhOPeOS/wLoLKLWonzM6 hela7k+xQxet7kLreladzPlubOok+0qYSskALxxwt4wNTw9qfzHnwmAcMEHf3tiIIOON knJGw19tbC0Wree0LcJSphdZuSE7zp0EnlsW9X5LWvbFwXxakcWk2Wqhnz42tt/GeIP5 pwdw== X-Gm-Message-State: AAQBX9c38HLKSYzM9DrULQClA9Zs1nkkQo0q/rEQE8473yiJtvU25SiJ Hq3IIyLyCFQv9wHDs1QW31THllp7s0W7xuZ1Bt8= X-Google-Smtp-Source: AKy350bvHQrDCRfMMD/MbptzFT7+yOCsFPu4MOplBhLqZY2raHjeWZnSvN9zGPlke75h1C6r9BpOGQ== X-Received: by 2002:a17:906:4c54:b0:947:d9b1:89a1 with SMTP id d20-20020a1709064c5400b00947d9b189a1mr285395ejw.44.1680628948847; Tue, 04 Apr 2023 10:22:28 -0700 (PDT) Received: from localhost.localdomain ([5.133.47.210]) by smtp.gmail.com with ESMTPSA id bv20-20020a170906b1d400b009447277c2aasm6208333ejb.39.2023.04.04.10.22.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 Apr 2023 10:22:28 -0700 (PDT) From: Srinivas Kandagatla To: gregkh@linuxfoundation.org Cc: linux-kernel@vger.kernel.org, Colin Ian King , Miquel Raynal , Krzysztof Kozlowski , Srinivas Kandagatla Subject: [PATCH 06/40] dt-bindings: nvmem: Fix spelling mistake "platforn" -> "platform" Date: Tue, 4 Apr 2023 18:21:14 +0100 Message-Id: <20230404172148.82422-7-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230404172148.82422-1-srinivas.kandagatla@linaro.org> References: <20230404172148.82422-1-srinivas.kandagatla@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Colin Ian King There is a spelling mistake in platforn-name. Fix it. Signed-off-by: Colin Ian King Signed-off-by: Miquel Raynal Acked-by: Krzysztof Kozlowski Signed-off-by: Srinivas Kandagatla --- .../devicetree/bindings/nvmem/layouts/onie,tlv-layout.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Documentation/devicetree/bindings/nvmem/layouts/onie,tlv-layou= t.yaml b/Documentation/devicetree/bindings/nvmem/layouts/onie,tlv-layout.ya= ml index 5a0e7671aa3f..714a6538cc7c 100644 --- a/Documentation/devicetree/bindings/nvmem/layouts/onie,tlv-layout.yaml +++ b/Documentation/devicetree/bindings/nvmem/layouts/onie,tlv-layout.yaml @@ -61,7 +61,7 @@ properties: type: object additionalProperties: false =20 - platforn-name: + platform-name: type: object additionalProperties: false =20 --=20 2.25.1 From nobody Wed Feb 11 02:33:35 2026 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 2658FC6FD1D for ; Tue, 4 Apr 2023 17:23:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236092AbjDDRXH (ORCPT ); Tue, 4 Apr 2023 13:23:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50740 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236046AbjDDRW7 (ORCPT ); Tue, 4 Apr 2023 13:22:59 -0400 Received: from mail-ed1-x531.google.com (mail-ed1-x531.google.com [IPv6:2a00:1450:4864:20::531]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B836444B5 for ; Tue, 4 Apr 2023 10:22:31 -0700 (PDT) Received: by mail-ed1-x531.google.com with SMTP id cn12so133617667edb.4 for ; Tue, 04 Apr 2023 10:22:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1680628950; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=kqPgD/iPpDsbHZcAXUeeUavFA2MxWf1NdZYvsMxlqGU=; b=kbcfXHB/OdnfMxWx68lSgdoekOL26dxAi/dLe41r/5LzrX671939MlHlLh4aHOPW5Y FJHF1j1nqKdsXeIJVbAr1NH4v/PeloFSbpblwvh9C/tSc3yChkYyIAq1MMrU9uhr0xCb 6o3mhRvWoMSi1tamKGGOPR9iMFclUbbDrlA8y4uSdNEBdTB4Shp+00vWMDzWBwfLqKib 6jy4j1rK+98L6KXUO8JICe8Pkb3iL/e89DeSP2JbnTjjNHSVZUMsSFWgmi/rFgbJn+jV dtYQ8x4hOuQeMUgmKnuNv1V1GmOFrPlpc0i/jsOT+BGK4n6bSEEz7nWB7pKzHv2x4+u7 W+cA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680628950; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=kqPgD/iPpDsbHZcAXUeeUavFA2MxWf1NdZYvsMxlqGU=; b=z6M8E/nIR74WC/QPsq8Um1u5Q02yi1zE6VeZ5r8jSJ4o/zBh1+qDbauDqGtCEKP6BD t7fxLs62NoGSArAstmnKh5M+tzteAiDzTcAtHDjgv32HH7l4UB1uat1veieOVvg4RsNs LI6Gs7yqYFK5eT+9FPbFSnpsH9/fPCl2jkSMlBsedfArYZMVSBiu+OJGPJly9CTw3SGy ePDu7mRYmt5bswpT0XpdLbT5dkPLlmevVPDYsD4HpZtHF/LnkQzef+Gdi0SmDjkiayXd XhmBKzGeFamarrMxtMF5PtCN6L8m/Grtn27DmKRNj2QIjYWOL64P6mLJ7cbhX4RPT6h0 YRAA== X-Gm-Message-State: AAQBX9dUwTBB8IuagJP0HpzF/deydBCLRD9/f5LT/8AtaN8y9Z04XdQ4 6WuMvCSmFTDptOhORw915GXd/w== X-Google-Smtp-Source: AKy350bGQLOIAitsi9vliIeBN5Wtntogmr+4OD2TvfszxOgb8Q8zWp2s14jkNLHymawXlAdyYTIJeQ== X-Received: by 2002:aa7:d809:0:b0:502:91c6:fa8f with SMTP id v9-20020aa7d809000000b0050291c6fa8fmr157668edq.42.1680628950336; Tue, 04 Apr 2023 10:22:30 -0700 (PDT) Received: from localhost.localdomain ([5.133.47.210]) by smtp.gmail.com with ESMTPSA id bv20-20020a170906b1d400b009447277c2aasm6208333ejb.39.2023.04.04.10.22.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 Apr 2023 10:22:29 -0700 (PDT) From: Srinivas Kandagatla To: gregkh@linuxfoundation.org Cc: linux-kernel@vger.kernel.org, Miquel Raynal , Rob Herring , Srinivas Kandagatla Subject: [PATCH 07/40] of: Update of_device_get_modalias() Date: Tue, 4 Apr 2023 18:21:15 +0100 Message-Id: <20230404172148.82422-8-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230404172148.82422-1-srinivas.kandagatla@linaro.org> References: <20230404172148.82422-1-srinivas.kandagatla@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Miquel Raynal This function only needs a "struct device_node" to work, but for convenience the author (and only user) of this helper did use a "struct device" and put it in device.c. Let's convert this helper to take a "struct device node" instead. This change asks for two additional changes: renaming it "of_modalias()" to fit the current naming, and moving it outside of device.c which will be done in a follow-up commit. Signed-off-by: Miquel Raynal Reviewed-by: Rob Herring Signed-off-by: Srinivas Kandagatla --- drivers/of/device.c | 29 +++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/drivers/of/device.c b/drivers/of/device.c index c91bb5899256..351c505ecb50 100644 --- a/drivers/of/device.c +++ b/drivers/of/device.c @@ -248,7 +248,7 @@ const void *of_device_get_match_data(const struct devic= e *dev) } EXPORT_SYMBOL(of_device_get_match_data); =20 -static ssize_t of_device_get_modalias(const struct device *dev, char *str,= ssize_t len) +static ssize_t of_modalias(const struct device_node *np, char *str, ssize_= t len) { const char *compat; char *c; @@ -256,19 +256,16 @@ static ssize_t of_device_get_modalias(const struct de= vice *dev, char *str, ssize ssize_t csize; ssize_t tsize; =20 - if ((!dev) || (!dev->of_node) || dev->of_node_reused) - return -ENODEV; - /* Name & Type */ /* %p eats all alphanum characters, so %c must be used here */ - csize =3D snprintf(str, len, "of:N%pOFn%c%s", dev->of_node, 'T', - of_node_get_device_type(dev->of_node)); + csize =3D snprintf(str, len, "of:N%pOFn%c%s", np, 'T', + of_node_get_device_type(np)); tsize =3D csize; len -=3D csize; if (str) str +=3D csize; =20 - of_property_for_each_string(dev->of_node, "compatible", p, compat) { + of_property_for_each_string(np, "compatible", p, compat) { csize =3D strlen(compat) + 1; tsize +=3D csize; if (csize > len) @@ -293,7 +290,10 @@ int of_device_request_module(struct device *dev) ssize_t size; int ret; =20 - size =3D of_device_get_modalias(dev, NULL, 0); + if (!dev || !dev->of_node) + return -ENODEV; + + size =3D of_modalias(dev->of_node, NULL, 0); if (size < 0) return size; =20 @@ -304,7 +304,7 @@ int of_device_request_module(struct device *dev) if (!str) return -ENOMEM; =20 - of_device_get_modalias(dev, str, size); + of_modalias(dev->of_node, str, size); str[size - 1] =3D '\0'; ret =3D request_module(str); kfree(str); @@ -321,7 +321,12 @@ EXPORT_SYMBOL_GPL(of_device_request_module); */ ssize_t of_device_modalias(struct device *dev, char *str, ssize_t len) { - ssize_t sl =3D of_device_get_modalias(dev, str, len - 2); + ssize_t sl; + + if (!dev || !dev->of_node || dev->of_node_reused) + return -ENODEV; + + sl =3D of_modalias(dev->of_node, str, len - 2); if (sl < 0) return sl; if (sl > len - 2) @@ -386,8 +391,8 @@ int of_device_uevent_modalias(const struct device *dev,= struct kobj_uevent_env * if (add_uevent_var(env, "MODALIAS=3D")) return -ENOMEM; =20 - sl =3D of_device_get_modalias(dev, &env->buf[env->buflen-1], - sizeof(env->buf) - env->buflen); + sl =3D of_modalias(dev->of_node, &env->buf[env->buflen-1], + sizeof(env->buf) - env->buflen); if (sl < 0) return sl; if (sl >=3D (sizeof(env->buf) - env->buflen)) --=20 2.25.1 From nobody Wed Feb 11 02:33:35 2026 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 5CF20C77B60 for ; Tue, 4 Apr 2023 17:23:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236114AbjDDRXK (ORCPT ); Tue, 4 Apr 2023 13:23:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50816 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236054AbjDDRW7 (ORCPT ); Tue, 4 Apr 2023 13:22:59 -0400 Received: from mail-ed1-x52f.google.com (mail-ed1-x52f.google.com [IPv6:2a00:1450:4864:20::52f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6DB3B10E6 for ; Tue, 4 Apr 2023 10:22:33 -0700 (PDT) Received: by mail-ed1-x52f.google.com with SMTP id y4so133657356edo.2 for ; Tue, 04 Apr 2023 10:22:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1680628951; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=9zAXST4Nx4xfK+O/wFtRAfJTRPqAOZA61Mnbi399eiE=; b=Ibh+vkIVA/B9MIyIeo/zKjYCCiCdU6s62YbIRrBhUlCwGqqkotTUnSLVN4UBwT3mai KgHF3f4y+mhzb4A04EsLjGgVaGPzTl3txVHpePqRLy5YT2nYAGzb5oorMrgNJPDjUJuE jU+E544BJWdDvseGmwZ4sUXx0G7jd3nqhEdhEjmQo3YeeQUqQVjGMTLSVicJNOOXJauW XGZ4sc6d2b41NGqGJHFZZ8YCmGGmyP/15xfpZk/NJAgn32J+uBzmH+fwpis3zMgjnpLH 6YBGgzBli46MfL+pvf+hve4LNWswiezvzb597ehWaHKEAGfdK88gqqfGEotRWvacUuLl GF1Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680628951; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=9zAXST4Nx4xfK+O/wFtRAfJTRPqAOZA61Mnbi399eiE=; b=lZ+/jPt2sBZ9cXk8zHjKWC8h0X4NcBunOzYN2lF7kdl9845wcDs5XhT7g4ZrNGp7WO /t90cPnmJBw99zo0ziZbjNmrwXAIRxgtKc9omd9/f/7QeWUN5COrFFvy5O72Pb6PcZNN WbwYTBIy5cOsvN5P7lC4HnXwauxqbP+V2M1UFqXcAEU0zDkuHJLQnas+6FIxDhiUPUvI OLPBcaI/RjmOyl/mWxqdVnJmJzaCwQO8QY1EaedmG0ndBNeAm7lh0OmO3pxVrqKr1kM4 P2LJK7e/o+dWvKcjeo7xkPxET3S9WRa0RuILkOxVCqdTCwohcQMCojgMo/CJZguyvGNL ZQjg== X-Gm-Message-State: AAQBX9dGQNVzlo0vjanOqd3POc8UDduIN/Vo+oIoHmfJnnDE7DUwrDZ9 kzs7yE52zH8+FLu99Xy9wCnfAQ== X-Google-Smtp-Source: AKy350bw0MoPwPqWHq9QXrOIF/s36ny2mf2pGQCIQy8RRO4DgVI4jD81qcIpPxXG7AeyXPZ8N8fzUw== X-Received: by 2002:a17:907:388:b0:93a:6c59:4247 with SMTP id ss8-20020a170907038800b0093a6c594247mr272730ejb.13.1680628951728; Tue, 04 Apr 2023 10:22:31 -0700 (PDT) Received: from localhost.localdomain ([5.133.47.210]) by smtp.gmail.com with ESMTPSA id bv20-20020a170906b1d400b009447277c2aasm6208333ejb.39.2023.04.04.10.22.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 Apr 2023 10:22:31 -0700 (PDT) From: Srinivas Kandagatla To: gregkh@linuxfoundation.org Cc: linux-kernel@vger.kernel.org, Miquel Raynal , "Rafael J . Wysocki" , Len Brown , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , Sebastian Reichel , Wolfram Sang , Mark Brown , Rob Herring , Srinivas Kandagatla Subject: [PATCH 08/40] of: Rename of_modalias_node() Date: Tue, 4 Apr 2023 18:21:16 +0100 Message-Id: <20230404172148.82422-9-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230404172148.82422-1-srinivas.kandagatla@linaro.org> References: <20230404172148.82422-1-srinivas.kandagatla@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Miquel Raynal This helper does not produce a real modalias, but tries to get the "product" compatible part of the "vendor,product" compatibles only. It is far from creating a purely useful modalias string and does not seem to be used like that directly anyway, so let's try to give this helper a more meaningful name before moving there a real modalias helper (already existing under of/device.c). Also update the various documentations to refer to the strings as "aliases" rather than "modaliases" which has a real meaning in the Linux kernel. There is no functional change. Cc: Rafael J. Wysocki Cc: Len Brown Cc: Maarten Lankhorst Cc: Maxime Ripard Cc: Thomas Zimmermann Cc: Sebastian Reichel Cc: Wolfram Sang Cc: Mark Brown Signed-off-by: Miquel Raynal Reviewed-by: Rob Herring Acked-by: Mark Brown Signed-off-by: Srinivas Kandagatla Acked-by: Sebastian Reichel --- drivers/acpi/bus.c | 7 ++++--- drivers/gpu/drm/drm_mipi_dsi.c | 2 +- drivers/hsi/hsi_core.c | 2 +- drivers/i2c/busses/i2c-powermac.c | 2 +- drivers/i2c/i2c-core-of.c | 2 +- drivers/of/base.c | 18 +++++++++++------- drivers/spi/spi.c | 4 ++-- include/linux/of.h | 3 ++- 8 files changed, 23 insertions(+), 17 deletions(-) diff --git a/drivers/acpi/bus.c b/drivers/acpi/bus.c index 9531dd0fef50..fc74c786a867 100644 --- a/drivers/acpi/bus.c +++ b/drivers/acpi/bus.c @@ -817,9 +817,10 @@ static bool acpi_of_modalias(struct acpi_device *adev, * @modalias: Pointer to buffer that modalias value will be copied into * @len: Length of modalias buffer * - * This is a counterpart of of_modalias_node() for struct acpi_device obje= cts. - * If there is a compatible string for @adev, it will be copied to @modali= as - * with the vendor prefix stripped; otherwise, @default_id will be used. + * This is a counterpart of of_alias_from_compatible() for struct acpi_dev= ice + * objects. If there is a compatible string for @adev, it will be copied to + * @modalias with the vendor prefix stripped; otherwise, @default_id will = be + * used. */ void acpi_set_modalias(struct acpi_device *adev, const char *default_id, char *modalias, size_t len) diff --git a/drivers/gpu/drm/drm_mipi_dsi.c b/drivers/gpu/drm/drm_mipi_dsi.c index b41aaf2bb9f1..b62f5e4425f4 100644 --- a/drivers/gpu/drm/drm_mipi_dsi.c +++ b/drivers/gpu/drm/drm_mipi_dsi.c @@ -160,7 +160,7 @@ of_mipi_dsi_device_add(struct mipi_dsi_host *host, stru= ct device_node *node) int ret; u32 reg; =20 - if (of_modalias_node(node, info.type, sizeof(info.type)) < 0) { + if (of_alias_from_compatible(node, info.type, sizeof(info.type)) < 0) { drm_err(host, "modalias failure on %pOF\n", node); return ERR_PTR(-EINVAL); } diff --git a/drivers/hsi/hsi_core.c b/drivers/hsi/hsi_core.c index 8fda8f1d064d..acbf82f755a8 100644 --- a/drivers/hsi/hsi_core.c +++ b/drivers/hsi/hsi_core.c @@ -207,7 +207,7 @@ static void hsi_add_client_from_dt(struct hsi_port *por= t, if (!cl) return; =20 - err =3D of_modalias_node(client, name, sizeof(name)); + err =3D of_alias_from_compatible(client, name, sizeof(name)); if (err) goto err; =20 diff --git a/drivers/i2c/busses/i2c-powermac.c b/drivers/i2c/busses/i2c-pow= ermac.c index 2e74747eec9c..ec706a3aba26 100644 --- a/drivers/i2c/busses/i2c-powermac.c +++ b/drivers/i2c/busses/i2c-powermac.c @@ -284,7 +284,7 @@ static bool i2c_powermac_get_type(struct i2c_adapter *a= dap, */ =20 /* First try proper modalias */ - if (of_modalias_node(node, tmp, sizeof(tmp)) >=3D 0) { + if (of_alias_from_compatible(node, tmp, sizeof(tmp)) >=3D 0) { snprintf(type, type_size, "MAC,%s", tmp); return true; } diff --git a/drivers/i2c/i2c-core-of.c b/drivers/i2c/i2c-core-of.c index bce6b796e04c..8941a30574e3 100644 --- a/drivers/i2c/i2c-core-of.c +++ b/drivers/i2c/i2c-core-of.c @@ -27,7 +27,7 @@ int of_i2c_get_board_info(struct device *dev, struct devi= ce_node *node, =20 memset(info, 0, sizeof(*info)); =20 - if (of_modalias_node(node, info->type, sizeof(info->type)) < 0) { + if (of_alias_from_compatible(node, info->type, sizeof(info->type)) < 0) { dev_err(dev, "of_i2c: modalias failure on %pOF\n", node); return -EINVAL; } diff --git a/drivers/of/base.c b/drivers/of/base.c index ac6fde53342f..161fe3192c46 100644 --- a/drivers/of/base.c +++ b/drivers/of/base.c @@ -1208,19 +1208,23 @@ struct device_node *of_find_matching_node_and_match= (struct device_node *from, EXPORT_SYMBOL(of_find_matching_node_and_match); =20 /** - * of_modalias_node - Lookup appropriate modalias for a device node + * of_alias_from_compatible - Lookup appropriate alias for a device node + * depending on compatible * @node: pointer to a device tree node - * @modalias: Pointer to buffer that modalias value will be copied into - * @len: Length of modalias value + * @alias: Pointer to buffer that alias value will be copied into + * @len: Length of alias value * * Based on the value of the compatible property, this routine will attempt - * to choose an appropriate modalias value for a particular device tree no= de. + * to choose an appropriate alias value for a particular device tree node. * It does this by stripping the manufacturer prefix (as delimited by a ',= ') * from the first entry in the compatible list property. * + * Note: The matching on just the "product" side of the compatible is a re= lic + * from I2C and SPI. Please do not add any new user. + * * Return: This routine returns 0 on success, <0 on failure. */ -int of_modalias_node(struct device_node *node, char *modalias, int len) +int of_alias_from_compatible(const struct device_node *node, char *alias, = int len) { const char *compatible, *p; int cplen; @@ -1229,10 +1233,10 @@ int of_modalias_node(struct device_node *node, char= *modalias, int len) if (!compatible || strlen(compatible) > cplen) return -ENODEV; p =3D strchr(compatible, ','); - strscpy(modalias, p ? p + 1 : compatible, len); + strscpy(alias, p ? p + 1 : compatible, len); return 0; } -EXPORT_SYMBOL_GPL(of_modalias_node); +EXPORT_SYMBOL_GPL(of_alias_from_compatible); =20 /** * of_find_node_by_phandle - Find a node given a phandle diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c index 44b85a8d47f1..3bbdc5fe3b99 100644 --- a/drivers/spi/spi.c +++ b/drivers/spi/spi.c @@ -2354,8 +2354,8 @@ of_register_spi_device(struct spi_controller *ctlr, s= truct device_node *nc) } =20 /* Select device driver */ - rc =3D of_modalias_node(nc, spi->modalias, - sizeof(spi->modalias)); + rc =3D of_alias_from_compatible(nc, spi->modalias, + sizeof(spi->modalias)); if (rc < 0) { dev_err(&ctlr->dev, "cannot find modalias for %pOF\n", nc); goto err_out; diff --git a/include/linux/of.h b/include/linux/of.h index 0af611307db2..b1eea8569043 100644 --- a/include/linux/of.h +++ b/include/linux/of.h @@ -373,7 +373,8 @@ extern int of_n_addr_cells(struct device_node *np); extern int of_n_size_cells(struct device_node *np); extern const struct of_device_id *of_match_node( const struct of_device_id *matches, const struct device_node *node); -extern int of_modalias_node(struct device_node *node, char *modalias, int = len); +extern int of_alias_from_compatible(const struct device_node *node, char *= alias, + int len); extern void of_print_phandle_args(const char *msg, const struct of_phandle= _args *args); extern int __of_parse_phandle_with_args(const struct device_node *np, const char *list_name, const char *cells_name, int cell_count, --=20 2.25.1 From nobody Wed Feb 11 02:33:35 2026 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 A4CB4C761A6 for ; Tue, 4 Apr 2023 17:23:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236128AbjDDRXO (ORCPT ); Tue, 4 Apr 2023 13:23:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50998 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236060AbjDDRXA (ORCPT ); Tue, 4 Apr 2023 13:23:00 -0400 Received: from mail-ed1-x52a.google.com (mail-ed1-x52a.google.com [IPv6:2a00:1450:4864:20::52a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1CFE14488 for ; Tue, 4 Apr 2023 10:22:35 -0700 (PDT) Received: by mail-ed1-x52a.google.com with SMTP id r11so133617703edd.5 for ; Tue, 04 Apr 2023 10:22:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1680628953; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=cHXEBUu03ZPDI2Y2TmpsJOeJIjzDeMVBiDxI7vjmsio=; b=QlvyO1b5i+CWF9n/nzyWW7U8kMHzBMEVcl8Ci8vbS4G00VmYy/XpaV9UY8ZzQP/4NF X5UTTTXUaqGGNoOfzVy7w5Ef5kylSUs63+a5mW/svhU1DLiws7xi5YnZ2A2zoH4yWyIX yBhNXHAXFdgq60946UP0w1BnOhPIFH4uMjMb6s6q1Q+Qe05Ss73NtnNfum/+97hEyzu7 Ws2mxuXfyvXlgg8y+sRmaIF+YyywHnNVSpnzHxKnr1Hy2RUylDaphmqcvHIUiSK0M/1h K72kYQaDs17epgIT15sck27TxV5ChHNmEYqDbXhhBZzs4z1/C8HOylyso9tIrzr3JtkY YQzw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680628953; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=cHXEBUu03ZPDI2Y2TmpsJOeJIjzDeMVBiDxI7vjmsio=; b=5iKRLJZo5ZioETkFEmaMqqcae9cgusvlRSYw0K9Bh6MDJGyDmuKaArsWgsdzJRqkfC 7ObRq+fjkNhUGaOdTKiUXayQGNfr4+uoP0pVt3oGY+iAAW1lZKS57FcvXq4f9gbuI2dF 591sgYYBNMKKS3Weh0wOf/rUu+hSGsGBnyj41onTbhzUe7pasbgNcUzcK3KbrMri3Mss tkizT4yZKDrHrqK4eOOv/gfk7qNRjl/gublgrMBbSMXM2JFUe1RYKPvwamkiL/Seh7EK rVJ/W58GToxB0bbvZasjagLcv3ENj86mTgx8c35Nr8y9H+eScXuh1vE4sE1MXfToLtWF n0TA== X-Gm-Message-State: AAQBX9eyYsZGvb/GNQHigv3IT0jjADGuMRzkYX1V7tCTPJm+xhT2zmbc xMM1lImSx5r3kOOMpWUro2q7yA== X-Google-Smtp-Source: AKy350YK/GZj9d6N44hQ/eTmvOypMDIkei2W2xWccEP+HB2eDd1sK/Es/XgfY1iaTzEh7QLs2ntpog== X-Received: by 2002:aa7:c1c9:0:b0:4fd:20ee:225d with SMTP id d9-20020aa7c1c9000000b004fd20ee225dmr197136edp.24.1680628953652; Tue, 04 Apr 2023 10:22:33 -0700 (PDT) Received: from localhost.localdomain ([5.133.47.210]) by smtp.gmail.com with ESMTPSA id bv20-20020a170906b1d400b009447277c2aasm6208333ejb.39.2023.04.04.10.22.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 Apr 2023 10:22:32 -0700 (PDT) From: Srinivas Kandagatla To: gregkh@linuxfoundation.org Cc: linux-kernel@vger.kernel.org, Miquel Raynal , Rob Herring , Rob Herring , Srinivas Kandagatla Subject: [PATCH 09/40] of: Move of_modalias() to module.c Date: Tue, 4 Apr 2023 18:21:17 +0100 Message-Id: <20230404172148.82422-10-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230404172148.82422-1-srinivas.kandagatla@linaro.org> References: <20230404172148.82422-1-srinivas.kandagatla@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Miquel Raynal Create a specific .c file for OF related module handling. Move of_modalias() inside as a first step. The helper is exposed through of.h even though it is only used by core files because the users from device.c will soon be split into an OF-only helper in module.c as well as a device-oriented inline helper in of_device.h. Putting this helper in of_private.h would require to include of_private.h from of_device.h, which is not acceptable. Suggested-by: Rob Herring Signed-off-by: Miquel Raynal Reviewed-by: Rob Herring Signed-off-by: Srinivas Kandagatla --- drivers/of/Makefile | 2 +- drivers/of/device.c | 37 ------------------------------------- drivers/of/module.c | 44 ++++++++++++++++++++++++++++++++++++++++++++ include/linux/of.h | 9 +++++++++ 4 files changed, 54 insertions(+), 38 deletions(-) create mode 100644 drivers/of/module.c diff --git a/drivers/of/Makefile b/drivers/of/Makefile index e0360a44306e..ae9923fd2940 100644 --- a/drivers/of/Makefile +++ b/drivers/of/Makefile @@ -1,5 +1,5 @@ # SPDX-License-Identifier: GPL-2.0 -obj-y =3D base.o device.o platform.o property.o +obj-y =3D base.o device.o module.o platform.o property.o obj-$(CONFIG_OF_KOBJ) +=3D kobj.o obj-$(CONFIG_OF_DYNAMIC) +=3D dynamic.o obj-$(CONFIG_OF_FLATTREE) +=3D fdt.o diff --git a/drivers/of/device.c b/drivers/of/device.c index 351c505ecb50..7183cfd754db 100644 --- a/drivers/of/device.c +++ b/drivers/of/device.c @@ -1,5 +1,4 @@ // SPDX-License-Identifier: GPL-2.0 -#include #include #include #include @@ -248,42 +247,6 @@ const void *of_device_get_match_data(const struct devi= ce *dev) } EXPORT_SYMBOL(of_device_get_match_data); =20 -static ssize_t of_modalias(const struct device_node *np, char *str, ssize_= t len) -{ - const char *compat; - char *c; - struct property *p; - ssize_t csize; - ssize_t tsize; - - /* Name & Type */ - /* %p eats all alphanum characters, so %c must be used here */ - csize =3D snprintf(str, len, "of:N%pOFn%c%s", np, 'T', - of_node_get_device_type(np)); - tsize =3D csize; - len -=3D csize; - if (str) - str +=3D csize; - - of_property_for_each_string(np, "compatible", p, compat) { - csize =3D strlen(compat) + 1; - tsize +=3D csize; - if (csize > len) - continue; - - csize =3D snprintf(str, len, "C%s", compat); - for (c =3D str; c; ) { - c =3D strchr(c, ' '); - if (c) - *c++ =3D '_'; - } - len -=3D csize; - str +=3D csize; - } - - return tsize; -} - int of_device_request_module(struct device *dev) { char *str; diff --git a/drivers/of/module.c b/drivers/of/module.c new file mode 100644 index 000000000000..4c59752bc8d6 --- /dev/null +++ b/drivers/of/module.c @@ -0,0 +1,44 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Linux kernel module helpers. + */ + +#include +#include +#include + +ssize_t of_modalias(const struct device_node *np, char *str, ssize_t len) +{ + const char *compat; + char *c; + struct property *p; + ssize_t csize; + ssize_t tsize; + + /* Name & Type */ + /* %p eats all alphanum characters, so %c must be used here */ + csize =3D snprintf(str, len, "of:N%pOFn%c%s", np, 'T', + of_node_get_device_type(np)); + tsize =3D csize; + len -=3D csize; + if (str) + str +=3D csize; + + of_property_for_each_string(np, "compatible", p, compat) { + csize =3D strlen(compat) + 1; + tsize +=3D csize; + if (csize > len) + continue; + + csize =3D snprintf(str, len, "C%s", compat); + for (c =3D str; c; ) { + c =3D strchr(c, ' '); + if (c) + *c++ =3D '_'; + } + len -=3D csize; + str +=3D csize; + } + + return tsize; +} diff --git a/include/linux/of.h b/include/linux/of.h index b1eea8569043..be26c7e8ef9e 100644 --- a/include/linux/of.h +++ b/include/linux/of.h @@ -385,6 +385,9 @@ extern int of_parse_phandle_with_args_map(const struct = device_node *np, extern int of_count_phandle_with_args(const struct device_node *np, const char *list_name, const char *cells_name); =20 +/* module functions */ +extern ssize_t of_modalias(const struct device_node *np, char *str, ssize_= t len); + /* phandle iterator functions */ extern int of_phandle_iterator_init(struct of_phandle_iterator *it, const struct device_node *np, @@ -742,6 +745,12 @@ static inline int of_count_phandle_with_args(const str= uct device_node *np, return -ENOSYS; } =20 +static inline ssize_t of_modalias(const struct device_node *np, char *str, + ssize_t len) +{ + return -ENODEV; +} + static inline int of_phandle_iterator_init(struct of_phandle_iterator *it, const struct device_node *np, const char *list_name, --=20 2.25.1 From nobody Wed Feb 11 02:33:35 2026 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 53FC5C6FD1D for ; Tue, 4 Apr 2023 17:23:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236133AbjDDRXR (ORCPT ); Tue, 4 Apr 2023 13:23:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50742 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236065AbjDDRXB (ORCPT ); Tue, 4 Apr 2023 13:23:01 -0400 Received: from mail-ed1-x52a.google.com (mail-ed1-x52a.google.com [IPv6:2a00:1450:4864:20::52a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9F0DC4687 for ; Tue, 4 Apr 2023 10:22:36 -0700 (PDT) Received: by mail-ed1-x52a.google.com with SMTP id ek18so133632969edb.6 for ; Tue, 04 Apr 2023 10:22:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1680628955; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=b0yKnw9nXKYVaFHn5olSAf00S375pzRbEb0HhrzPylE=; b=d/vq4KgvL2/h/ziRCZW1cqyulvHodNQXjKQwHAOT1K76ObCCR5b5FjbqxG8JTUXNFI k/FnMf5tNUjxKJQaGuJGhu36t4xYrTFlJkpjpVpdI0e6QPoV28RknJJqDfStpLqVU5JZ UAPilvg8Z3+gX3e4zaOy2NjHBS67QwyeehB6bm3i/Rs8zkFESEeplqe3oiwuqI6DoO5Y EpukhA2vzPf98mwHtQG3q1fGkZqC+FNNteWf/P3V3sGyzSNN3MPNr4zOHKMmoNRy4LZm ePCsbFlBQiiqkU3KMOveRk/460hqLTMOEtyT4DIHnQkRv7HXXIt4spVsiThLgYLZ1okp r5xw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680628955; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=b0yKnw9nXKYVaFHn5olSAf00S375pzRbEb0HhrzPylE=; b=h2KmgTx0qvISLQjXQlK+tCwF6WFPujI2btbcNFJftUm6poS2yUdiqxCwqp/XBOlrZw 05d/e68AevSCXbSVEXnEwC1P00JN/c7irKcZMbNCyb+1S6Ju+qXxSQ0/uRuybBxZyV+I bjC9WX9F3lQ/Pi70zPdUaA07PxxNK0pH+rVTO4UAQeK17GudrgreFHyRST+8NwaOIxj3 ikjS34uZ7Ympak4cXvnyEPuOXsm2gsS2ZTDIDsRJUBsIHDdjcOmUcpCr+8ktQAo10+Yh UwunEOb4sr9chsCft0cYVl2gKpkMkRcz4uq1/IEyWlQ2MEfw5IIbBkvMXQfEWuBtrpSB Rcsw== X-Gm-Message-State: AAQBX9fcWQMBvsDk3ml2vyd7cEPeIgRmag/rBPksQE/KR0XfMr3gaOZe RkE0wvmAtAsuQT/HhfWlWoklCaSMPicPleK0mzQ= X-Google-Smtp-Source: AKy350YTG31WbJATDfw4xGE11Wbbtm/w2I4xRJabYhCZVBWP8duVGW3AqT/TS57WNnr0MEJiFNX3Rg== X-Received: by 2002:aa7:c64a:0:b0:4fd:1f7b:9fbd with SMTP id z10-20020aa7c64a000000b004fd1f7b9fbdmr62683edr.6.1680628955044; Tue, 04 Apr 2023 10:22:35 -0700 (PDT) Received: from localhost.localdomain ([5.133.47.210]) by smtp.gmail.com with ESMTPSA id bv20-20020a170906b1d400b009447277c2aasm6208333ejb.39.2023.04.04.10.22.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 Apr 2023 10:22:34 -0700 (PDT) From: Srinivas Kandagatla To: gregkh@linuxfoundation.org Cc: linux-kernel@vger.kernel.org, Miquel Raynal , Rob Herring , Srinivas Kandagatla Subject: [PATCH 10/40] of: Move the request module helper logic to module.c Date: Tue, 4 Apr 2023 18:21:18 +0100 Message-Id: <20230404172148.82422-11-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230404172148.82422-1-srinivas.kandagatla@linaro.org> References: <20230404172148.82422-1-srinivas.kandagatla@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Miquel Raynal Depending on device.c for pure OF handling is considered backwards. Let's extract the content of of_device_request_module() to have the real logic under module.c. The next step will be to convert users of of_device_request_module() to use the new helper. Signed-off-by: Miquel Raynal Reviewed-by: Rob Herring Signed-off-by: Srinivas Kandagatla --- drivers/of/device.c | 25 ++----------------------- drivers/of/module.c | 30 ++++++++++++++++++++++++++++++ include/linux/of.h | 6 ++++++ 3 files changed, 38 insertions(+), 23 deletions(-) diff --git a/drivers/of/device.c b/drivers/of/device.c index 7183cfd754db..874a2e1f6308 100644 --- a/drivers/of/device.c +++ b/drivers/of/device.c @@ -8,7 +8,6 @@ #include /* for bus_dma_region */ #include #include -#include #include #include #include @@ -249,30 +248,10 @@ EXPORT_SYMBOL(of_device_get_match_data); =20 int of_device_request_module(struct device *dev) { - char *str; - ssize_t size; - int ret; - - if (!dev || !dev->of_node) + if (!dev) return -ENODEV; =20 - size =3D of_modalias(dev->of_node, NULL, 0); - if (size < 0) - return size; - - /* Reserve an additional byte for the trailing '\0' */ - size++; - - str =3D kmalloc(size, GFP_KERNEL); - if (!str) - return -ENOMEM; - - of_modalias(dev->of_node, str, size); - str[size - 1] =3D '\0'; - ret =3D request_module(str); - kfree(str); - - return ret; + return of_request_module(dev->of_node); } EXPORT_SYMBOL_GPL(of_device_request_module); =20 diff --git a/drivers/of/module.c b/drivers/of/module.c index 4c59752bc8d6..0e8aa974f0f2 100644 --- a/drivers/of/module.c +++ b/drivers/of/module.c @@ -4,6 +4,7 @@ */ =20 #include +#include #include #include =20 @@ -42,3 +43,32 @@ ssize_t of_modalias(const struct device_node *np, char *= str, ssize_t len) =20 return tsize; } + +int of_request_module(const struct device_node *np) +{ + char *str; + ssize_t size; + int ret; + + if (!np) + return -ENODEV; + + size =3D of_modalias(np, NULL, 0); + if (size < 0) + return size; + + /* Reserve an additional byte for the trailing '\0' */ + size++; + + str =3D kmalloc(size, GFP_KERNEL); + if (!str) + return -ENOMEM; + + of_modalias(np, str, size); + str[size - 1] =3D '\0'; + ret =3D request_module(str); + kfree(str); + + return ret; +} +EXPORT_SYMBOL_GPL(of_request_module); diff --git a/include/linux/of.h b/include/linux/of.h index be26c7e8ef9e..9b7a99499ef3 100644 --- a/include/linux/of.h +++ b/include/linux/of.h @@ -387,6 +387,7 @@ extern int of_count_phandle_with_args(const struct devi= ce_node *np, =20 /* module functions */ extern ssize_t of_modalias(const struct device_node *np, char *str, ssize_= t len); +extern int of_request_module(const struct device_node *np); =20 /* phandle iterator functions */ extern int of_phandle_iterator_init(struct of_phandle_iterator *it, @@ -751,6 +752,11 @@ static inline ssize_t of_modalias(const struct device_= node *np, char *str, return -ENODEV; } =20 +static inline int of_request_module(const struct device_node *np) +{ + return -ENODEV; +} + static inline int of_phandle_iterator_init(struct of_phandle_iterator *it, const struct device_node *np, const char *list_name, --=20 2.25.1 From nobody Wed Feb 11 02:33:35 2026 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 4D2C4C6FD1D for ; Tue, 4 Apr 2023 17:23:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236138AbjDDRXU (ORCPT ); Tue, 4 Apr 2023 13:23:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51130 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236044AbjDDRXB (ORCPT ); Tue, 4 Apr 2023 13:23:01 -0400 Received: from mail-ed1-x529.google.com (mail-ed1-x529.google.com [IPv6:2a00:1450:4864:20::529]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0746D49FE for ; Tue, 4 Apr 2023 10:22:38 -0700 (PDT) Received: by mail-ed1-x529.google.com with SMTP id eh3so133535940edb.11 for ; Tue, 04 Apr 2023 10:22:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1680628956; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Ri+KMEjNpTYZIPFjCFx+/7TZlMVFVOLpk39qoMQAgfg=; b=g47Eyvoz8Tk4i6j/vn+dxRpCAVTVdVE4TXuZg8PzIVfppbGwgy0MDR4Q77wPYhebqR VhvVS0bNDuSwevinLOYXyqQyXo03ehN1IlnCR1AIOYDR9MZo8Ql/6J+MjQcER2clQCZV FIvzBf0BdZbsBozUTG0hKqW+1xLjW603Lr5n/L8TCBqLe7L6/idbTNC2yEcajq+ldAv6 y2IKQKF+OH6QEBwXdd/5DAaSxnyDXpjhq4d4uRmSn2K5ZBGsNWHTz7Lq1HutUidrzzFB Vtj9GOMms3yPOeOEVjcQRyxSEYY9D/Cct9YQ98WFbwmuJOWo3uPaCrCv//Kjsxec4yrN GJFw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680628956; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Ri+KMEjNpTYZIPFjCFx+/7TZlMVFVOLpk39qoMQAgfg=; b=Q82n4nxq8hKyUjLNENe3/3p90okUst75x6WLHkdnKAMBAq+XIkc3XvtZN0+qN3Zi18 wrmqdkc3alI/4PU3K4PdTPMNjFUSd44eCSSrNLvtnwoLx88RIWJTi9kkdE/U1BffBw4R KtUpERFzlP4UEU693vRndWofhJo14y18odIC+Mo1vKGw35U0iugT6Y2HoARkQ2JDy/YD MUxqVw3vDbX/u+7gdMeoJtYyKCwvkdUipEFPY30nxCIKgRLj31JzhCwfkKrtSkfftuwZ RZc+dc0D4khUXDQuNUZ+TAbkVG9kGqbtqqd3HdPujhSzOi5NtLCxyVpGRGkMsJeCqc6R 18Xg== X-Gm-Message-State: AAQBX9eJRpJBatRAFHEV/AgTKR2jeV3Uao+Eu+8I9a/zeiwg079HViLW gJjzenGARVXhj/4ZyVOreaS1CQ== X-Google-Smtp-Source: AKy350Zu1ynxaL+pFI0WvSJjMsGmvmskIY7obMu4Bm5IQbZ86beTly4vL4lxC2Xyzvj2TgNUA+AwwA== X-Received: by 2002:a17:906:3e06:b0:930:3840:1c4d with SMTP id k6-20020a1709063e0600b0093038401c4dmr325039eji.32.1680628956558; Tue, 04 Apr 2023 10:22:36 -0700 (PDT) Received: from localhost.localdomain ([5.133.47.210]) by smtp.gmail.com with ESMTPSA id bv20-20020a170906b1d400b009447277c2aasm6208333ejb.39.2023.04.04.10.22.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 Apr 2023 10:22:35 -0700 (PDT) From: Srinivas Kandagatla To: gregkh@linuxfoundation.org Cc: linux-kernel@vger.kernel.org, Miquel Raynal , Heikki Krogerus , Rob Herring , Srinivas Kandagatla Subject: [PATCH 11/40] usb: ulpi: Use of_request_module() Date: Tue, 4 Apr 2023 18:21:19 +0100 Message-Id: <20230404172148.82422-12-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230404172148.82422-1-srinivas.kandagatla@linaro.org> References: <20230404172148.82422-1-srinivas.kandagatla@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Miquel Raynal There is a new helper supposed to replace of_device_request_module(), called of_request_module(). They are both strictly equivalent, besides the fact the latter receives a "struct device_node" directly. Use it. Cc: Heikki Krogerus Cc: Greg Kroah-Hartman Signed-off-by: Miquel Raynal Acked-by: Rob Herring Acked-by: Heikki Krogerus Signed-off-by: Srinivas Kandagatla --- drivers/usb/common/ulpi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/usb/common/ulpi.c b/drivers/usb/common/ulpi.c index a98b2108376a..6977cf380838 100644 --- a/drivers/usb/common/ulpi.c +++ b/drivers/usb/common/ulpi.c @@ -229,7 +229,7 @@ static int ulpi_read_id(struct ulpi *ulpi) request_module("ulpi:v%04xp%04x", ulpi->id.vendor, ulpi->id.product); return 0; err: - of_device_request_module(&ulpi->dev); + of_request_module(ulpi->dev.of_node); return 0; } =20 --=20 2.25.1 From nobody Wed Feb 11 02:33:35 2026 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 31C4AC77B60 for ; Tue, 4 Apr 2023 17:23:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236144AbjDDRXX (ORCPT ); Tue, 4 Apr 2023 13:23:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50904 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236037AbjDDRXE (ORCPT ); Tue, 4 Apr 2023 13:23:04 -0400 Received: from mail-ed1-x535.google.com (mail-ed1-x535.google.com [IPv6:2a00:1450:4864:20::535]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F30444C31 for ; Tue, 4 Apr 2023 10:22:39 -0700 (PDT) Received: by mail-ed1-x535.google.com with SMTP id eg48so133479556edb.13 for ; Tue, 04 Apr 2023 10:22:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1680628958; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=noPcVt8MFW5+Mm9H/HyU71uvDzzOIqHZ/NpeCMsQhko=; b=iLfxn/uxA0aYPa9LCLk2Vg6ug1TsTBWbvbl4cNXqH02+8X+95m/w83e9Ib2ruwpCGn cc9PUVjXKz7rfIJxhvovXLBU/9mxiS2YVIxFAMZ1pbJgVGf+/mN9MteI1M366YqZG3fx HvBdQEW/DRVerX+aRbMYL6SPo5B+g5iO4qoL9BLptnMT6ii3JQz3h57KofRnYwwbBO/Q AZTRa+41MMrSq6LAACKltVSesbODBnw2t3o85WCT9G1O9wUcCrv9KuoCH8Z0XGaBowxS hCGPKdpFC4J3/Bju3F20SEIo+4fMq7nDYGsc0YqS5ddItnVUEMQPxAGuk/tpp4XuLQv8 jU7w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680628958; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=noPcVt8MFW5+Mm9H/HyU71uvDzzOIqHZ/NpeCMsQhko=; b=tLRRA0V0D4LZcvuJ9R8c/94cbJ1it1EqhWMLA8CDR4LZGtLgTRZ6ZztoCyVQfSEokR 0ndqtfoE1/YO5irY09pPisou3FzpiWYoT90EF6qzevAEzv+28WAcUklbm1bFxF9f9EiF 7oxbYAHm9yhlh5UFmqvz2P6xAeFxAbUuawINka7yM9M4ne9McoEjaTdfaEpcGPtvpWE/ biJA2D08UloV4t3dNSsIFgm4BWSgWinlNqrCRQVIsr6vZO9YrHh547TzERsM9P1RU3fa QakMwBQ+T8BvYhdgDx5koSpW/GFH86g4BazejNxc1d3ajtegH8rQW5isQozGPZ2e7cei GMGw== X-Gm-Message-State: AAQBX9eMdBPp10XtqP038WNhoRVi10XReUTAFQqSHRg2tYGmAdpmbESq juEQ2bAVRJt87yw6ii2NUHCKOA== X-Google-Smtp-Source: AKy350aUnCsI0OW1OMpIgQDSjnqYbtKtqCZcgg9rd1TRcPNCj+b3Vy0Uk3G5nRLYrzTMgARThTuMCg== X-Received: by 2002:a17:906:1714:b0:932:290d:12e4 with SMTP id c20-20020a170906171400b00932290d12e4mr324013eje.25.1680628958467; Tue, 04 Apr 2023 10:22:38 -0700 (PDT) Received: from localhost.localdomain ([5.133.47.210]) by smtp.gmail.com with ESMTPSA id bv20-20020a170906b1d400b009447277c2aasm6208333ejb.39.2023.04.04.10.22.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 Apr 2023 10:22:37 -0700 (PDT) From: Srinivas Kandagatla To: gregkh@linuxfoundation.org Cc: linux-kernel@vger.kernel.org, Miquel Raynal , Rob Herring , Srinivas Kandagatla Subject: [PATCH 12/40] of: device: Kill of_device_request_module() Date: Tue, 4 Apr 2023 18:21:20 +0100 Message-Id: <20230404172148.82422-13-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230404172148.82422-1-srinivas.kandagatla@linaro.org> References: <20230404172148.82422-1-srinivas.kandagatla@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Miquel Raynal A new helper has been introduced, of_request_module(). Users have been converted, this helper can now be deleted. Signed-off-by: Miquel Raynal Reviewed-by: Rob Herring Signed-off-by: Srinivas Kandagatla --- drivers/of/device.c | 9 --------- include/linux/of_device.h | 6 ------ 2 files changed, 15 deletions(-) diff --git a/drivers/of/device.c b/drivers/of/device.c index 874a2e1f6308..0f00f1b80708 100644 --- a/drivers/of/device.c +++ b/drivers/of/device.c @@ -246,15 +246,6 @@ const void *of_device_get_match_data(const struct devi= ce *dev) } EXPORT_SYMBOL(of_device_get_match_data); =20 -int of_device_request_module(struct device *dev) -{ - if (!dev) - return -ENODEV; - - return of_request_module(dev->of_node); -} -EXPORT_SYMBOL_GPL(of_device_request_module); - /** * of_device_modalias - Fill buffer with newline terminated modalias string * @dev: Calling device diff --git a/include/linux/of_device.h b/include/linux/of_device.h index f4b57614979d..ce20d8b00b3e 100644 --- a/include/linux/of_device.h +++ b/include/linux/of_device.h @@ -33,7 +33,6 @@ extern void of_device_unregister(struct platform_device *= ofdev); extern const void *of_device_get_match_data(const struct device *dev); =20 extern ssize_t of_device_modalias(struct device *dev, char *str, ssize_t l= en); -extern int of_device_request_module(struct device *dev); =20 extern void of_device_uevent(const struct device *dev, struct kobj_uevent_= env *env); extern int of_device_uevent_modalias(const struct device *dev, struct kobj= _uevent_env *env); @@ -78,11 +77,6 @@ static inline int of_device_modalias(struct device *dev, return -ENODEV; } =20 -static inline int of_device_request_module(struct device *dev) -{ - return -ENODEV; -} - static inline int of_device_uevent_modalias(const struct device *dev, struct kobj_uevent_env *env) { --=20 2.25.1 From nobody Wed Feb 11 02:33:35 2026 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 2A178C6FD1D for ; Tue, 4 Apr 2023 17:23:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236095AbjDDRXe (ORCPT ); Tue, 4 Apr 2023 13:23:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50916 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236080AbjDDRXE (ORCPT ); Tue, 4 Apr 2023 13:23:04 -0400 Received: from mail-ed1-x52b.google.com (mail-ed1-x52b.google.com [IPv6:2a00:1450:4864:20::52b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 862D35256 for ; Tue, 4 Apr 2023 10:22:41 -0700 (PDT) Received: by mail-ed1-x52b.google.com with SMTP id w9so133609400edc.3 for ; Tue, 04 Apr 2023 10:22:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1680628960; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=O4ioddbo3fPVVoSSJtNMis6LcQmvA1VnyLgc3Z68hdE=; b=OkQc39UZKZijIMajzFKQO1LWfd2B4yvTgDetqeBHtIO7McHJ+FxDF9qbib9cd9S4Vy frc4HGjikiN1tB6ktxjGBtYoYQfaVsxnZYREJVS8I/VuMMeNb3U3R2/s3+7fUzApq31q x3D3zpfxEkYZV13wSw3mz/kvIk2qhzY3Rs2mBbCrUT9FAOzsn9QPF00okuJBndrEcQH8 aSRaw8JejZ/SmjkIDZhGUd2aQ/VZr/ns9CyetvXB6NKpKk8yyOclTKdsd3kCOKkli9n9 FtWpq91NljTLBJdblaSleva7AvDmkUTbCLdZbbIgdTH5LOwfOGQU4rcVwtn0EbNlvr9I 2PFg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680628960; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=O4ioddbo3fPVVoSSJtNMis6LcQmvA1VnyLgc3Z68hdE=; b=2K1OGKtTVvgyQWVD+h24F3WNzldnlJCqrrNnmDgQqfOft/XI8mzph9k6kbRBEGZfEY k50PS2oKXCuuo+fBEFZ6NJeBxBiV45hbQMbilLhBWiL9Yse56hMJmZ3UB4YjDQLoZEly auwmFgGB+2C9l1/3fotnmyT/yV30W9YvkiAAMaKsqqlzX8wwbDFfStY3mukYWgZdvtKq A0GImCvF/lcn3d0dDE2V9AdbfP0zzhAW5qaq1wgo/WWAPSXn+e6BAyIkyEOUwCs6UemS UcP6t9IbPTIsHA2MYGDbQKCLMSO7Kf23u3dehUnOqQCA16x+40OcIe962F0If3lo1pmZ 9sDg== X-Gm-Message-State: AAQBX9eEyF0JxZIJqy7RI+G8Unh0vWNunawJobqAHiGB4ZVTcwGMUvnf mb5IHpxnSg/Ym4mOMDzkl/b2EH9NaSETthPd7VQ= X-Google-Smtp-Source: AKy350aN5km3v6dz/hkhjtOYBQDTtg+/Y8IJnmf+arn2URzzk6dRap53ZxiKkNTHBdOWS54+zv9SAQ== X-Received: by 2002:a17:906:3815:b0:8c3:3439:24d9 with SMTP id v21-20020a170906381500b008c3343924d9mr401714ejc.24.1680628960063; Tue, 04 Apr 2023 10:22:40 -0700 (PDT) Received: from localhost.localdomain ([5.133.47.210]) by smtp.gmail.com with ESMTPSA id bv20-20020a170906b1d400b009447277c2aasm6208333ejb.39.2023.04.04.10.22.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 Apr 2023 10:22:39 -0700 (PDT) From: Srinivas Kandagatla To: gregkh@linuxfoundation.org Cc: linux-kernel@vger.kernel.org, Michael Walle , Miquel Raynal , Srinivas Kandagatla Subject: [PATCH 13/40] nvmem: core: introduce NVMEM layouts Date: Tue, 4 Apr 2023 18:21:21 +0100 Message-Id: <20230404172148.82422-14-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230404172148.82422-1-srinivas.kandagatla@linaro.org> References: <20230404172148.82422-1-srinivas.kandagatla@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Michael Walle NVMEM layouts are used to generate NVMEM cells during runtime. Think of an EEPROM with a well-defined conent. For now, the content can be described by a device tree or a board file. But this only works if the offsets and lengths are static and don't change. One could also argue that putting the layout of the EEPROM in the device tree is the wrong place. Instead, the device tree should just have a specific compatible string. Right now there are two use cases: (1) The NVMEM cell needs special processing. E.g. if it only specifies a base MAC address offset and you need to add an offset, or it needs to parse a MAC from ASCII format or some proprietary format. (Post processing of cells is added in a later commit). (2) u-boot environment parsing. The cells don't have a particular offset but it needs parsing the content to determine the offsets and length. Co-developed-by: Miquel Raynal Signed-off-by: Miquel Raynal Signed-off-by: Michael Walle Signed-off-by: Srinivas Kandagatla --- Documentation/driver-api/nvmem.rst | 15 ++++ drivers/nvmem/Kconfig | 4 + drivers/nvmem/Makefile | 1 + drivers/nvmem/core.c | 120 +++++++++++++++++++++++++++++ drivers/nvmem/layouts/Kconfig | 5 ++ drivers/nvmem/layouts/Makefile | 4 + include/linux/nvmem-consumer.h | 7 ++ include/linux/nvmem-provider.h | 51 ++++++++++++ 8 files changed, 207 insertions(+) create mode 100644 drivers/nvmem/layouts/Kconfig create mode 100644 drivers/nvmem/layouts/Makefile diff --git a/Documentation/driver-api/nvmem.rst b/Documentation/driver-api/= nvmem.rst index e3366322d46c..de221e91c8e3 100644 --- a/Documentation/driver-api/nvmem.rst +++ b/Documentation/driver-api/nvmem.rst @@ -185,3 +185,18 @@ ex:: =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =20 See Documentation/devicetree/bindings/nvmem/nvmem.txt + +8. NVMEM layouts +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D + +NVMEM layouts are yet another mechanism to create cells. With the device +tree binding it is possible to specify simple cells by using an offset +and a length. Sometimes, the cells doesn't have a static offset, but +the content is still well defined, e.g. tag-length-values. In this case, +the NVMEM device content has to be first parsed and the cells need to +be added accordingly. Layouts let you read the content of the NVMEM device +and let you add cells dynamically. + +Another use case for layouts is the post processing of cells. With layouts, +it is possible to associate a custom post processing hook to a cell. It +even possible to add this hook to cells not created by the layout itself. diff --git a/drivers/nvmem/Kconfig b/drivers/nvmem/Kconfig index 3b3832f4dfad..a2afba11c890 100644 --- a/drivers/nvmem/Kconfig +++ b/drivers/nvmem/Kconfig @@ -21,6 +21,10 @@ config NVMEM_SYSFS This interface is mostly used by userspace applications to read/write directly into nvmem. =20 +# Layouts + +source "drivers/nvmem/layouts/Kconfig" + # Devices =20 config NVMEM_APPLE_EFUSES diff --git a/drivers/nvmem/Makefile b/drivers/nvmem/Makefile index 6a1efffa88f0..f82431ec8aef 100644 --- a/drivers/nvmem/Makefile +++ b/drivers/nvmem/Makefile @@ -5,6 +5,7 @@ =20 obj-$(CONFIG_NVMEM) +=3D nvmem_core.o nvmem_core-y :=3D core.o +obj-y +=3D layouts/ =20 # Devices obj-$(CONFIG_NVMEM_APPLE_EFUSES) +=3D nvmem-apple-efuses.o diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c index 22024b830788..b9be1faeb7be 100644 --- a/drivers/nvmem/core.c +++ b/drivers/nvmem/core.c @@ -40,6 +40,7 @@ struct nvmem_device { nvmem_reg_write_t reg_write; nvmem_cell_post_process_t cell_post_process; struct gpio_desc *wp_gpio; + struct nvmem_layout *layout; void *priv; }; =20 @@ -74,6 +75,9 @@ static LIST_HEAD(nvmem_lookup_list); =20 static BLOCKING_NOTIFIER_HEAD(nvmem_notifier); =20 +static DEFINE_SPINLOCK(nvmem_layout_lock); +static LIST_HEAD(nvmem_layouts); + static int __nvmem_reg_read(struct nvmem_device *nvmem, unsigned int offse= t, void *val, size_t bytes) { @@ -728,6 +732,101 @@ static int nvmem_add_cells_from_of(struct nvmem_devic= e *nvmem) return 0; } =20 +int __nvmem_layout_register(struct nvmem_layout *layout, struct module *ow= ner) +{ + layout->owner =3D owner; + + spin_lock(&nvmem_layout_lock); + list_add(&layout->node, &nvmem_layouts); + spin_unlock(&nvmem_layout_lock); + + return 0; +} +EXPORT_SYMBOL_GPL(__nvmem_layout_register); + +void nvmem_layout_unregister(struct nvmem_layout *layout) +{ + spin_lock(&nvmem_layout_lock); + list_del(&layout->node); + spin_unlock(&nvmem_layout_lock); +} +EXPORT_SYMBOL_GPL(nvmem_layout_unregister); + +static struct nvmem_layout *nvmem_layout_get(struct nvmem_device *nvmem) +{ + struct device_node *layout_np, *np =3D nvmem->dev.of_node; + struct nvmem_layout *l, *layout =3D NULL; + + layout_np =3D of_get_child_by_name(np, "nvmem-layout"); + if (!layout_np) + return NULL; + + spin_lock(&nvmem_layout_lock); + + list_for_each_entry(l, &nvmem_layouts, node) { + if (of_match_node(l->of_match_table, layout_np)) { + if (try_module_get(l->owner)) + layout =3D l; + + break; + } + } + + spin_unlock(&nvmem_layout_lock); + of_node_put(layout_np); + + return layout; +} + +static void nvmem_layout_put(struct nvmem_layout *layout) +{ + if (layout) + module_put(layout->owner); +} + +static int nvmem_add_cells_from_layout(struct nvmem_device *nvmem) +{ + struct nvmem_layout *layout =3D nvmem->layout; + int ret; + + if (layout && layout->add_cells) { + ret =3D layout->add_cells(&nvmem->dev, nvmem, layout); + if (ret) + return ret; + } + + return 0; +} + +#if IS_ENABLED(CONFIG_OF) +/** + * of_nvmem_layout_get_container() - Get OF node to layout container. + * + * @nvmem: nvmem device. + * + * Return: a node pointer with refcount incremented or NULL if no + * container exists. Use of_node_put() on it when done. + */ +struct device_node *of_nvmem_layout_get_container(struct nvmem_device *nvm= em) +{ + return of_get_child_by_name(nvmem->dev.of_node, "nvmem-layout"); +} +EXPORT_SYMBOL_GPL(of_nvmem_layout_get_container); +#endif + +const void *nvmem_layout_get_match_data(struct nvmem_device *nvmem, + struct nvmem_layout *layout) +{ + struct device_node __maybe_unused *layout_np; + const struct of_device_id *match; + + layout_np =3D of_nvmem_layout_get_container(nvmem); + match =3D of_match_node(layout->of_match_table, layout_np); + + return match ? match->data : NULL; +} +EXPORT_SYMBOL_GPL(nvmem_layout_get_match_data); + /** * nvmem_register() - Register a nvmem device for given nvmem_config. * Also creates a binary entry in /sys/bus/nvmem/devices/dev-name/nvmem @@ -834,6 +933,12 @@ struct nvmem_device *nvmem_register(const struct nvmem= _config *config) goto err_put_device; } =20 + /* + * If the driver supplied a layout by config->layout, the module + * pointer will be NULL and nvmem_layout_put() will be a noop. + */ + nvmem->layout =3D config->layout ?: nvmem_layout_get(nvmem); + if (config->cells) { rval =3D nvmem_add_cells(nvmem, config->cells, config->ncells); if (rval) @@ -854,12 +959,17 @@ struct nvmem_device *nvmem_register(const struct nvme= m_config *config) if (rval) goto err_remove_cells; =20 + rval =3D nvmem_add_cells_from_layout(nvmem); + if (rval) + goto err_remove_cells; + blocking_notifier_call_chain(&nvmem_notifier, NVMEM_ADD, nvmem); =20 return nvmem; =20 err_remove_cells: nvmem_device_remove_all_cells(nvmem); + nvmem_layout_put(nvmem->layout); if (config->compat) nvmem_sysfs_remove_compat(nvmem, config); err_put_device: @@ -881,6 +991,7 @@ static void nvmem_device_release(struct kref *kref) device_remove_bin_file(nvmem->base_dev, &nvmem->eeprom); =20 nvmem_device_remove_all_cells(nvmem); + nvmem_layout_put(nvmem->layout); device_unregister(&nvmem->dev); } =20 @@ -1246,6 +1357,15 @@ struct nvmem_cell *of_nvmem_cell_get(struct device_n= ode *np, const char *id) return ERR_PTR(-EINVAL); } =20 + /* nvmem layouts produce cells within the nvmem-layout container */ + if (of_node_name_eq(nvmem_np, "nvmem-layout")) { + nvmem_np =3D of_get_next_parent(nvmem_np); + if (!nvmem_np) { + of_node_put(cell_np); + return ERR_PTR(-EINVAL); + } + } + nvmem =3D __nvmem_device_get(nvmem_np, device_match_of_node); of_node_put(nvmem_np); if (IS_ERR(nvmem)) { diff --git a/drivers/nvmem/layouts/Kconfig b/drivers/nvmem/layouts/Kconfig new file mode 100644 index 000000000000..9ad3911d1605 --- /dev/null +++ b/drivers/nvmem/layouts/Kconfig @@ -0,0 +1,5 @@ +# SPDX-License-Identifier: GPL-2.0 + +menu "Layout Types" + +endmenu diff --git a/drivers/nvmem/layouts/Makefile b/drivers/nvmem/layouts/Makefile new file mode 100644 index 000000000000..6fdb3c60a4fa --- /dev/null +++ b/drivers/nvmem/layouts/Makefile @@ -0,0 +1,4 @@ +# SPDX-License-Identifier: GPL-2.0 +# +# Makefile for nvmem layouts. +# diff --git a/include/linux/nvmem-consumer.h b/include/linux/nvmem-consumer.h index 1f62f7ba71ca..fa030d93b768 100644 --- a/include/linux/nvmem-consumer.h +++ b/include/linux/nvmem-consumer.h @@ -239,6 +239,7 @@ struct nvmem_cell *of_nvmem_cell_get(struct device_node= *np, const char *id); struct nvmem_device *of_nvmem_device_get(struct device_node *np, const char *name); +struct device_node *of_nvmem_layout_get_container(struct nvmem_device *nvm= em); #else static inline struct nvmem_cell *of_nvmem_cell_get(struct device_node *np, const char *id) @@ -251,6 +252,12 @@ static inline struct nvmem_device *of_nvmem_device_get= (struct device_node *np, { return ERR_PTR(-EOPNOTSUPP); } + +static inline struct device_node * +of_nvmem_layout_get_container(struct nvmem_device *nvmem) +{ + return ERR_PTR(-EOPNOTSUPP); +} #endif /* CONFIG_NVMEM && CONFIG_OF */ =20 #endif /* ifndef _LINUX_NVMEM_CONSUMER_H */ diff --git a/include/linux/nvmem-provider.h b/include/linux/nvmem-provider.h index 0262b86194eb..535c5f9f3309 100644 --- a/include/linux/nvmem-provider.h +++ b/include/linux/nvmem-provider.h @@ -88,6 +88,7 @@ struct nvmem_cell_info { * @stride: Minimum read/write access stride. * @priv: User context passed to read/write callbacks. * @ignore_wp: Write Protect pin is managed by the provider. + * @layout: Fixed layout associated with this nvmem device. * * Note: A default "nvmem" name will be assigned to the device if * no name is specified in its configuration. In such case "" is @@ -109,6 +110,7 @@ struct nvmem_config { bool read_only; bool root_only; bool ignore_wp; + struct nvmem_layout *layout; struct device_node *of_node; bool no_of_node; nvmem_reg_read_t reg_read; @@ -142,6 +144,33 @@ struct nvmem_cell_table { struct list_head node; }; =20 +/** + * struct nvmem_layout - NVMEM layout definitions + * + * @name: Layout name. + * @of_match_table: Open firmware match table. + * @add_cells: Will be called if a nvmem device is found which + * has this layout. The function will add layout + * specific cells with nvmem_add_one_cell(). + * @owner: Pointer to struct module. + * @node: List node. + * + * A nvmem device can hold a well defined structure which can just be + * evaluated during runtime. For example a TLV list, or a list of "name=3D= val" + * pairs. A nvmem layout can parse the nvmem device and add appropriate + * cells. + */ +struct nvmem_layout { + const char *name; + const struct of_device_id *of_match_table; + int (*add_cells)(struct device *dev, struct nvmem_device *nvmem, + struct nvmem_layout *layout); + + /* private */ + struct module *owner; + struct list_head node; +}; + #if IS_ENABLED(CONFIG_NVMEM) =20 struct nvmem_device *nvmem_register(const struct nvmem_config *cfg); @@ -156,6 +185,14 @@ void nvmem_del_cell_table(struct nvmem_cell_table *tab= le); int nvmem_add_one_cell(struct nvmem_device *nvmem, const struct nvmem_cell_info *info); =20 +int __nvmem_layout_register(struct nvmem_layout *layout, struct module *ow= ner); +#define nvmem_layout_register(layout) \ + __nvmem_layout_register(layout, THIS_MODULE) +void nvmem_layout_unregister(struct nvmem_layout *layout); + +const void *nvmem_layout_get_match_data(struct nvmem_device *nvmem, + struct nvmem_layout *layout); + #else =20 static inline struct nvmem_device *nvmem_register(const struct nvmem_confi= g *c) @@ -179,5 +216,19 @@ static inline int nvmem_add_one_cell(struct nvmem_devi= ce *nvmem, return -EOPNOTSUPP; } =20 +static inline int nvmem_layout_register(struct nvmem_layout *layout) +{ + return -EOPNOTSUPP; +} + +static inline void nvmem_layout_unregister(struct nvmem_layout *layout) {} + +static inline const void * +nvmem_layout_get_match_data(struct nvmem_device *nvmem, + struct nvmem_layout *layout) +{ + return NULL; +} + #endif /* CONFIG_NVMEM */ #endif /* ifndef _LINUX_NVMEM_PROVIDER_H */ --=20 2.25.1 From nobody Wed Feb 11 02:33:35 2026 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 6661DC761A6 for ; Tue, 4 Apr 2023 17:23:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236162AbjDDRXb (ORCPT ); Tue, 4 Apr 2023 13:23:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51376 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236077AbjDDRXE (ORCPT ); Tue, 4 Apr 2023 13:23:04 -0400 Received: from mail-ed1-x52b.google.com (mail-ed1-x52b.google.com [IPv6:2a00:1450:4864:20::52b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EF3C259C5 for ; Tue, 4 Apr 2023 10:22:42 -0700 (PDT) Received: by mail-ed1-x52b.google.com with SMTP id ew6so133502262edb.7 for ; Tue, 04 Apr 2023 10:22:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1680628961; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=8NUlZD8qt7iqezKSBYAgBX4TFVpDixxexmnqZMgjaKs=; b=x7MIVVlfA7qRirbgLCU7xH2NaP2ANpZepGV8SNvAT9DnxIOgQk05DqXgxJokIYc0yr TrzH2zk7U4Y8qBlyPMF+fWE+LEz+GCdDQ3oXfMnFz4WgXD17BcuJAbejq3Pw1YI/C7Z7 q00U/lxPsqteXpcCG89xVgOuM0nv2NBv6clBQqNFfrnQ4k5VCmoPkRJO/uuhqe3X5Kfk mn7VdRyb5l0uxAnEUTcsgqBnMs36VtTgcOGwHZNLzOP0QX1l/XgNIiQ18h28Z6NxYvfT TFS2phT7YnAD3mtf7LMqTz92IgKt6pGZNVxxOr+lZ5R/pzftLYSDCO2tsEc0VKO1SOus aitQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680628961; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=8NUlZD8qt7iqezKSBYAgBX4TFVpDixxexmnqZMgjaKs=; b=gFzpi7ish+M0G9YLI5donTPvhCNgM4273JsIvyhGMwIm2fC1ThtxAMs5pmuE3kIXao h+YM5hajNnCIsZe7SpPtnMDMBk0Ues7aZ23cELIOE8R313VigkhPlfnMiDXwlf7RdvHW IUURW7fiar+Fw53WW+fF3QQoIee/oe2k7pwTxDfC3ajRjXVfv/c0NZ+N2obXBVtXdch4 DrPm7yMUII5ZAP9IKbPnV5bOCWZOMD4B30t3z949iM9b7kuxl5xHYDxPb6BWdgn69Qjq HBbUkxOs1ltnWyFgcHeSy3+g2Qb2YlEv/fEAUnGwWp3ndC5RF0vmpB1/ua1m6dclxKF6 y8hQ== X-Gm-Message-State: AAQBX9fi0jUnlFcjlIbDEetwrjIOoHmvXwkJwfetzNRzGt0nmS7tqcBg OLd+VFZB8YGyw2iX2z66MsgeJA== X-Google-Smtp-Source: AKy350YuviW2rJl9aLPXrOXQJIxjQLwOLL73I6Imlc+ikg/aoXxi0pyVe2H4LdSfr9gW0xvBMHCpgA== X-Received: by 2002:a17:906:edcf:b0:92a:3709:e872 with SMTP id sb15-20020a170906edcf00b0092a3709e872mr371216ejb.19.1680628961473; Tue, 04 Apr 2023 10:22:41 -0700 (PDT) Received: from localhost.localdomain ([5.133.47.210]) by smtp.gmail.com with ESMTPSA id bv20-20020a170906b1d400b009447277c2aasm6208333ejb.39.2023.04.04.10.22.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 Apr 2023 10:22:40 -0700 (PDT) From: Srinivas Kandagatla To: gregkh@linuxfoundation.org Cc: linux-kernel@vger.kernel.org, Miquel Raynal , Michael Walle , Srinivas Kandagatla Subject: [PATCH 14/40] nvmem: core: handle the absence of expected layouts Date: Tue, 4 Apr 2023 18:21:22 +0100 Message-Id: <20230404172148.82422-15-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230404172148.82422-1-srinivas.kandagatla@linaro.org> References: <20230404172148.82422-1-srinivas.kandagatla@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Miquel Raynal Make nvmem_layout_get() return -EPROBE_DEFER while the expected layout is not available. This condition cannot be triggered today as nvmem layout drivers are initialed as part of an early init call, but soon these drivers will be converted into modules and be initialized with a standard priority, so the unavailability of the drivers might become a reality that must be taken care of. Let's anticipate this by telling the caller the layout might not yet be available. A probe deferral is requested in this case. Please note this does not affect any nvmem device not using layouts, because an early check against the "nvmem-layout" container presence will return NULL in this case. Signed-off-by: Miquel Raynal Tested-by: Michael Walle Signed-off-by: Srinivas Kandagatla --- drivers/nvmem/core.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c index b9be1faeb7be..51fd792b8d70 100644 --- a/drivers/nvmem/core.c +++ b/drivers/nvmem/core.c @@ -755,7 +755,7 @@ EXPORT_SYMBOL_GPL(nvmem_layout_unregister); static struct nvmem_layout *nvmem_layout_get(struct nvmem_device *nvmem) { struct device_node *layout_np, *np =3D nvmem->dev.of_node; - struct nvmem_layout *l, *layout =3D NULL; + struct nvmem_layout *l, *layout =3D ERR_PTR(-EPROBE_DEFER); =20 layout_np =3D of_get_child_by_name(np, "nvmem-layout"); if (!layout_np) @@ -938,6 +938,13 @@ struct nvmem_device *nvmem_register(const struct nvmem= _config *config) * pointer will be NULL and nvmem_layout_put() will be a noop. */ nvmem->layout =3D config->layout ?: nvmem_layout_get(nvmem); + if (IS_ERR(nvmem->layout)) { + rval =3D PTR_ERR(nvmem->layout); + nvmem->layout =3D NULL; + + if (rval =3D=3D -EPROBE_DEFER) + goto err_teardown_compat; + } =20 if (config->cells) { rval =3D nvmem_add_cells(nvmem, config->cells, config->ncells); @@ -970,6 +977,7 @@ struct nvmem_device *nvmem_register(const struct nvmem_= config *config) err_remove_cells: nvmem_device_remove_all_cells(nvmem); nvmem_layout_put(nvmem->layout); +err_teardown_compat: if (config->compat) nvmem_sysfs_remove_compat(nvmem, config); err_put_device: --=20 2.25.1 From nobody Wed Feb 11 02:33:35 2026 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 4EFB7C761A6 for ; Tue, 4 Apr 2023 17:23:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236099AbjDDRXl (ORCPT ); Tue, 4 Apr 2023 13:23:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51462 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236088AbjDDRXF (ORCPT ); Tue, 4 Apr 2023 13:23:05 -0400 Received: from mail-ed1-x535.google.com (mail-ed1-x535.google.com [IPv6:2a00:1450:4864:20::535]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7DB8B55AB for ; Tue, 4 Apr 2023 10:22:44 -0700 (PDT) Received: by mail-ed1-x535.google.com with SMTP id t10so133434102edd.12 for ; Tue, 04 Apr 2023 10:22:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1680628963; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=LDzlzqq+yvKoEoeTAB2VQWwWQLTQznBO+pgzOwe70fc=; b=B/CB770D9L/cAHGEwv3PmEI5TyI61G9IQece3sPOe13q9W1pX8wojtfvWJlJgz0REz 4edHxrvh2vbHKQy9ShGk7Ruo1V/wW1hcZbW/Oy5Raf4ZWZs1MaE/44WEILx2rmcuHPhg XD7yo5gPAarcq97z6Ode0kYlFkQzeAMKYX4/a+DnyhxkX/wjE61MlqahWU8qKPuiPCvf rjB9ObD7K6rFw+XKbSm+m0jM8edukYblFvZrEA3uDpvxQ5yu84rgHG4EcLbA7/ASd7d6 CGHcXAIJKm+3D5YB7Le6/kzSVuYIBy1YILWuUSTMVcp2JkuY4JC0Ng78OF2CRv3y4+oB qlXQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680628963; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=LDzlzqq+yvKoEoeTAB2VQWwWQLTQznBO+pgzOwe70fc=; b=cnJDgGOcvs918ptatMajvWhL3OLEet0WSzDaoZvgTuPf1AOzPECTt5KX5rNhcgpcGI kb1V3QVgMXPi+zcg20eOcRFedMEJf2AzTVE3ehL5u4aMgoWaZi32Q43/9knjdlopSXoN 88MfKQao4aT1QKjAb8hNwBNayUs6FPPi6iNfqu/V+LO0B1czBH3RjY9OhAnzoYu3dEF8 /UiY26B8zUmM1GzOhmzVXeVFsO3vvoqkqiXfZir7kVWXrfAE+cByFt9xQJx6/4XBh65/ gPIXWiVvD82tLubwy0MLuEws+W4KgNFWkx2jJrl/mJnNR10UH38wYEyjKL+fNqQUjjDX kgfg== X-Gm-Message-State: AAQBX9f7ITyGYU/TUfNRVLmv69V0nrb5p/PZ/uOsm6vTA/yShnnNzN2d SNEb2sa8B2HceqeGqPS8dCcppe9D/5OlKu6VoHg= X-Google-Smtp-Source: AKy350b9WhU4QktBSymlXajGmk+RPNQtB2EPRRsqZZ8Dphrb0j7lNFWBCjqo7sxAiwWISWv4Ihw0iw== X-Received: by 2002:a17:906:ae9a:b0:932:40f4:5c49 with SMTP id md26-20020a170906ae9a00b0093240f45c49mr318576ejb.67.1680628963071; Tue, 04 Apr 2023 10:22:43 -0700 (PDT) Received: from localhost.localdomain ([5.133.47.210]) by smtp.gmail.com with ESMTPSA id bv20-20020a170906b1d400b009447277c2aasm6208333ejb.39.2023.04.04.10.22.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 Apr 2023 10:22:42 -0700 (PDT) From: Srinivas Kandagatla To: gregkh@linuxfoundation.org Cc: linux-kernel@vger.kernel.org, Miquel Raynal , Michael Walle , Srinivas Kandagatla Subject: [PATCH 15/40] nvmem: core: request layout modules loading Date: Tue, 4 Apr 2023 18:21:23 +0100 Message-Id: <20230404172148.82422-16-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230404172148.82422-1-srinivas.kandagatla@linaro.org> References: <20230404172148.82422-1-srinivas.kandagatla@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Miquel Raynal When a storage device like an eeprom or an mtd device probes, it registers an nvmem device if the nvmem subsystem has been enabled (bool symbol). During nvmem registration, if the device is using layouts to expose dynamic nvmem cells, the core will first try to get a reference over the layout driver callbacks. In practice there is not relationship that can be described between the storage driver and the nvmem layout. So there is no way we can enforce both drivers will be built-in or both will be modules. If the storage device driver is built-in but the layout is built as a module, instead of badly failing with an endless probe deferral loop, lets just make a modprobe call in case the driver was made available in an initramfs with of_device_node_request_module(), and offer a fully functional system to the user. Signed-off-by: Miquel Raynal Tested-by: Michael Walle Signed-off-by: Srinivas Kandagatla --- drivers/nvmem/core.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c index 51fd792b8d70..49b4bbaf59e8 100644 --- a/drivers/nvmem/core.c +++ b/drivers/nvmem/core.c @@ -17,6 +17,7 @@ #include #include #include +#include #include =20 struct nvmem_device { @@ -761,6 +762,13 @@ static struct nvmem_layout *nvmem_layout_get(struct nv= mem_device *nvmem) if (!layout_np) return NULL; =20 + /* + * In case the nvmem device was built-in while the layout was built as a + * module, we shall manually request the layout driver loading otherwise + * we'll never have any match. + */ + of_request_module(layout_np); + spin_lock(&nvmem_layout_lock); =20 list_for_each_entry(l, &nvmem_layouts, node) { --=20 2.25.1 From nobody Wed Feb 11 02:33:35 2026 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 529E4C6FD1D for ; Tue, 4 Apr 2023 17:23:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236175AbjDDRXj (ORCPT ); Tue, 4 Apr 2023 13:23:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51460 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236086AbjDDRXF (ORCPT ); Tue, 4 Apr 2023 13:23:05 -0400 Received: from mail-ed1-x52d.google.com (mail-ed1-x52d.google.com [IPv6:2a00:1450:4864:20::52d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4CCCA5B8C for ; Tue, 4 Apr 2023 10:22:45 -0700 (PDT) Received: by mail-ed1-x52d.google.com with SMTP id ek18so133634548edb.6 for ; Tue, 04 Apr 2023 10:22:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1680628965; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=55/HsPbECFGP1PL1OpKRnZp06obnPN7JssLV3bTa6kY=; b=M2E8W7Y02eGJTtZLnCueU6ATNrT5ScFOYtIpHpI6zkuUbqW2HMGzI7zjFrQXEgifx0 WdvzH8z0pO03ulESrFKOYHRhB5xn2Kml/odEK44rAKPzuQi2MpUE7+0Q5U51BDDln614 kcWtiz+9ub8PdUv8K0CcMk12oBFE7iR+yxZoQYj9z5y8vODJFhA+vgAzv+XOAygudgL7 2pn0ap+NCrgquBazcSU/LuZx1GKXcaDIU3V+jBtT1ygWufmIiUH3AXZp6BzV9EXLvwnC pNlG98EGcAS/gIfzcdN4RlOUKrrB1f+FD6tvbaa69BgoIzOCzTvVvsAUgRDMCd1wEo3J N85g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680628965; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=55/HsPbECFGP1PL1OpKRnZp06obnPN7JssLV3bTa6kY=; b=6FITfr6jTeNYgzXOkfMSrD+l/lGKMSRnGuqfn4rP5+rXIgRgvHoW3Q3EVAX9212QB9 vhyFliGZt9xIXyrcWonOmxbezarm/k1mzcvf2gMNzL7ghnpTOHnYE6AK/eNVByST70IO xbhZranjdiN5JpEOF0AI7kL2nZ412ibTDx3dL821xqyFunG47pUr8K2nN7bVA5Jo0frL xkFYNDLcjusqu8PLYPRdByEM+uqUoV14azDf6+/rEM0cqSIkQm7GyGR6AMfrzGVSzVCj 9AVQKNiGLmRLi8BP19OIRbICkRsr6c6uBtr+gRmsb7wFyBG82dLq9CGc5KFDudc/2qdm lkyA== X-Gm-Message-State: AAQBX9eom7vGgbQv5d3fI8Q8zmNx7dJ597hc5X/W4BJglxSZfsgWpN3j /M5y6YxKzC5ZsKdJwXH7TVLfhQyJwNKKJolMzNA= X-Google-Smtp-Source: AKy350ZtaeK3xkljnG68nVeuKnVaADFrYvNxg6n4gVOp2b/NZ9URm2GVykRELvPzJ2q8+ff7GuPHVQ== X-Received: by 2002:a17:906:e0c7:b0:895:58be:957 with SMTP id gl7-20020a170906e0c700b0089558be0957mr290833ejb.2.1680628964717; Tue, 04 Apr 2023 10:22:44 -0700 (PDT) Received: from localhost.localdomain ([5.133.47.210]) by smtp.gmail.com with ESMTPSA id bv20-20020a170906b1d400b009447277c2aasm6208333ejb.39.2023.04.04.10.22.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 Apr 2023 10:22:44 -0700 (PDT) From: Srinivas Kandagatla To: gregkh@linuxfoundation.org Cc: linux-kernel@vger.kernel.org, Michael Walle , Miquel Raynal , Srinivas Kandagatla Subject: [PATCH 16/40] nvmem: core: add per-cell post processing Date: Tue, 4 Apr 2023 18:21:24 +0100 Message-Id: <20230404172148.82422-17-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230404172148.82422-1-srinivas.kandagatla@linaro.org> References: <20230404172148.82422-1-srinivas.kandagatla@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Michael Walle Instead of relying on the name the consumer is using for the cell, like it is done for the nvmem .cell_post_process configuration parameter, provide a per-cell post processing hook. This can then be populated by the NVMEM provider (or the NVMEM layout) when adding the cell. Signed-off-by: Michael Walle Signed-off-by: Miquel Raynal Signed-off-by: Srinivas Kandagatla --- drivers/nvmem/core.c | 17 +++++++++++++++++ include/linux/nvmem-provider.h | 3 +++ 2 files changed, 20 insertions(+) diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c index 49b4bbaf59e8..0708f9f27898 100644 --- a/drivers/nvmem/core.c +++ b/drivers/nvmem/core.c @@ -54,6 +54,7 @@ struct nvmem_cell_entry { int bytes; int bit_offset; int nbits; + nvmem_cell_post_process_t read_post_process; struct device_node *np; struct nvmem_device *nvmem; struct list_head node; @@ -470,6 +471,7 @@ static int nvmem_cell_info_to_nvmem_cell_entry_nodup(st= ruct nvmem_device *nvmem, cell->offset =3D info->offset; cell->bytes =3D info->bytes; cell->name =3D info->name; + cell->read_post_process =3D info->read_post_process; =20 cell->bit_offset =3D info->bit_offset; cell->nbits =3D info->nbits; @@ -1563,6 +1565,13 @@ static int __nvmem_cell_read(struct nvmem_device *nv= mem, if (cell->bit_offset || cell->nbits) nvmem_shift_read_buffer_in_place(cell, buf); =20 + if (cell->read_post_process) { + rc =3D cell->read_post_process(nvmem->priv, id, index, + cell->offset, buf, cell->bytes); + if (rc) + return rc; + } + if (nvmem->cell_post_process) { rc =3D nvmem->cell_post_process(nvmem->priv, id, index, cell->offset, buf, cell->bytes); @@ -1671,6 +1680,14 @@ static int __nvmem_cell_entry_write(struct nvmem_cel= l_entry *cell, void *buf, si (cell->bit_offset =3D=3D 0 && len !=3D cell->bytes)) return -EINVAL; =20 + /* + * Any cells which have a read_post_process hook are read-only because + * we cannot reverse the operation and it might affect other cells, + * too. + */ + if (cell->read_post_process) + return -EINVAL; + if (cell->bit_offset || cell->nbits) { buf =3D nvmem_cell_prepare_write_buffer(cell, buf, len); if (IS_ERR(buf)) diff --git a/include/linux/nvmem-provider.h b/include/linux/nvmem-provider.h index 535c5f9f3309..3bfc23553a9e 100644 --- a/include/linux/nvmem-provider.h +++ b/include/linux/nvmem-provider.h @@ -54,6 +54,8 @@ struct nvmem_keepout { * @bit_offset: Bit offset if cell is smaller than a byte. * @nbits: Number of bits. * @np: Optional device_node pointer. + * @read_post_process: Callback for optional post processing of cell data + * on reads. */ struct nvmem_cell_info { const char *name; @@ -62,6 +64,7 @@ struct nvmem_cell_info { unsigned int bit_offset; unsigned int nbits; struct device_node *np; + nvmem_cell_post_process_t read_post_process; }; =20 /** --=20 2.25.1 From nobody Wed Feb 11 02:33:35 2026 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 89102C761A6 for ; Tue, 4 Apr 2023 17:23:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236190AbjDDRXp (ORCPT ); Tue, 4 Apr 2023 13:23:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51538 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236046AbjDDRXI (ORCPT ); Tue, 4 Apr 2023 13:23:08 -0400 Received: from mail-ed1-x531.google.com (mail-ed1-x531.google.com [IPv6:2a00:1450:4864:20::531]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A6CB255B2 for ; Tue, 4 Apr 2023 10:22:47 -0700 (PDT) Received: by mail-ed1-x531.google.com with SMTP id r11so133619718edd.5 for ; Tue, 04 Apr 2023 10:22:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1680628966; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=wUpb2JM7n+7eZBq4BlWotaA0EKU+rUj5Kly600q312g=; b=hBCgbbkHOu5B9RSMiGPoizTD+mVjukE/VKo8b5D2Dy++O6pvtprK/ssMtbcfE4ymiQ efEtsLIsQt/gMIVEyhMxlNKo9xchltk/+zRHSPY+Z/HLSq9o1cF3V8g+zJlZ3QpC1opQ yme7DSvfEiktVVKkp+nyFC3vPvFP3IvywUretH7x//zlK7+8P9Jujaw3J//yAEGjrQCO +lMOF1t52ZTbbLl811v2VF/uMvM6QRAQZ8onbICA9+azSTgZ8Ta00SNUN0Yc8VBKH84x Ix24DhAqigm6x7YLaNDCe2vCyzFwDFhDAwvgzA8DHEIt2i+wSVVADInvsbNdEFmJ+YNX QQQA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680628966; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=wUpb2JM7n+7eZBq4BlWotaA0EKU+rUj5Kly600q312g=; b=7J2n5wEgNfg6w22+xSplpdjy+fprZcuX6sVFrgWiXIePeZHzAZKWquMiIpM22KVE3B hnEWkoxkbfEL9xGQPrTfjHFAit8z/OG1fjPyp2YlqzzKLUtSww8V8+RWzbtFSth837qz tyX8E4Lj+NYFmNq24AHa15TmhR0CwloiZNpokWBATzq46Q9rtoNquyvhGD6IPXKwownh G4eP0/u737TplkcQMLf8J6np7k3ivZpWSEATmUHt25CP2mzmqu04lUPxOgTs2wJDZQpo y9gX78pjA+z/BuzZh1E+erU/dmkvP+D2bkiQLt0wBQRf3oxFgwlabsqF36jPM6iNIWhr 0/ZQ== X-Gm-Message-State: AAQBX9ciJFsGtNFaGrKEP7Xg01uOld8MiVvCI74GHj2/ScDBPTFWXjd3 4Ryf9M/H2NzA5PgA9mzFQLQYNg== X-Google-Smtp-Source: AKy350ZQwaNXjaTOKKh8KmO6I3neo+7WUDKbK0eMBeQ7BE7yqm8YUH+dYtIsDAQLX2y5jQFyr4xHMQ== X-Received: by 2002:a17:906:702:b0:92f:d1ec:a7d7 with SMTP id y2-20020a170906070200b0092fd1eca7d7mr51234ejb.15.1680628966047; Tue, 04 Apr 2023 10:22:46 -0700 (PDT) Received: from localhost.localdomain ([5.133.47.210]) by smtp.gmail.com with ESMTPSA id bv20-20020a170906b1d400b009447277c2aasm6208333ejb.39.2023.04.04.10.22.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 Apr 2023 10:22:45 -0700 (PDT) From: Srinivas Kandagatla To: gregkh@linuxfoundation.org Cc: linux-kernel@vger.kernel.org, Michael Walle , Miquel Raynal , Srinivas Kandagatla Subject: [PATCH 17/40] nvmem: core: allow to modify a cell before adding it Date: Tue, 4 Apr 2023 18:21:25 +0100 Message-Id: <20230404172148.82422-18-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230404172148.82422-1-srinivas.kandagatla@linaro.org> References: <20230404172148.82422-1-srinivas.kandagatla@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Michael Walle Provide a way to modify a cell before it will get added. This is useful to attach a custom post processing hook via a layout. Signed-off-by: Michael Walle Signed-off-by: Miquel Raynal Signed-off-by: Srinivas Kandagatla --- drivers/nvmem/core.c | 4 ++++ include/linux/nvmem-provider.h | 5 +++++ 2 files changed, 9 insertions(+) diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c index 0708f9f27898..f43025ad315b 100644 --- a/drivers/nvmem/core.c +++ b/drivers/nvmem/core.c @@ -695,6 +695,7 @@ static int nvmem_validate_keepouts(struct nvmem_device = *nvmem) =20 static int nvmem_add_cells_from_of(struct nvmem_device *nvmem) { + struct nvmem_layout *layout =3D nvmem->layout; struct device *dev =3D &nvmem->dev; struct device_node *child; const __be32 *addr; @@ -724,6 +725,9 @@ static int nvmem_add_cells_from_of(struct nvmem_device = *nvmem) =20 info.np =3D of_node_get(child); =20 + if (layout && layout->fixup_cell_info) + layout->fixup_cell_info(nvmem, layout, &info); + ret =3D nvmem_add_one_cell(nvmem, &info); kfree(info.name); if (ret) { diff --git a/include/linux/nvmem-provider.h b/include/linux/nvmem-provider.h index 3bfc23553a9e..be81cc88eabc 100644 --- a/include/linux/nvmem-provider.h +++ b/include/linux/nvmem-provider.h @@ -155,6 +155,8 @@ struct nvmem_cell_table { * @add_cells: Will be called if a nvmem device is found which * has this layout. The function will add layout * specific cells with nvmem_add_one_cell(). + * @fixup_cell_info: Will be called before a cell is added. Can be + * used to modify the nvmem_cell_info. * @owner: Pointer to struct module. * @node: List node. * @@ -168,6 +170,9 @@ struct nvmem_layout { const struct of_device_id *of_match_table; int (*add_cells)(struct device *dev, struct nvmem_device *nvmem, struct nvmem_layout *layout); + void (*fixup_cell_info)(struct nvmem_device *nvmem, + struct nvmem_layout *layout, + struct nvmem_cell_info *cell); =20 /* private */ struct module *owner; --=20 2.25.1 From nobody Wed Feb 11 02:33:35 2026 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 0144FC761A6 for ; Tue, 4 Apr 2023 17:23:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236191AbjDDRXt (ORCPT ); Tue, 4 Apr 2023 13:23:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51090 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236062AbjDDRXK (ORCPT ); Tue, 4 Apr 2023 13:23:10 -0400 Received: from mail-ed1-x533.google.com (mail-ed1-x533.google.com [IPv6:2a00:1450:4864:20::533]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7E98F5B9C for ; Tue, 4 Apr 2023 10:22:50 -0700 (PDT) Received: by mail-ed1-x533.google.com with SMTP id cn12so133620575edb.4 for ; Tue, 04 Apr 2023 10:22:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1680628968; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Dd46+0TAGQ78Me5bR3fENN5XDlibu+aAg1Xm4nj3Mm0=; b=v0IqlDIhJcw/5kQ6iNgBZ+9wh6fMuUHIs6HnTmiMj8mFay3fh9eL87PsQZILbx28U4 DtrzhUp6OKf6FjIQzcmDrAVEDlAAmwR5R2qzuXukiQahP8+mXUs7ADGwThrNz9qNQtdd TbmfO7j5OXVP3z+X7gfCHJFlE8AMMPZTq6jh6pybodTiHT7ZYNFtgMXxcnT06Rm3lwHg 8RXUtWAhRXt0aYsrz1DIL+TCwlbwucsqblIuGslZSr47sORffpyKGQ4yd9tpq71sqM4Y ZodZBPNDv46AjgiBiSBCcH5rGkvlMB7HnylwpVAUz73umBodWvJJ5UsZQnnXuRtwfIv1 Q9RQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680628968; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Dd46+0TAGQ78Me5bR3fENN5XDlibu+aAg1Xm4nj3Mm0=; b=70g6AyX7XJVZQGbFsC6Vw8jkoOe3iRhZ7fL6lnTYdBjY6FIQL8kv2fngiXb0WO6gwW MB36Uk4uzUHX7K21mK00GZueCjkpZnV+n4iW6yq4I4bJS14relI+mUIqO686tO7ZvNfc MhKivpa9tuZAnguxjnsY+eT6CfCL8V1pusk206ztc6m5gUYALlvRD6GvQ21xQFAeIXXN pFwGYL+eIVHQJ964Gc6P88ZeQc8OGIDC8RCWuhKqT2VdZtMX4NZX2J9hpVBpXSMRwByu gbYSFlIfw8xUCYGq7vOWdUtMQW7QwQv1wrCYMfoEK4nx49KAn0+iN9qtBWgjEAWK1yuh KKEw== X-Gm-Message-State: AAQBX9dGjQzD50UhX1OeXBuwFx6b4nAT/ASRGoBq8R2tXGw/KjX7oEEm LcQTns87hM+5dXwbHXBBWcHu0Q== X-Google-Smtp-Source: AKy350bvdwp5VOqnBlKEdtQsQLi6cP6a74vqta3Eqav7yiAh5EHPrv15yy5NuPfeiO53yuf+VDfHJQ== X-Received: by 2002:a17:906:c2c2:b0:933:2f77:ca78 with SMTP id ch2-20020a170906c2c200b009332f77ca78mr329348ejb.28.1680628967979; Tue, 04 Apr 2023 10:22:47 -0700 (PDT) Received: from localhost.localdomain ([5.133.47.210]) by smtp.gmail.com with ESMTPSA id bv20-20020a170906b1d400b009447277c2aasm6208333ejb.39.2023.04.04.10.22.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 Apr 2023 10:22:47 -0700 (PDT) From: Srinivas Kandagatla To: gregkh@linuxfoundation.org Cc: linux-kernel@vger.kernel.org, Michael Walle , Miquel Raynal , Srinivas Kandagatla Subject: [PATCH 18/40] nvmem: imx-ocotp: replace global post processing with layouts Date: Tue, 4 Apr 2023 18:21:26 +0100 Message-Id: <20230404172148.82422-19-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230404172148.82422-1-srinivas.kandagatla@linaro.org> References: <20230404172148.82422-1-srinivas.kandagatla@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Michael Walle In preparation of retiring the global post processing hook change this driver to use layouts. The layout will be supplied during registration and will be used to add the post processing hook to all added cells. Signed-off-by: Michael Walle Tested-by: Michael Walle # on kontron-pitx-imx8m Signed-off-by: Miquel Raynal Signed-off-by: Srinivas Kandagatla --- drivers/nvmem/imx-ocotp.c | 30 +++++++++++++++++++----------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/drivers/nvmem/imx-ocotp.c b/drivers/nvmem/imx-ocotp.c index e9b52ecb3f72..ac0edb6398f1 100644 --- a/drivers/nvmem/imx-ocotp.c +++ b/drivers/nvmem/imx-ocotp.c @@ -225,18 +225,13 @@ static int imx_ocotp_read(void *context, unsigned int= offset, static int imx_ocotp_cell_pp(void *context, const char *id, int index, unsigned int offset, void *data, size_t bytes) { - struct ocotp_priv *priv =3D context; + u8 *buf =3D data; + int i; =20 /* Deal with some post processing of nvmem cell data */ - if (id && !strcmp(id, "mac-address")) { - if (priv->params->reverse_mac_address) { - u8 *buf =3D data; - int i; - - for (i =3D 0; i < bytes/2; i++) - swap(buf[i], buf[bytes - i - 1]); - } - } + if (id && !strcmp(id, "mac-address")) + for (i =3D 0; i < bytes / 2; i++) + swap(buf[i], buf[bytes - i - 1]); =20 return 0; } @@ -488,7 +483,6 @@ static struct nvmem_config imx_ocotp_nvmem_config =3D { .stride =3D 1, .reg_read =3D imx_ocotp_read, .reg_write =3D imx_ocotp_write, - .cell_post_process =3D imx_ocotp_cell_pp, }; =20 static const struct ocotp_params imx6q_params =3D { @@ -595,6 +589,17 @@ static const struct of_device_id imx_ocotp_dt_ids[] = =3D { }; MODULE_DEVICE_TABLE(of, imx_ocotp_dt_ids); =20 +static void imx_ocotp_fixup_cell_info(struct nvmem_device *nvmem, + struct nvmem_layout *layout, + struct nvmem_cell_info *cell) +{ + cell->read_post_process =3D imx_ocotp_cell_pp; +} + +struct nvmem_layout imx_ocotp_layout =3D { + .fixup_cell_info =3D imx_ocotp_fixup_cell_info, +}; + static int imx_ocotp_probe(struct platform_device *pdev) { struct device *dev =3D &pdev->dev; @@ -619,6 +624,9 @@ static int imx_ocotp_probe(struct platform_device *pdev) imx_ocotp_nvmem_config.size =3D 4 * priv->params->nregs; imx_ocotp_nvmem_config.dev =3D dev; imx_ocotp_nvmem_config.priv =3D priv; + if (priv->params->reverse_mac_address) + imx_ocotp_nvmem_config.layout =3D &imx_ocotp_layout; + priv->config =3D &imx_ocotp_nvmem_config; =20 clk_prepare_enable(priv->clk); --=20 2.25.1 From nobody Wed Feb 11 02:33:35 2026 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 4629DC6FD1D for ; Tue, 4 Apr 2023 17:24:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236079AbjDDRX6 (ORCPT ); Tue, 4 Apr 2023 13:23:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51774 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236123AbjDDRXM (ORCPT ); Tue, 4 Apr 2023 13:23:12 -0400 Received: from mail-ed1-x52b.google.com (mail-ed1-x52b.google.com [IPv6:2a00:1450:4864:20::52b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D820B55BB for ; Tue, 4 Apr 2023 10:22:51 -0700 (PDT) Received: by mail-ed1-x52b.google.com with SMTP id eh3so133538032edb.11 for ; Tue, 04 Apr 2023 10:22:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1680628969; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Azd3oktKmYViYGpvLrpeQLO4dth6eZb1RhKC0MZJZlM=; b=zjjMh1PtfFWem7fQxHmfgW3oW0PO/EA7FXqwhT2TnxO8hKdQ1SJGh9GYu11d8HBhb9 zasTPYwmvWDR7oj3Lg6n3mhk0fgEu/r9WNRCeMIDy5Vt9E+nH+5PCsh1r9xcGO/tiZrI CnaTSUAgN9gqnQqE5A+mUlANq94mkYcwFsGb6ValUN9xU3iFgVqoLhfuhVXsDPJQ0kv8 s7VqR/iMHW4X9GMTB8cf1KaAtfVYBrPNzq51L66HEgvcpuwZOQIqmIH6YH23NezCkUdg xQUV3sRT9AKUOIflx16Q3vueP/JW6BBoV40TiWV4qY/9OoLidZyBHAac5cHGE40AMWky SfDA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680628969; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Azd3oktKmYViYGpvLrpeQLO4dth6eZb1RhKC0MZJZlM=; b=XcRS6gHu+A68VdEG2vNDJWHvYfGnlnjfdPKJ2+nQzyIIwwqXKGCTOZf/loLPTaMPoO 85tkS8lTry5LOPvUUbuUN5HnahjzrqaQzjpEGiBBj5m5B5dYLH3jzETYQxdZtRi7uqQm ZtTKbnvBzzw1voNnakm3lNgWmjPOXO9BOKVLcNN4iKNK3O403tN3mQi4lweF1Huj0RJD rGyLEipsfbA1xOf4jpvmUjLBS/l8cQUq1i8nTt2Z/NYSaAB3w//Ba4BWtHRjKZHPw4bk ofz5RzNno72pnxxh/r418cO/UeJ1yQCkNzHu0josF1AGnALY+6LsxLM/sQoGNe7Sz7ZX w8AQ== X-Gm-Message-State: AAQBX9eupOUyUIXOvSWJ8UZXRqhlN94QIYCGSFOMsZFql3i/d40wAeD0 19tBD5Tm8YZJOjdQ0FF9BEhhvg== X-Google-Smtp-Source: AKy350bacXr/iZ2Stg7TnkVRd4x9JLwF+M4EqntQGjy0oHcaJJ8vOSjRa3/kiR2uCECGMeFJqelwzA== X-Received: by 2002:a17:906:110d:b0:889:1eb1:7517 with SMTP id h13-20020a170906110d00b008891eb17517mr283893eja.30.1680628969566; Tue, 04 Apr 2023 10:22:49 -0700 (PDT) Received: from localhost.localdomain ([5.133.47.210]) by smtp.gmail.com with ESMTPSA id bv20-20020a170906b1d400b009447277c2aasm6208333ejb.39.2023.04.04.10.22.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 Apr 2023 10:22:48 -0700 (PDT) From: Srinivas Kandagatla To: gregkh@linuxfoundation.org Cc: linux-kernel@vger.kernel.org, Michael Walle , Miquel Raynal , Srinivas Kandagatla Subject: [PATCH 19/40] nvmem: cell: drop global cell_post_process Date: Tue, 4 Apr 2023 18:21:27 +0100 Message-Id: <20230404172148.82422-20-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230404172148.82422-1-srinivas.kandagatla@linaro.org> References: <20230404172148.82422-1-srinivas.kandagatla@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Michael Walle There are no users anymore for the global cell_post_process callback anymore. New users should use proper nvmem layouts. Signed-off-by: Michael Walle Signed-off-by: Miquel Raynal Signed-off-by: Srinivas Kandagatla --- drivers/nvmem/core.c | 9 --------- include/linux/nvmem-provider.h | 2 -- 2 files changed, 11 deletions(-) diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c index f43025ad315b..fccb2728193a 100644 --- a/drivers/nvmem/core.c +++ b/drivers/nvmem/core.c @@ -39,7 +39,6 @@ struct nvmem_device { unsigned int nkeepout; nvmem_reg_read_t reg_read; nvmem_reg_write_t reg_write; - nvmem_cell_post_process_t cell_post_process; struct gpio_desc *wp_gpio; struct nvmem_layout *layout; void *priv; @@ -903,7 +902,6 @@ struct nvmem_device *nvmem_register(const struct nvmem_= config *config) nvmem->type =3D config->type; nvmem->reg_read =3D config->reg_read; nvmem->reg_write =3D config->reg_write; - nvmem->cell_post_process =3D config->cell_post_process; nvmem->keepout =3D config->keepout; nvmem->nkeepout =3D config->nkeepout; if (config->of_node) @@ -1576,13 +1574,6 @@ static int __nvmem_cell_read(struct nvmem_device *nv= mem, return rc; } =20 - if (nvmem->cell_post_process) { - rc =3D nvmem->cell_post_process(nvmem->priv, id, index, - cell->offset, buf, cell->bytes); - if (rc) - return rc; - } - if (len) *len =3D cell->bytes; =20 diff --git a/include/linux/nvmem-provider.h b/include/linux/nvmem-provider.h index be81cc88eabc..d3d7af86a283 100644 --- a/include/linux/nvmem-provider.h +++ b/include/linux/nvmem-provider.h @@ -85,7 +85,6 @@ struct nvmem_cell_info { * @no_of_node: Device should not use the parent's of_node even if it's !N= ULL. * @reg_read: Callback to read data. * @reg_write: Callback to write data. - * @cell_post_process: Callback for vendor specific post processing of cel= l data * @size: Device size. * @word_size: Minimum read/write access granularity. * @stride: Minimum read/write access stride. @@ -118,7 +117,6 @@ struct nvmem_config { bool no_of_node; nvmem_reg_read_t reg_read; nvmem_reg_write_t reg_write; - nvmem_cell_post_process_t cell_post_process; int size; int word_size; int stride; --=20 2.25.1 From nobody Wed Feb 11 02:33:35 2026 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 BC437C761A6 for ; Tue, 4 Apr 2023 17:23:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236198AbjDDRXz (ORCPT ); Tue, 4 Apr 2023 13:23:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51130 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236008AbjDDRXM (ORCPT ); Tue, 4 Apr 2023 13:23:12 -0400 Received: from mail-ed1-x52d.google.com (mail-ed1-x52d.google.com [IPv6:2a00:1450:4864:20::52d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 77CDF59F4 for ; Tue, 4 Apr 2023 10:22:51 -0700 (PDT) Received: by mail-ed1-x52d.google.com with SMTP id ek18so133635552edb.6 for ; Tue, 04 Apr 2023 10:22:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1680628970; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=g1xH/p/sJcwkb7exDMsp+3qcLqt43HDr7CjsEC4aw8I=; b=TYpXPoEnChRyGVDdjx8vg/tZq8C6uccRZO7NvMmtQVYiIkQjfM+PCsaX2iYLrO30bT zASMICQzWbQaawK9s0Gl8R5nsgNDwDUxQe1xs8Wd3K3OKNpjZPVIRGUhmDQd28At3hLD Xi0MA2JxiarAERyCVMJ1N5H9y9Mgdp2Ca0QkIVOsecyj0OCUz7Vwj9nGeyjiXVCJ6Z+m /DxL6QmQK+NAxvqZWboPSWXj3Zu4YFIlDNSDoLDmF/3BDUWxnEfYYJkY8UZAHTwPExnQ OUucVE/Ev0MijRNmf2ubs6oA9fwRvwGRSVjdyIuntwucth8tc7tH5sb154a4fxF8yvrr GIlQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680628970; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=g1xH/p/sJcwkb7exDMsp+3qcLqt43HDr7CjsEC4aw8I=; b=wSC3W5VtEQjT5+X0F8ngtZ5/8sUhIh475u+/NUqYxhugR+SFEvcp8IRnK5U9Wmhwha Kfp35PglTqwgryGj+DASDQ5nl6IbHoK7VFCheUHQyv5E80T8OQT7X/JYdNOOz8XrbOhS uoU5EfFXgfBJWHJnjEjepbMNiGdgfF7QHb0PCih/vCifcFUPPKWSXVziLx2uwdmAB8f+ WujHJxs3juA1Hx2my3O5euB69pPrglX0tLyKXJXe3vBqm9rcU8JUHjo8lSFHDLtk81mL 0O2PyfLOgE5R0WWFLfyWXJupKZFa8BHb8bo8GOhl2Xdttiyg8Fdcq5MRcDy33JQEuuhF b3Iw== X-Gm-Message-State: AAQBX9dWLVsQbwPro5wx9QUkIUK4BUXbgH80ItUFbTK43E7QIJP2JqHV GVdMxeuKc3hi6f7Q0zWMpTlN6Q== X-Google-Smtp-Source: AKy350ahAasKv6PwcmyWbpR+6xa8Ed7QlUMV4MgrUUp1xt8MQ6kS+wty+0DvWuqWDlLMnkioqwxzGQ== X-Received: by 2002:a17:907:c30a:b0:8b1:779c:a8b1 with SMTP id tl10-20020a170907c30a00b008b1779ca8b1mr367648ejc.5.1680628970787; Tue, 04 Apr 2023 10:22:50 -0700 (PDT) Received: from localhost.localdomain ([5.133.47.210]) by smtp.gmail.com with ESMTPSA id bv20-20020a170906b1d400b009447277c2aasm6208333ejb.39.2023.04.04.10.22.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 Apr 2023 10:22:50 -0700 (PDT) From: Srinivas Kandagatla To: gregkh@linuxfoundation.org Cc: linux-kernel@vger.kernel.org, Michael Walle , Miquel Raynal , Srinivas Kandagatla Subject: [PATCH 20/40] nvmem: core: provide own priv pointer in post process callback Date: Tue, 4 Apr 2023 18:21:28 +0100 Message-Id: <20230404172148.82422-21-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230404172148.82422-1-srinivas.kandagatla@linaro.org> References: <20230404172148.82422-1-srinivas.kandagatla@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Michael Walle It doesn't make any more sense to have a opaque pointer set up by the nvmem device. Usually, the layout isn't associated with a particular nvmem device. Instead, let the caller who set the post process callback provide the priv pointer. Signed-off-by: Michael Walle Signed-off-by: Miquel Raynal Signed-off-by: Srinivas Kandagatla --- drivers/nvmem/core.c | 4 +++- include/linux/nvmem-provider.h | 5 ++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c index fccb2728193a..212c5ba5789f 100644 --- a/drivers/nvmem/core.c +++ b/drivers/nvmem/core.c @@ -54,6 +54,7 @@ struct nvmem_cell_entry { int bit_offset; int nbits; nvmem_cell_post_process_t read_post_process; + void *priv; struct device_node *np; struct nvmem_device *nvmem; struct list_head node; @@ -471,6 +472,7 @@ static int nvmem_cell_info_to_nvmem_cell_entry_nodup(st= ruct nvmem_device *nvmem, cell->bytes =3D info->bytes; cell->name =3D info->name; cell->read_post_process =3D info->read_post_process; + cell->priv =3D info->priv; =20 cell->bit_offset =3D info->bit_offset; cell->nbits =3D info->nbits; @@ -1568,7 +1570,7 @@ static int __nvmem_cell_read(struct nvmem_device *nvm= em, nvmem_shift_read_buffer_in_place(cell, buf); =20 if (cell->read_post_process) { - rc =3D cell->read_post_process(nvmem->priv, id, index, + rc =3D cell->read_post_process(cell->priv, id, index, cell->offset, buf, cell->bytes); if (rc) return rc; diff --git a/include/linux/nvmem-provider.h b/include/linux/nvmem-provider.h index d3d7af86a283..0cf9f9490514 100644 --- a/include/linux/nvmem-provider.h +++ b/include/linux/nvmem-provider.h @@ -20,7 +20,8 @@ typedef int (*nvmem_reg_write_t)(void *priv, unsigned int= offset, void *val, size_t bytes); /* used for vendor specific post processing of cell data */ typedef int (*nvmem_cell_post_process_t)(void *priv, const char *id, int i= ndex, - unsigned int offset, void *buf, size_t bytes); + unsigned int offset, void *buf, + size_t bytes); =20 enum nvmem_type { NVMEM_TYPE_UNKNOWN =3D 0, @@ -56,6 +57,7 @@ struct nvmem_keepout { * @np: Optional device_node pointer. * @read_post_process: Callback for optional post processing of cell data * on reads. + * @priv: Opaque data passed to the read_post_process hook. */ struct nvmem_cell_info { const char *name; @@ -65,6 +67,7 @@ struct nvmem_cell_info { unsigned int nbits; struct device_node *np; nvmem_cell_post_process_t read_post_process; + void *priv; }; =20 /** --=20 2.25.1 From nobody Wed Feb 11 02:33:35 2026 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 A9DE0C6FD1D for ; Tue, 4 Apr 2023 17:24:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236163AbjDDRYB (ORCPT ); Tue, 4 Apr 2023 13:24:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52594 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236160AbjDDRXb (ORCPT ); Tue, 4 Apr 2023 13:23:31 -0400 Received: from mail-ed1-x52e.google.com (mail-ed1-x52e.google.com [IPv6:2a00:1450:4864:20::52e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C2304E46 for ; Tue, 4 Apr 2023 10:22:57 -0700 (PDT) Received: by mail-ed1-x52e.google.com with SMTP id eh3so133538491edb.11 for ; Tue, 04 Apr 2023 10:22:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1680628972; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=BsL63XMcYPG0QJDkZzTuMtc8RkwMSJtKAF6NPnFMA58=; b=frRBwHt+RApdtoCGulgzPWlxd1OOnYcCOpCHchyrQTFLjfOKNZgiVx5MjfjWWCRXja dcpTdeMGhcazyEsMqIFSGCRjNC7Aye5a8MtGY/rBRdABqCA8y3Cwf6UBjmmA4vzrHyRS eWsEgmo0u3C8TU4aWDCdh1erX3L5mBqsin0o+n0F64VbnbYPPdKkjfH9BRdDYUFeOpvd jj9QHqZJbQ3Qp5Olwhh/Bxtvp9EkO0hPSNc+ACiFzJDHVmyi+ojCNB6M8hxdZw95za3W wsuJt1ag5M/IrgrNVIZ4Qm+4zZOhAT4aWVq5THZLvcyiAfKdP6w2Ifo4WHVQ4gd7KIUA LY1g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680628972; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=BsL63XMcYPG0QJDkZzTuMtc8RkwMSJtKAF6NPnFMA58=; b=2SB+MfFNnhIEdi+6/YSGLp70aVLnwwTgTdHINLnqwBK95Tn6FwvpbaGVxT9kBT+X38 8ChYmJ2gTzS6kWfexxUZcLFf3Wg4UOKsXhtZYlWUfQrpU73oZXUJ8PlaCBL1bqytGNqV /h8MIHRwmHa8aWAXoGT+gfq21KVXOOOdUrhG4+DahC/A5qti9SFyeH7S/P6cidcLdUx9 GDxUub2avn2raViIaShoO6ITOq/gnwS8EMDrhrm7NCUHGcQIztPlCI8mE0l+8YPwSohg hqjE1Cux+d9ArmdovmePAZyXcTrScQxCos5t+R9/f4ehvkGM3RKl7LSnGmNywCVX77bf 6EgQ== X-Gm-Message-State: AAQBX9ejb4Q99EoF3BZWFcADX0KFKc00xr9+Aino+YlpogKKY5LUOfkg 8AhlrFS+xv+RGA+2m5RiiYvagh65+/pvrto99F4= X-Google-Smtp-Source: AKy350Ya0OLmUJcuCrz7z9NJli6CZbvBVuY654jWw83HZ8mvAWnRupVESbGa/p+OFnIaCHbj1LhnOA== X-Received: by 2002:a17:906:c7d9:b0:93c:847d:a456 with SMTP id dc25-20020a170906c7d900b0093c847da456mr347753ejb.22.1680628972021; Tue, 04 Apr 2023 10:22:52 -0700 (PDT) Received: from localhost.localdomain ([5.133.47.210]) by smtp.gmail.com with ESMTPSA id bv20-20020a170906b1d400b009447277c2aasm6208333ejb.39.2023.04.04.10.22.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 Apr 2023 10:22:51 -0700 (PDT) From: Srinivas Kandagatla To: gregkh@linuxfoundation.org Cc: linux-kernel@vger.kernel.org, Michael Walle , Miquel Raynal , Srinivas Kandagatla Subject: [PATCH 21/40] nvmem: layouts: sl28vpd: Add new layout driver Date: Tue, 4 Apr 2023 18:21:29 +0100 Message-Id: <20230404172148.82422-22-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230404172148.82422-1-srinivas.kandagatla@linaro.org> References: <20230404172148.82422-1-srinivas.kandagatla@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Michael Walle This layout applies to the VPD of the Kontron sl28 boards. The VPD only contains a base MAC address. Therefore, we have to add an individual offset to it. This is done by taking the second argument of the nvmem phandle into account. Also this let us checking the VPD version and the checksum. Signed-off-by: Michael Walle Signed-off-by: Miquel Raynal Signed-off-by: Srinivas Kandagatla --- drivers/nvmem/layouts/Kconfig | 9 ++ drivers/nvmem/layouts/Makefile | 2 + drivers/nvmem/layouts/sl28vpd.c | 165 ++++++++++++++++++++++++++++++++ 3 files changed, 176 insertions(+) create mode 100644 drivers/nvmem/layouts/sl28vpd.c diff --git a/drivers/nvmem/layouts/Kconfig b/drivers/nvmem/layouts/Kconfig index 9ad3911d1605..fd161347c129 100644 --- a/drivers/nvmem/layouts/Kconfig +++ b/drivers/nvmem/layouts/Kconfig @@ -2,4 +2,13 @@ =20 menu "Layout Types" =20 +config NVMEM_LAYOUT_SL28_VPD + tristate "Kontron sl28 VPD layout support" + select CRC8 + help + Say Y here if you want to support the VPD layout of the Kontron + SMARC-sAL28 boards. + + If unsure, say N. + endmenu diff --git a/drivers/nvmem/layouts/Makefile b/drivers/nvmem/layouts/Makefile index 6fdb3c60a4fa..fc617b9e87d0 100644 --- a/drivers/nvmem/layouts/Makefile +++ b/drivers/nvmem/layouts/Makefile @@ -2,3 +2,5 @@ # # Makefile for nvmem layouts. # + +obj-$(CONFIG_NVMEM_LAYOUT_SL28_VPD) +=3D sl28vpd.o diff --git a/drivers/nvmem/layouts/sl28vpd.c b/drivers/nvmem/layouts/sl28vp= d.c new file mode 100644 index 000000000000..9370e41bad73 --- /dev/null +++ b/drivers/nvmem/layouts/sl28vpd.c @@ -0,0 +1,165 @@ +// SPDX-License-Identifier: GPL-2.0 + +#include +#include +#include +#include +#include +#include + +#define SL28VPD_MAGIC 'V' + +struct sl28vpd_header { + u8 magic; + u8 version; +} __packed; + +struct sl28vpd_v1 { + struct sl28vpd_header header; + char serial_number[15]; + u8 base_mac_address[ETH_ALEN]; + u8 crc8; +} __packed; + +static int sl28vpd_mac_address_pp(void *priv, const char *id, int index, + unsigned int offset, void *buf, + size_t bytes) +{ + if (bytes !=3D ETH_ALEN) + return -EINVAL; + + if (index < 0) + return -EINVAL; + + if (!is_valid_ether_addr(buf)) + return -EINVAL; + + eth_addr_add(buf, index); + + return 0; +} + +static const struct nvmem_cell_info sl28vpd_v1_entries[] =3D { + { + .name =3D "serial-number", + .offset =3D offsetof(struct sl28vpd_v1, serial_number), + .bytes =3D sizeof_field(struct sl28vpd_v1, serial_number), + }, + { + .name =3D "base-mac-address", + .offset =3D offsetof(struct sl28vpd_v1, base_mac_address), + .bytes =3D sizeof_field(struct sl28vpd_v1, base_mac_address), + .read_post_process =3D sl28vpd_mac_address_pp, + }, +}; + +static int sl28vpd_v1_check_crc(struct device *dev, struct nvmem_device *n= vmem) +{ + struct sl28vpd_v1 data_v1; + u8 table[CRC8_TABLE_SIZE]; + int ret; + u8 crc; + + crc8_populate_msb(table, 0x07); + + ret =3D nvmem_device_read(nvmem, 0, sizeof(data_v1), &data_v1); + if (ret < 0) + return ret; + else if (ret !=3D sizeof(data_v1)) + return -EIO; + + crc =3D crc8(table, (void *)&data_v1, sizeof(data_v1) - 1, 0); + + if (crc !=3D data_v1.crc8) { + dev_err(dev, + "Checksum is invalid (got %02x, expected %02x).\n", + crc, data_v1.crc8); + return -EINVAL; + } + + return 0; +} + +static int sl28vpd_add_cells(struct device *dev, struct nvmem_device *nvme= m, + struct nvmem_layout *layout) +{ + const struct nvmem_cell_info *pinfo; + struct nvmem_cell_info info =3D {0}; + struct device_node *layout_np; + struct sl28vpd_header hdr; + int ret, i; + + /* check header */ + ret =3D nvmem_device_read(nvmem, 0, sizeof(hdr), &hdr); + if (ret < 0) + return ret; + else if (ret !=3D sizeof(hdr)) + return -EIO; + + if (hdr.magic !=3D SL28VPD_MAGIC) { + dev_err(dev, "Invalid magic value (%02x)\n", hdr.magic); + return -EINVAL; + } + + if (hdr.version !=3D 1) { + dev_err(dev, "Version %d is unsupported.\n", hdr.version); + return -EINVAL; + } + + ret =3D sl28vpd_v1_check_crc(dev, nvmem); + if (ret) + return ret; + + layout_np =3D of_nvmem_layout_get_container(nvmem); + if (!layout_np) + return -ENOENT; + + for (i =3D 0; i < ARRAY_SIZE(sl28vpd_v1_entries); i++) { + pinfo =3D &sl28vpd_v1_entries[i]; + + info.name =3D pinfo->name; + info.offset =3D pinfo->offset; + info.bytes =3D pinfo->bytes; + info.read_post_process =3D pinfo->read_post_process; + info.np =3D of_get_child_by_name(layout_np, pinfo->name); + + ret =3D nvmem_add_one_cell(nvmem, &info); + if (ret) { + of_node_put(layout_np); + return ret; + } + } + + of_node_put(layout_np); + + return 0; +} + +static const struct of_device_id sl28vpd_of_match_table[] =3D { + { .compatible =3D "kontron,sl28-vpd" }, + {}, +}; +MODULE_DEVICE_TABLE(of, sl28vpd_of_match_table); + +struct nvmem_layout sl28vpd_layout =3D { + .name =3D "sl28-vpd", + .of_match_table =3D sl28vpd_of_match_table, + .add_cells =3D sl28vpd_add_cells, +}; + +static int __init sl28vpd_init(void) +{ + return nvmem_layout_register(&sl28vpd_layout); +} + +static void __exit sl28vpd_exit(void) +{ + nvmem_layout_unregister(&sl28vpd_layout); +} + +module_init(sl28vpd_init); +module_exit(sl28vpd_exit); + +MODULE_LICENSE("GPL"); +MODULE_AUTHOR("Michael Walle "); +MODULE_DESCRIPTION("NVMEM layout driver for the VPD of Kontron sl28 boards= "); --=20 2.25.1 From nobody Wed Feb 11 02:33:35 2026 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 BDFD3C761A6 for ; Tue, 4 Apr 2023 17:24:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236224AbjDDRYG (ORCPT ); Tue, 4 Apr 2023 13:24:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52628 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236084AbjDDRXb (ORCPT ); Tue, 4 Apr 2023 13:23:31 -0400 Received: from mail-ed1-x536.google.com (mail-ed1-x536.google.com [IPv6:2a00:1450:4864:20::536]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7ABF3211F for ; Tue, 4 Apr 2023 10:22:59 -0700 (PDT) Received: by mail-ed1-x536.google.com with SMTP id ek18so133636072edb.6 for ; Tue, 04 Apr 2023 10:22:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1680628973; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=vVPXX3tTlOF9VITPrPZIzQLL5bh3PDmTAkam+BakNc8=; b=nOKzTO6oUr0IHRPELYXE6MmyoXEi8c1z9gBs8OCX5c65i8GfGmROYEITTJDk6gGn2U zv6F8IvL3Yo1tflAeU72QQQvB16gK6U8FSxDEsgluSI8W3/62gX3fiXNlNcp8eLRBPtJ HwwY2eu4C3d567PoLfc7v6HcX7eSwjEtIhQdLGLfYHjO7TKzeSJnGXf/3eLtBvqpALuL pDzzeRx005rwHOtu4/zvTd4ET7E7YKi4tofkBR2SeggoAIbq+PLeZuUbzrux+sUULGFj isJue0fX7c/rm3BDDlj2DSBZLBPDX+/sK+aFjmRaXyou1eKvoRYT+CbYRkK7AzCgWhT2 qC7w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680628973; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=vVPXX3tTlOF9VITPrPZIzQLL5bh3PDmTAkam+BakNc8=; b=JPd2imA8Jn3eTaeOdxNDjpQv+2pX6RAn6gvPzKcUqmKftDvVGaKaZW//BQ3YwsKCLH hcRHIZqIodqY+/2+o1VNHg0LtANKB8oIhTzJL5qfUl6ZxaRJDW045vp0e/OG8467my40 XfsIMsBhspwSkOFjQl+rbPDg/8AXjbjaj84MwYLnu9oVjNH/A1iiJ8tUPcT/mwNd8vqm 9hkR/ey+FETsiFDzzYjA1gRm36vyfElrUiHZoPcWNyTSkDIn4P0F5Ylfp80SaV4sLdo7 TfGKkijvh2JanJl3LIMPo5idxjvmmWwEuzerpkPqQrRF2gL/+7Gy8vTWMGuAN7d0DFse x4pQ== X-Gm-Message-State: AAQBX9dIHTJWNpok82vcsfkNh8X1ouBqobjWAME9eicFcoNqvvUxf1dB iWRvfUoqf8k4GUzRaM3JMpipUw== X-Google-Smtp-Source: AKy350Z6otpVTJvM+YnDshzT92pqnew/dA56DAuh7nHo+LL39OQyHtawKtZB1dgaAGSgkFfLy4S/bQ== X-Received: by 2002:a17:906:278e:b0:932:e43f:7367 with SMTP id j14-20020a170906278e00b00932e43f7367mr379152ejc.35.1680628973353; Tue, 04 Apr 2023 10:22:53 -0700 (PDT) Received: from localhost.localdomain ([5.133.47.210]) by smtp.gmail.com with ESMTPSA id bv20-20020a170906b1d400b009447277c2aasm6208333ejb.39.2023.04.04.10.22.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 Apr 2023 10:22:52 -0700 (PDT) From: Srinivas Kandagatla To: gregkh@linuxfoundation.org Cc: linux-kernel@vger.kernel.org, Michael Walle , Miquel Raynal , Srinivas Kandagatla Subject: [PATCH 22/40] MAINTAINERS: add myself as sl28vpd nvmem layout driver Date: Tue, 4 Apr 2023 18:21:30 +0100 Message-Id: <20230404172148.82422-23-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230404172148.82422-1-srinivas.kandagatla@linaro.org> References: <20230404172148.82422-1-srinivas.kandagatla@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Michael Walle Add myself as a maintainer for the new sl28vpd nvmem layout driver. Signed-off-by: Michael Walle Signed-off-by: Miquel Raynal Signed-off-by: Srinivas Kandagatla --- MAINTAINERS | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/MAINTAINERS b/MAINTAINERS index 4d4f778ede5d..a7763063ffa3 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -19175,6 +19175,12 @@ F: drivers/irqchip/irq-sl28cpld.c F: drivers/pwm/pwm-sl28cpld.c F: drivers/watchdog/sl28cpld_wdt.c =20 +SL28 VPD NVMEM LAYOUT DRIVER +M: Michael Walle +S: Maintained +F: Documentation/devicetree/bindings/nvmem/layouts/kontron,sl28-vpd.yaml +F: drivers/nvmem/layouts/sl28vpd.c + SLAB ALLOCATOR M: Christoph Lameter M: Pekka Enberg --=20 2.25.1 From nobody Wed Feb 11 02:33:35 2026 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 D72D2C761A6 for ; Tue, 4 Apr 2023 17:24:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236244AbjDDRYS (ORCPT ); Tue, 4 Apr 2023 13:24:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51548 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236038AbjDDRXd (ORCPT ); Tue, 4 Apr 2023 13:23:33 -0400 Received: from mail-ed1-x533.google.com (mail-ed1-x533.google.com [IPv6:2a00:1450:4864:20::533]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9C34E49D8 for ; Tue, 4 Apr 2023 10:23:01 -0700 (PDT) Received: by mail-ed1-x533.google.com with SMTP id eh3so133538997edb.11 for ; Tue, 04 Apr 2023 10:23:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1680628974; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=D4Qz13+ZT5fbZmY5ugvf4iq0S8IgS9oqrtgiecX2uWE=; b=r1Yq5gtA9a8nCVL1ZyKKy/QUxEigL4eMKN0FTsvmmoXxGWb6vtES8vzYFOAVPG9iub JIEgI1AyZxjMlsIY5cBjxaXGHQKG8HVe6NitfbhYPpo7iTGtaqV0v57pXIUgufzl2l1i Mj5e/Rpfb6UTP334UDvc15rww4qUebqNg0PpkAIsYaxhMw/uLLCCGMJY4wkwZk2tlPhP JOKmGhOapiAI/uQiX090adtpR91sE56qGWtDS1wwuIyWsuYBYzhUiUanGivdtOTspgP9 6Ar3JU1LGuqZgX+8mzurRqboWK2jPvuNchg2Ubfi1eaKdq6C9Wr3sxSrTneoQcwtA+Pg U4Mw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680628974; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=D4Qz13+ZT5fbZmY5ugvf4iq0S8IgS9oqrtgiecX2uWE=; b=RiV5zFsQw8IbPvCpTVE3zvpAB1GgJ0rwvzBv85hoAMsdCKfPM93iWAlKgGpRPo8/eP Oxwu9gB3Sfv5mATJ9HIT8j8w7Ox830VAUezWN27AQX58eT0rP9ntTuD3+ETPsOBR7wA5 f28gym6CGLYDfq1pJfY3c6UzDNybayxZZwgMUfqKzGcJCcjP2tCk9ocNlQTizmLtBsT7 qTVaN+fYW8JY9xyNu10QplX0IUKRZbs/gAAE9dis3qRobY/faprjXFNXFiW3TOD8DCuW 3wZJiSINJUWpaCI+rnecEWVpPj/wG+ItrJmQiHPGka9BucutFCiviJsQXcWY70Ru3/a0 j2MA== X-Gm-Message-State: AAQBX9e7Ypz+VG33GtUUHaJNTtl5P02MriYQDk1rNAimAj0krqlkU4EK A7kpoNpL+DLmxNaTIvw9DP2RLw== X-Google-Smtp-Source: AKy350bXAcNDA2Ep1cJudhdpm4hQemzV68CVq9tx06rnm2a9ij8kWVIDZTFbQrI/OCYIO4SA5+MeQA== X-Received: by 2002:a17:906:37cd:b0:93e:82d1:9ae0 with SMTP id o13-20020a17090637cd00b0093e82d19ae0mr286805ejc.49.1680628974696; Tue, 04 Apr 2023 10:22:54 -0700 (PDT) Received: from localhost.localdomain ([5.133.47.210]) by smtp.gmail.com with ESMTPSA id bv20-20020a170906b1d400b009447277c2aasm6208333ejb.39.2023.04.04.10.22.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 Apr 2023 10:22:54 -0700 (PDT) From: Srinivas Kandagatla To: gregkh@linuxfoundation.org Cc: linux-kernel@vger.kernel.org, Miquel Raynal , Srinivas Kandagatla Subject: [PATCH 23/40] nvmem: layouts: onie-tlv: Add new layout driver Date: Tue, 4 Apr 2023 18:21:31 +0100 Message-Id: <20230404172148.82422-24-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230404172148.82422-1-srinivas.kandagatla@linaro.org> References: <20230404172148.82422-1-srinivas.kandagatla@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Miquel Raynal This layout applies on top of any non volatile storage device containing an ONIE table factory flashed. This table follows the tlv (type-length-value) organization described in the link below. We cannot afford using regular parsers because the content of these tables is manufacturer specific and must be dynamically discovered. Link: https://opencomputeproject.github.io/onie/design-spec/hw_requirements= .html Signed-off-by: Miquel Raynal Signed-off-by: Srinivas Kandagatla --- drivers/nvmem/layouts/Kconfig | 9 ++ drivers/nvmem/layouts/Makefile | 1 + drivers/nvmem/layouts/onie-tlv.c | 257 +++++++++++++++++++++++++++++++ 3 files changed, 267 insertions(+) create mode 100644 drivers/nvmem/layouts/onie-tlv.c diff --git a/drivers/nvmem/layouts/Kconfig b/drivers/nvmem/layouts/Kconfig index fd161347c129..7ff1ee1c1f05 100644 --- a/drivers/nvmem/layouts/Kconfig +++ b/drivers/nvmem/layouts/Kconfig @@ -11,4 +11,13 @@ config NVMEM_LAYOUT_SL28_VPD =20 If unsure, say N. =20 +config NVMEM_LAYOUT_ONIE_TLV + tristate "ONIE tlv support" + select CRC32 + help + Say Y here if you want to support the Open Compute Project ONIE + Type-Length-Value standard table. + + If unsure, say N. + endmenu diff --git a/drivers/nvmem/layouts/Makefile b/drivers/nvmem/layouts/Makefile index fc617b9e87d0..2974bd7d33ed 100644 --- a/drivers/nvmem/layouts/Makefile +++ b/drivers/nvmem/layouts/Makefile @@ -4,3 +4,4 @@ # =20 obj-$(CONFIG_NVMEM_LAYOUT_SL28_VPD) +=3D sl28vpd.o +obj-$(CONFIG_NVMEM_LAYOUT_ONIE_TLV) +=3D onie-tlv.o diff --git a/drivers/nvmem/layouts/onie-tlv.c b/drivers/nvmem/layouts/onie-= tlv.c new file mode 100644 index 000000000000..d45b7301a69d --- /dev/null +++ b/drivers/nvmem/layouts/onie-tlv.c @@ -0,0 +1,257 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* + * ONIE tlv NVMEM cells provider + * + * Copyright (C) 2022 Open Compute Group ONIE + * Author: Miquel Raynal + * Based on the nvmem driver written by: Vadym Kochan + * Inspired by the first layout written by: Rafa=C5=82 Mi=C5=82ecki + */ + +#include +#include +#include +#include +#include + +#define ONIE_TLV_MAX_LEN 2048 +#define ONIE_TLV_CRC_FIELD_SZ 6 +#define ONIE_TLV_CRC_SZ 4 +#define ONIE_TLV_HDR_ID "TlvInfo" + +struct onie_tlv_hdr { + u8 id[8]; + u8 version; + __be16 data_len; +} __packed; + +struct onie_tlv { + u8 type; + u8 len; +} __packed; + +static const char *onie_tlv_cell_name(u8 type) +{ + switch (type) { + case 0x21: + return "product-name"; + case 0x22: + return "part-number"; + case 0x23: + return "serial-number"; + case 0x24: + return "mac-address"; + case 0x25: + return "manufacture-date"; + case 0x26: + return "device-version"; + case 0x27: + return "label-revision"; + case 0x28: + return "platform-name"; + case 0x29: + return "onie-version"; + case 0x2A: + return "num-macs"; + case 0x2B: + return "manufacturer"; + case 0x2C: + return "country-code"; + case 0x2D: + return "vendor"; + case 0x2E: + return "diag-version"; + case 0x2F: + return "service-tag"; + case 0xFD: + return "vendor-extension"; + case 0xFE: + return "crc32"; + default: + break; + } + + return NULL; +} + +static int onie_tlv_mac_read_cb(void *priv, const char *id, int index, + unsigned int offset, void *buf, + size_t bytes) +{ + eth_addr_add(buf, index); + + return 0; +} + +static nvmem_cell_post_process_t onie_tlv_read_cb(u8 type, u8 *buf) +{ + switch (type) { + case 0x24: + return &onie_tlv_mac_read_cb; + default: + break; + } + + return NULL; +} + +static int onie_tlv_add_cells(struct device *dev, struct nvmem_device *nvm= em, + size_t data_len, u8 *data) +{ + struct nvmem_cell_info cell =3D {}; + struct device_node *layout; + struct onie_tlv tlv; + unsigned int hdr_len =3D sizeof(struct onie_tlv_hdr); + unsigned int offset =3D 0; + int ret; + + layout =3D of_nvmem_layout_get_container(nvmem); + if (!layout) + return -ENOENT; + + while (offset < data_len) { + memcpy(&tlv, data + offset, sizeof(tlv)); + if (offset + tlv.len >=3D data_len) { + dev_err(dev, "Out of bounds field (0x%x bytes at 0x%x)\n", + tlv.len, hdr_len + offset); + break; + } + + cell.name =3D onie_tlv_cell_name(tlv.type); + if (!cell.name) + continue; + + cell.offset =3D hdr_len + offset + sizeof(tlv.type) + sizeof(tlv.len); + cell.bytes =3D tlv.len; + cell.np =3D of_get_child_by_name(layout, cell.name); + cell.read_post_process =3D onie_tlv_read_cb(tlv.type, data + offset + si= zeof(tlv)); + + ret =3D nvmem_add_one_cell(nvmem, &cell); + if (ret) { + of_node_put(layout); + return ret; + } + + offset +=3D sizeof(tlv) + tlv.len; + } + + of_node_put(layout); + + return 0; +} + +static bool onie_tlv_hdr_is_valid(struct device *dev, struct onie_tlv_hdr = *hdr) +{ + if (memcmp(hdr->id, ONIE_TLV_HDR_ID, sizeof(hdr->id))) { + dev_err(dev, "Invalid header\n"); + return false; + } + + if (hdr->version !=3D 0x1) { + dev_err(dev, "Invalid version number\n"); + return false; + } + + return true; +} + +static bool onie_tlv_crc_is_valid(struct device *dev, size_t table_len, u8= *table) +{ + struct onie_tlv crc_hdr; + u32 read_crc, calc_crc; + __be32 crc_be; + + memcpy(&crc_hdr, table + table_len - ONIE_TLV_CRC_FIELD_SZ, sizeof(crc_hd= r)); + if (crc_hdr.type !=3D 0xfe || crc_hdr.len !=3D ONIE_TLV_CRC_SZ) { + dev_err(dev, "Invalid CRC field\n"); + return false; + } + + /* The table contains a JAMCRC, which is XOR'ed compared to the original + * CRC32 implementation as known in the Ethernet world. + */ + memcpy(&crc_be, table + table_len - ONIE_TLV_CRC_SZ, ONIE_TLV_CRC_SZ); + read_crc =3D be32_to_cpu(crc_be); + calc_crc =3D crc32(~0, table, table_len - ONIE_TLV_CRC_SZ) ^ 0xFFFFFFFF; + if (read_crc !=3D calc_crc) { + dev_err(dev, "Invalid CRC read: 0x%08x, expected: 0x%08x\n", + read_crc, calc_crc); + return false; + } + + return true; +} + +static int onie_tlv_parse_table(struct device *dev, struct nvmem_device *n= vmem, + struct nvmem_layout *layout) +{ + struct onie_tlv_hdr hdr; + size_t table_len, data_len, hdr_len; + u8 *table, *data; + int ret; + + ret =3D nvmem_device_read(nvmem, 0, sizeof(hdr), &hdr); + if (ret < 0) + return ret; + + if (!onie_tlv_hdr_is_valid(dev, &hdr)) { + dev_err(dev, "Invalid ONIE TLV header\n"); + return -EINVAL; + } + + hdr_len =3D sizeof(hdr.id) + sizeof(hdr.version) + sizeof(hdr.data_len); + data_len =3D be16_to_cpu(hdr.data_len); + table_len =3D hdr_len + data_len; + if (table_len > ONIE_TLV_MAX_LEN) { + dev_err(dev, "Invalid ONIE TLV data length\n"); + return -EINVAL; + } + + table =3D devm_kmalloc(dev, table_len, GFP_KERNEL); + if (!table) + return -ENOMEM; + + ret =3D nvmem_device_read(nvmem, 0, table_len, table); + if (ret !=3D table_len) + return ret; + + if (!onie_tlv_crc_is_valid(dev, table_len, table)) + return -EINVAL; + + data =3D table + hdr_len; + ret =3D onie_tlv_add_cells(dev, nvmem, data_len, data); + if (ret) + return ret; + + return 0; +} + +static const struct of_device_id onie_tlv_of_match_table[] =3D { + { .compatible =3D "onie,tlv-layout", }, + {}, +}; +MODULE_DEVICE_TABLE(of, onie_tlv_of_match_table); + +static struct nvmem_layout onie_tlv_layout =3D { + .name =3D "ONIE tlv layout", + .of_match_table =3D onie_tlv_of_match_table, + .add_cells =3D onie_tlv_parse_table, +}; + +static int __init onie_tlv_init(void) +{ + return nvmem_layout_register(&onie_tlv_layout); +} + +static void __exit onie_tlv_exit(void) +{ + nvmem_layout_unregister(&onie_tlv_layout); +} + +module_init(onie_tlv_init); +module_exit(onie_tlv_exit); + +MODULE_LICENSE("GPL"); +MODULE_AUTHOR("Miquel Raynal "); +MODULE_DESCRIPTION("NVMEM layout driver for Onie TLV table parsing"); +MODULE_ALIAS("NVMEM layout driver for Onie TLV table parsing"); --=20 2.25.1 From nobody Wed Feb 11 02:33:35 2026 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 94180C6FD1D for ; Tue, 4 Apr 2023 17:24:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236239AbjDDRYO (ORCPT ); Tue, 4 Apr 2023 13:24:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51538 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236089AbjDDRXd (ORCPT ); Tue, 4 Apr 2023 13:23:33 -0400 Received: from mail-ed1-x52a.google.com (mail-ed1-x52a.google.com [IPv6:2a00:1450:4864:20::52a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 07AB94EE2 for ; Tue, 4 Apr 2023 10:23:01 -0700 (PDT) Received: by mail-ed1-x52a.google.com with SMTP id eg48so133482692edb.13 for ; Tue, 04 Apr 2023 10:23:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1680628976; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=swqW9Ca9H56TFND+javZmACJz25+KcaCrTqA9gONh10=; b=m33jvcLmJSZ/5wrs36eE5pgAEQqL0Exs2cHsfCdEva7xp2/g51588owtwuWYjp730Q nAwNjWKDCPW+kQZfkbjndbUj7q4R3Hwou/EXyOtTZUA7HTJQ69tUcOo7eSt5czJervzn IVuMGM28Ml5XthYIZGKuxKsGLOhr29OL3TDIXqRTgJGN48p6goZYXrc3bNubeWsVfxz1 F8GUCD/wBu5YNG1pNIP0QRbXyJW2z0VepbgZZKnluo6YQlk7WGWKDJQHKH7fmIHKA4+A P40HZLfpp9l1yneuFNl+MQ+WM5toBAGoCwD9VHTjJzM1DgGkodIdFOacY5MXQ+nr0nTf 3JdQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680628976; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=swqW9Ca9H56TFND+javZmACJz25+KcaCrTqA9gONh10=; b=ewTAhjl/5CxXlQCBtLdu1jteLBIiOqqBA1gHao6+rh9PBO9FlVpkVhQL4IvG1tLOH1 Ft7cM/wcbUavT4izm1BwURJ4OWqXeufQYT+M7mVMRda2kQo9MP7ZX+2mC9NFBqXJTfRL 5AUTRZ8Hb+wQHwokpBiu6BIU+cq2PjRGUW/17McGlxchNvf27ZNz5Vkf2x0LpthcmVZu QLAaSF4ssASw3noRNh8WHKYgEzPcWNG4rig9r4k25qUV87U46FGcWgozlXdf207fQNgx UPyGiMmrDV5vGGkXRn7XFecQp2CpFhUrvh7SQn/mm9RUwIXZR4ovgkDJX+V6kLtrlPja k+Ag== X-Gm-Message-State: AAQBX9dCXgyF9OML2sTlMMqO2vkC7jhBQ6xL3JCQFI5FnEXPwe5Jjzql fZSK5b6KqujQIAf89PstE8hS2g== X-Google-Smtp-Source: AKy350aFBwLu7hTxlDG8KC+HzY11W/sU9e+YM3f1QLTF9NPbo20z10zcjr9qCD8HRBxF3rFxu/dRbA== X-Received: by 2002:a17:906:8450:b0:948:c047:467d with SMTP id e16-20020a170906845000b00948c047467dmr310931ejy.23.1680628976356; Tue, 04 Apr 2023 10:22:56 -0700 (PDT) Received: from localhost.localdomain ([5.133.47.210]) by smtp.gmail.com with ESMTPSA id bv20-20020a170906b1d400b009447277c2aasm6208333ejb.39.2023.04.04.10.22.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 Apr 2023 10:22:55 -0700 (PDT) From: Srinivas Kandagatla To: gregkh@linuxfoundation.org Cc: linux-kernel@vger.kernel.org, Miquel Raynal , Srinivas Kandagatla Subject: [PATCH 24/40] MAINTAINERS: Add myself as ONIE tlv NVMEM layout maintainer Date: Tue, 4 Apr 2023 18:21:32 +0100 Message-Id: <20230404172148.82422-25-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230404172148.82422-1-srinivas.kandagatla@linaro.org> References: <20230404172148.82422-1-srinivas.kandagatla@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Miquel Raynal Following the introduction of the bindings for this NVMEM parser and the layout driver, add myself as maintainer. Signed-off-by: Miquel Raynal Signed-off-by: Srinivas Kandagatla --- MAINTAINERS | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/MAINTAINERS b/MAINTAINERS index a7763063ffa3..de05ac9b58ca 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -15547,6 +15547,12 @@ L: linux-hwmon@vger.kernel.org S: Maintained F: drivers/hwmon/oxp-sensors.c =20 +ONIE TLV NVMEM LAYOUT DRIVER +M: Miquel Raynal +S: Maintained +F: Documentation/devicetree/bindings/nvmem/layouts/onie,tlv-layout.yaml +F: drivers/nvmem/layouts/onie-tlv.c + ONION OMEGA2+ BOARD M: Harvey Hunt L: linux-mips@vger.kernel.org --=20 2.25.1 From nobody Wed Feb 11 02:33:35 2026 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 B3463C77B60 for ; Tue, 4 Apr 2023 17:24:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236077AbjDDRYD (ORCPT ); Tue, 4 Apr 2023 13:24:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51460 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236050AbjDDRXb (ORCPT ); Tue, 4 Apr 2023 13:23:31 -0400 Received: from mail-ed1-x52a.google.com (mail-ed1-x52a.google.com [IPv6:2a00:1450:4864:20::52a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4868E1BC7 for ; Tue, 4 Apr 2023 10:22:58 -0700 (PDT) Received: by mail-ed1-x52a.google.com with SMTP id ek18so133636993edb.6 for ; Tue, 04 Apr 2023 10:22:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1680628978; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=YpK/rtOcThFCxDcbYqxrVp6qCPyXXE6NETLUVka6bxA=; b=v0wc6b2d1QxI7/jZ+uBgmbxjHwi59bay/+45jHonTU/GBhm6u3pyEVojA7GQHMOfRw h5lPa6H+85UMnbxZj4UZn2gRM1Bme68eut5viccIh5raZaK5duIP1tQ5GvDxtGAjqUJz QfQi0Lo8TOkyr540TKT/mXs2rsy9DruNvU23qAeZnVdeQSL8/4vn0VAvbBFb6/Z637Hg ViLMpEMhI/jbes6LlG87Sf7DrZ7i57DleIK65F6ma6OHGvF9xI6cubSdup8EB7JAPv4r QV1upkRhH/c0mlW9y+r+ryd66CCRW3hCdA0J5EOGcYfI6IbKXOB0Uvc2AlZKNU7QV+KU k7jQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680628978; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=YpK/rtOcThFCxDcbYqxrVp6qCPyXXE6NETLUVka6bxA=; b=MxPbvhktkz6NbwO2I0LPFzwsf7yEgKqoj2o1KY5VgQyBjgm1yKrwu/IzJFlMyr+DEk 4ESben4pUuNqHeHS69BxzJ1Dbw//5q/6p1/vOB3tdmHDA5NR/gX/WcusdD4NndYYwxiy f6KPesZikW+tGF31jVHFs3/3nhoc8NRgfaPMlLq4sLYCTYVcvZStqNrf5fl1JdKp7ccY uIjvpoi6vZxafxZoRLb2TLhDWMv6Bkpr1frsJMdavnmdh7L3IBJXkUkcJsIgF077R/Wk jhvj8mO29RaG/BnGy/cAdNobVf2TT38a153oDnEIe0fOiIkeh6o1l2NMlitEMJLknotS Wp5A== X-Gm-Message-State: AAQBX9fnHZjSwaEaei1LpyqPTtFpQWH0V23KojTH4CY4cSe6y0DsafbS iLY5dLLFos4/FGjmp6DIPm+X9Q== X-Google-Smtp-Source: AKy350awC1v10sh90uGlxtPQ9IQ2RZGfeDlr0E3Sjgs9OxsSjqNuiq/Md4IQntYmIbhK3Rm1Yg9DnA== X-Received: by 2002:a17:906:f9c6:b0:921:5cce:6599 with SMTP id lj6-20020a170906f9c600b009215cce6599mr300364ejb.41.1680628977869; Tue, 04 Apr 2023 10:22:57 -0700 (PDT) Received: from localhost.localdomain ([5.133.47.210]) by smtp.gmail.com with ESMTPSA id bv20-20020a170906b1d400b009447277c2aasm6208333ejb.39.2023.04.04.10.22.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 Apr 2023 10:22:57 -0700 (PDT) From: Srinivas Kandagatla To: gregkh@linuxfoundation.org Cc: linux-kernel@vger.kernel.org, Rob Herring , Jernej Skrabec , Krzysztof Kozlowski , Srinivas Kandagatla Subject: [PATCH 25/40] dt-bindings: nvmem: Drop unneeded quotes Date: Tue, 4 Apr 2023 18:21:33 +0100 Message-Id: <20230404172148.82422-26-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230404172148.82422-1-srinivas.kandagatla@linaro.org> References: <20230404172148.82422-1-srinivas.kandagatla@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Rob Herring Cleanup bindings dropping unneeded quotes. Once all these are fixed, checking for this can be enabled in yamllint. Signed-off-by: Rob Herring Acked-by: Jernej Skrabec Reviewed-by: Krzysztof Kozlowski Signed-off-by: Srinivas Kandagatla Acked-By: Jernej Skrabec --- .../devicetree/bindings/nvmem/allwinner,sun4i-a10-sid.yaml | 2 +- Documentation/devicetree/bindings/nvmem/apple,efuses.yaml | 2 +- Documentation/devicetree/bindings/nvmem/brcm,nvram.yaml | 2 +- Documentation/devicetree/bindings/nvmem/fsl,layerscape-sfp.yaml | 2 +- Documentation/devicetree/bindings/nvmem/imx-iim.yaml | 2 +- Documentation/devicetree/bindings/nvmem/imx-ocotp.yaml | 2 +- .../devicetree/bindings/nvmem/ingenic,jz4780-efuse.yaml | 2 +- Documentation/devicetree/bindings/nvmem/mediatek,efuse.yaml | 2 +- .../devicetree/bindings/nvmem/microchip,sama7g5-otpc.yaml | 2 +- Documentation/devicetree/bindings/nvmem/mxs-ocotp.yaml | 2 +- Documentation/devicetree/bindings/nvmem/nintendo-otp.yaml | 2 +- Documentation/devicetree/bindings/nvmem/qcom,qfprom.yaml | 2 +- Documentation/devicetree/bindings/nvmem/qcom,spmi-sdam.yaml | 2 +- Documentation/devicetree/bindings/nvmem/rmem.yaml | 2 +- Documentation/devicetree/bindings/nvmem/rockchip-efuse.yaml | 2 +- .../devicetree/bindings/nvmem/socionext,uniphier-efuse.yaml | 2 +- Documentation/devicetree/bindings/nvmem/st,stm32-romem.yaml | 2 +- .../devicetree/bindings/nvmem/sunplus,sp7021-ocotp.yaml | 2 +- 18 files changed, 18 insertions(+), 18 deletions(-) diff --git a/Documentation/devicetree/bindings/nvmem/allwinner,sun4i-a10-si= d.yaml b/Documentation/devicetree/bindings/nvmem/allwinner,sun4i-a10-sid.ya= ml index 14c170c6a86e..296001e7f498 100644 --- a/Documentation/devicetree/bindings/nvmem/allwinner,sun4i-a10-sid.yaml +++ b/Documentation/devicetree/bindings/nvmem/allwinner,sun4i-a10-sid.yaml @@ -11,7 +11,7 @@ maintainers: - Maxime Ripard =20 allOf: - - $ref: "nvmem.yaml#" + - $ref: nvmem.yaml# =20 properties: compatible: diff --git a/Documentation/devicetree/bindings/nvmem/apple,efuses.yaml b/Do= cumentation/devicetree/bindings/nvmem/apple,efuses.yaml index 5ec8f2bdb3a5..e0860b6b85f3 100644 --- a/Documentation/devicetree/bindings/nvmem/apple,efuses.yaml +++ b/Documentation/devicetree/bindings/nvmem/apple,efuses.yaml @@ -15,7 +15,7 @@ maintainers: - Sven Peter =20 allOf: - - $ref: "nvmem.yaml#" + - $ref: nvmem.yaml# =20 properties: compatible: diff --git a/Documentation/devicetree/bindings/nvmem/brcm,nvram.yaml b/Docu= mentation/devicetree/bindings/nvmem/brcm,nvram.yaml index 25033de3ef6b..36def7128fca 100644 --- a/Documentation/devicetree/bindings/nvmem/brcm,nvram.yaml +++ b/Documentation/devicetree/bindings/nvmem/brcm,nvram.yaml @@ -20,7 +20,7 @@ maintainers: - Rafa=C5=82 Mi=C5=82ecki =20 allOf: - - $ref: "nvmem.yaml#" + - $ref: nvmem.yaml# =20 properties: compatible: diff --git a/Documentation/devicetree/bindings/nvmem/fsl,layerscape-sfp.yam= l b/Documentation/devicetree/bindings/nvmem/fsl,layerscape-sfp.yaml index 3b4e6e94cb81..70fb2ad25103 100644 --- a/Documentation/devicetree/bindings/nvmem/fsl,layerscape-sfp.yaml +++ b/Documentation/devicetree/bindings/nvmem/fsl,layerscape-sfp.yaml @@ -14,7 +14,7 @@ description: | unique identifier per part. =20 allOf: - - $ref: "nvmem.yaml#" + - $ref: nvmem.yaml# =20 properties: compatible: diff --git a/Documentation/devicetree/bindings/nvmem/imx-iim.yaml b/Documen= tation/devicetree/bindings/nvmem/imx-iim.yaml index 7aac1995cfaf..e9d9d8df4811 100644 --- a/Documentation/devicetree/bindings/nvmem/imx-iim.yaml +++ b/Documentation/devicetree/bindings/nvmem/imx-iim.yaml @@ -14,7 +14,7 @@ description: | i.MX25, i.MX27, i.MX31, i.MX35, i.MX51 and i.MX53 SoCs. =20 allOf: - - $ref: "nvmem.yaml#" + - $ref: nvmem.yaml# =20 properties: compatible: diff --git a/Documentation/devicetree/bindings/nvmem/imx-ocotp.yaml b/Docum= entation/devicetree/bindings/nvmem/imx-ocotp.yaml index d0a239d7e199..9876243ff1e8 100644 --- a/Documentation/devicetree/bindings/nvmem/imx-ocotp.yaml +++ b/Documentation/devicetree/bindings/nvmem/imx-ocotp.yaml @@ -15,7 +15,7 @@ description: | i.MX7D/S, i.MX7ULP, i.MX8MQ, i.MX8MM, i.MX8MN and i.MX8MP SoCs. =20 allOf: - - $ref: "nvmem.yaml#" + - $ref: nvmem.yaml# =20 properties: compatible: diff --git a/Documentation/devicetree/bindings/nvmem/ingenic,jz4780-efuse.y= aml b/Documentation/devicetree/bindings/nvmem/ingenic,jz4780-efuse.yaml index fe2cd7f1afba..e89fd879c968 100644 --- a/Documentation/devicetree/bindings/nvmem/ingenic,jz4780-efuse.yaml +++ b/Documentation/devicetree/bindings/nvmem/ingenic,jz4780-efuse.yaml @@ -10,7 +10,7 @@ maintainers: - PrasannaKumar Muralidharan =20 allOf: - - $ref: "nvmem.yaml#" + - $ref: nvmem.yaml# =20 properties: compatible: diff --git a/Documentation/devicetree/bindings/nvmem/mediatek,efuse.yaml b/= Documentation/devicetree/bindings/nvmem/mediatek,efuse.yaml index 75e0a516e59a..d16d42fb98b6 100644 --- a/Documentation/devicetree/bindings/nvmem/mediatek,efuse.yaml +++ b/Documentation/devicetree/bindings/nvmem/mediatek,efuse.yaml @@ -15,7 +15,7 @@ maintainers: - Lala Lin =20 allOf: - - $ref: "nvmem.yaml#" + - $ref: nvmem.yaml# =20 properties: $nodename: diff --git a/Documentation/devicetree/bindings/nvmem/microchip,sama7g5-otpc= .yaml b/Documentation/devicetree/bindings/nvmem/microchip,sama7g5-otpc.yaml index c3c96fd0baac..a296d348adb4 100644 --- a/Documentation/devicetree/bindings/nvmem/microchip,sama7g5-otpc.yaml +++ b/Documentation/devicetree/bindings/nvmem/microchip,sama7g5-otpc.yaml @@ -15,7 +15,7 @@ description: | settings, chip identifiers) or user specific data could be stored. =20 allOf: - - $ref: "nvmem.yaml#" + - $ref: nvmem.yaml# =20 properties: compatible: diff --git a/Documentation/devicetree/bindings/nvmem/mxs-ocotp.yaml b/Docum= entation/devicetree/bindings/nvmem/mxs-ocotp.yaml index ff317fd7c15b..8938eec22b52 100644 --- a/Documentation/devicetree/bindings/nvmem/mxs-ocotp.yaml +++ b/Documentation/devicetree/bindings/nvmem/mxs-ocotp.yaml @@ -10,7 +10,7 @@ maintainers: - Anson Huang =20 allOf: - - $ref: "nvmem.yaml#" + - $ref: nvmem.yaml# =20 properties: compatible: diff --git a/Documentation/devicetree/bindings/nvmem/nintendo-otp.yaml b/Do= cumentation/devicetree/bindings/nvmem/nintendo-otp.yaml index f93bc50c40d7..6c26800f8b79 100644 --- a/Documentation/devicetree/bindings/nvmem/nintendo-otp.yaml +++ b/Documentation/devicetree/bindings/nvmem/nintendo-otp.yaml @@ -17,7 +17,7 @@ maintainers: - Emmanuel Gil Peyrot =20 allOf: - - $ref: "nvmem.yaml#" + - $ref: nvmem.yaml# =20 properties: compatible: diff --git a/Documentation/devicetree/bindings/nvmem/qcom,qfprom.yaml b/Doc= umentation/devicetree/bindings/nvmem/qcom,qfprom.yaml index 2173fe82317d..e952907ad1d5 100644 --- a/Documentation/devicetree/bindings/nvmem/qcom,qfprom.yaml +++ b/Documentation/devicetree/bindings/nvmem/qcom,qfprom.yaml @@ -10,7 +10,7 @@ maintainers: - Srinivas Kandagatla =20 allOf: - - $ref: "nvmem.yaml#" + - $ref: nvmem.yaml# =20 properties: compatible: diff --git a/Documentation/devicetree/bindings/nvmem/qcom,spmi-sdam.yaml b/= Documentation/devicetree/bindings/nvmem/qcom,spmi-sdam.yaml index 4702f10ecca2..dce0c7d84ce7 100644 --- a/Documentation/devicetree/bindings/nvmem/qcom,spmi-sdam.yaml +++ b/Documentation/devicetree/bindings/nvmem/qcom,spmi-sdam.yaml @@ -15,7 +15,7 @@ description: | to/from the PBUS. =20 allOf: - - $ref: "nvmem.yaml#" + - $ref: nvmem.yaml# =20 properties: compatible: diff --git a/Documentation/devicetree/bindings/nvmem/rmem.yaml b/Documentat= ion/devicetree/bindings/nvmem/rmem.yaml index a4a755dcfc43..38a39c9b8c1c 100644 --- a/Documentation/devicetree/bindings/nvmem/rmem.yaml +++ b/Documentation/devicetree/bindings/nvmem/rmem.yaml @@ -10,7 +10,7 @@ maintainers: - Nicolas Saenz Julienne =20 allOf: - - $ref: "nvmem.yaml#" + - $ref: nvmem.yaml# =20 properties: compatible: diff --git a/Documentation/devicetree/bindings/nvmem/rockchip-efuse.yaml b/= Documentation/devicetree/bindings/nvmem/rockchip-efuse.yaml index febee8129aa9..c5403e149080 100644 --- a/Documentation/devicetree/bindings/nvmem/rockchip-efuse.yaml +++ b/Documentation/devicetree/bindings/nvmem/rockchip-efuse.yaml @@ -10,7 +10,7 @@ maintainers: - Heiko Stuebner =20 allOf: - - $ref: "nvmem.yaml#" + - $ref: nvmem.yaml# =20 properties: compatible: diff --git a/Documentation/devicetree/bindings/nvmem/socionext,uniphier-efu= se.yaml b/Documentation/devicetree/bindings/nvmem/socionext,uniphier-efuse.= yaml index dc790d2cd9f0..b8bca0599c45 100644 --- a/Documentation/devicetree/bindings/nvmem/socionext,uniphier-efuse.yaml +++ b/Documentation/devicetree/bindings/nvmem/socionext,uniphier-efuse.yaml @@ -11,7 +11,7 @@ maintainers: - Kunihiko Hayashi =20 allOf: - - $ref: "nvmem.yaml#" + - $ref: nvmem.yaml# =20 properties: "#address-cells": true diff --git a/Documentation/devicetree/bindings/nvmem/st,stm32-romem.yaml b/= Documentation/devicetree/bindings/nvmem/st,stm32-romem.yaml index 172597cc5c63..a69de3e92282 100644 --- a/Documentation/devicetree/bindings/nvmem/st,stm32-romem.yaml +++ b/Documentation/devicetree/bindings/nvmem/st,stm32-romem.yaml @@ -16,7 +16,7 @@ maintainers: - Fabrice Gasnier =20 allOf: - - $ref: "nvmem.yaml#" + - $ref: nvmem.yaml# =20 properties: compatible: diff --git a/Documentation/devicetree/bindings/nvmem/sunplus,sp7021-ocotp.y= aml b/Documentation/devicetree/bindings/nvmem/sunplus,sp7021-ocotp.yaml index a7644ebbc2ca..8877c2283e9e 100644 --- a/Documentation/devicetree/bindings/nvmem/sunplus,sp7021-ocotp.yaml +++ b/Documentation/devicetree/bindings/nvmem/sunplus,sp7021-ocotp.yaml @@ -11,7 +11,7 @@ maintainers: - Vincent Shih =20 allOf: - - $ref: "nvmem.yaml#" + - $ref: nvmem.yaml# =20 properties: compatible: --=20 2.25.1 From nobody Wed Feb 11 02:33:35 2026 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 6610AC77B60 for ; Tue, 4 Apr 2023 17:24:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236173AbjDDRYI (ORCPT ); Tue, 4 Apr 2023 13:24:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50988 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236170AbjDDRXd (ORCPT ); Tue, 4 Apr 2023 13:23:33 -0400 Received: from mail-ed1-x535.google.com (mail-ed1-x535.google.com [IPv6:2a00:1450:4864:20::535]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 07B714EE8 for ; Tue, 4 Apr 2023 10:23:01 -0700 (PDT) Received: by mail-ed1-x535.google.com with SMTP id y4so133662070edo.2 for ; Tue, 04 Apr 2023 10:23:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1680628979; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=37bCZm+jxTgsQHpxPJv4TAzYWO4tswcf/EDoUUR8XkY=; b=xgVjB+u9yK4UUU/QzhdxLC6mAlpp4wEOaFqzSmR3BgD1tnM2ORred3Nxpupt/VAs+/ flP7G9bBAtILPb54iqBs/7fMxaQhaCrg37TazSDjiz8tYSc4pVBxd9Gs2DAL37InBECr 3PycCyb2LHQrpmPl/e4V/gKNL6yFfuz/9ipW5PdNfwUqAjYNfl+4Hyt1wi/0TSHm5KwI Bi78dNSjiCvZ0U27Z8nNBBQuoN0npEuY9tWfyPPp50FdzxNBLmZBUYK+6acM378o71Xe 1R/nFNCiIhRiczr+bWym+5XOpf7Dh2I1wC9YJ8NQexzl4bP1KuBg3mDdVwPJnQszgDeR WErQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680628979; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=37bCZm+jxTgsQHpxPJv4TAzYWO4tswcf/EDoUUR8XkY=; b=OyK+W03glAYz26y2qYLqfvFAZOF6raf/uG68qvTKDJA7ia8nzvGZqcFfayk8SGoNoQ /6eWAGwfxP/iTCvfTFQuFJi1sJt3hPhyKKZg82SYHsIzz5VhcgnMZ5+jlc/6DcdaT7qm dyd+V8DttwDlyKYonDteBaNCTVXWQ6kt9PhQ7Ljz0HCklmY9Iluk5JAuvKVX4bUrW2u3 nDsTO1iuh/DocEmpk9Gk1HWrvNqmh2bhiA6wj63nSbdsG+FrHfG/Yl0dVqauP4K3mWxL DIaBmlbAGAhsOQhDyKRpCmQyC9iAZRb7rGLbImDPS8cL/KqnCnHGbjQgKIBp+D7gwKDs H9ew== X-Gm-Message-State: AAQBX9ezLGzkdP0QAWnZ1/OzkjxDOjLtjXRT50uruSs6MPaddDSDX7Fk a2iYf1o9oQZIuffO6rtpYP0yYwZrC80nOwBsF20= X-Google-Smtp-Source: AKy350Z/5JgVle7I7asDwRm9CSooysobkdscF8Oqz9hq9AAJ7HWH8BEo4q+KPlJXgnFcFCc/gnqsDg== X-Received: by 2002:a17:906:ae8d:b0:947:d43f:8f06 with SMTP id md13-20020a170906ae8d00b00947d43f8f06mr301645ejb.27.1680628979476; Tue, 04 Apr 2023 10:22:59 -0700 (PDT) Received: from localhost.localdomain ([5.133.47.210]) by smtp.gmail.com with ESMTPSA id bv20-20020a170906b1d400b009447277c2aasm6208333ejb.39.2023.04.04.10.22.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 Apr 2023 10:22:58 -0700 (PDT) From: Srinivas Kandagatla To: gregkh@linuxfoundation.org Cc: linux-kernel@vger.kernel.org, Krzysztof Kozlowski , Srinivas Kandagatla Subject: [PATCH 26/40] nvmem: stm32-romem: mark OF related data as maybe unused Date: Tue, 4 Apr 2023 18:21:34 +0100 Message-Id: <20230404172148.82422-27-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230404172148.82422-1-srinivas.kandagatla@linaro.org> References: <20230404172148.82422-1-srinivas.kandagatla@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Krzysztof Kozlowski The driver can be compile tested with !CONFIG_OF making certain data unused: drivers/nvmem/stm32-romem.c:271:34: error: =E2=80=98stm32_romem_of_match= =E2=80=99 defined but not used [-Werror=3Dunused-const-variable=3D] Signed-off-by: Krzysztof Kozlowski Signed-off-by: Srinivas Kandagatla --- drivers/nvmem/stm32-romem.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/nvmem/stm32-romem.c b/drivers/nvmem/stm32-romem.c index ba779e26937a..38d0bf557129 100644 --- a/drivers/nvmem/stm32-romem.c +++ b/drivers/nvmem/stm32-romem.c @@ -268,7 +268,7 @@ static const struct stm32_romem_cfg stm32mp13_bsec_cfg = =3D { .ta =3D true, }; =20 -static const struct of_device_id stm32_romem_of_match[] =3D { +static const struct of_device_id stm32_romem_of_match[] __maybe_unused =3D= { { .compatible =3D "st,stm32f4-otp", }, { .compatible =3D "st,stm32mp15-bsec", .data =3D (void *)&stm32mp15_bsec_cfg, --=20 2.25.1 From nobody Wed Feb 11 02:33:35 2026 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 D083FC761A6 for ; Tue, 4 Apr 2023 17:24:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236234AbjDDRYL (ORCPT ); Tue, 4 Apr 2023 13:24:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51532 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236053AbjDDRXd (ORCPT ); Tue, 4 Apr 2023 13:23:33 -0400 Received: from mail-ed1-x52b.google.com (mail-ed1-x52b.google.com [IPv6:2a00:1450:4864:20::52b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5D26B1BD7 for ; Tue, 4 Apr 2023 10:23:01 -0700 (PDT) Received: by mail-ed1-x52b.google.com with SMTP id w9so133613095edc.3 for ; Tue, 04 Apr 2023 10:23:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1680628981; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=r2gzNYH0bDm6Lr5uWKUQ2JJneYTqX0cquEENMFQ0oyw=; b=pdovZsCvQkj/BU+GdCyoZR9xp1bPhRdY/zAn1or4ah3BAI95CegkoVB/dhweLJDc7t /6BOtc0hHBHLvTQtonHneVYbUc1jqU4YD7+CXLtvGPRAuCGxPZEgyGBM60F2/VahZ8gM GQvnqls4EwSJeRvNqOtzOwJ60iey6LLzonBLv7avBFgo/ytO3Sfvh4MHQHHCQCrnfwE4 9noskJuIrzoZNudbdW1eXW7BTeEFZN7drXE3Y0PwxWgTKPg++Qh9j1jCc8P9nIJwXQGY 6FfBQoxG8lUgph2yFlfd84C+6HbS8FONtHDcOUSh7BC0GNRGbVIKDASrD9OGQ9sbhzKC zxcg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680628981; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=r2gzNYH0bDm6Lr5uWKUQ2JJneYTqX0cquEENMFQ0oyw=; b=mCKB540xivn12lQAWCAud72Fq86Y9U/KI2nR4aMe3dEAYeITndV26us86QxbOk4rVx FScKYgM41vqxyTqcYXY+k7z2nwnFgIN8aAYLqzYVgrHWRmBsvzEU1fqZBJno9JIUMIfE iWPerLEinVgKq52oUn5VMqEA9wbIz7+tRs3S7E4Vm+06qDmM97LjKIIToHET5kTZJen5 Cg1tGGBgpx8wRRI5U5gD8AQYbTyaM/hmN8yDaA5bSi7kl+S2Cc3FQP4dAqgUdmQcuWKN VN/wF5OuMxJKme3/kyw65k9jOe6NTxho7Kl6O6qc69IlAliUzxF+zDis9zrn3EbOR1FK VDHQ== X-Gm-Message-State: AAQBX9eCed41VS/llPQT4zLA/FqkX02/DTkiiC5Ct2U+GnppxBUgzy8m laeCWgyjGRX+qYXqvLAs3WuDJYJwonOOHrvmzUI= X-Google-Smtp-Source: AKy350a8IeRBjVAtCFBu0Sg2wexxjjzdpCKgnLLaUTZwYjDjYRGBgjNvmJNdIpryp9/mHMHLIOiHIQ== X-Received: by 2002:a17:906:a414:b0:905:a46b:a725 with SMTP id l20-20020a170906a41400b00905a46ba725mr48404ejz.16.1680628980848; Tue, 04 Apr 2023 10:23:00 -0700 (PDT) Received: from localhost.localdomain ([5.133.47.210]) by smtp.gmail.com with ESMTPSA id bv20-20020a170906b1d400b009447277c2aasm6208333ejb.39.2023.04.04.10.22.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 Apr 2023 10:23:00 -0700 (PDT) From: Srinivas Kandagatla To: gregkh@linuxfoundation.org Cc: linux-kernel@vger.kernel.org, AngeloGioacchino Del Regno , Srinivas Kandagatla Subject: [PATCH 27/40] nvmem: mtk-efuse: Support postprocessing for GPU speed binning data Date: Tue, 4 Apr 2023 18:21:35 +0100 Message-Id: <20230404172148.82422-28-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230404172148.82422-1-srinivas.kandagatla@linaro.org> References: <20230404172148.82422-1-srinivas.kandagatla@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: AngeloGioacchino Del Regno On some MediaTek SoCs GPU speed binning data is available for read in the SoC's eFuse array but it has a format that is incompatible with what the OPP API expects, as we read a number from 0 to 7 but opp-supported-hw is expecting a bitmask to enable an OPP entry: being what we read limited to 0-7, it's straightforward to simply convert the value to BIT(value) as a post-processing action. So, introduce post-processing support and enable it by evaluating the newly introduced platform data's `uses_post_processing` member, currently enabled only for MT8186. Signed-off-by: AngeloGioacchino Del Regno Signed-off-by: Srinivas Kandagatla --- drivers/nvmem/mtk-efuse.c | 53 +++++++++++++++++++++++++++++++++++++-- 1 file changed, 51 insertions(+), 2 deletions(-) diff --git a/drivers/nvmem/mtk-efuse.c b/drivers/nvmem/mtk-efuse.c index a08e0aedd21c..b36cd0dcc8c7 100644 --- a/drivers/nvmem/mtk-efuse.c +++ b/drivers/nvmem/mtk-efuse.c @@ -10,6 +10,11 @@ #include #include #include +#include + +struct mtk_efuse_pdata { + bool uses_post_processing; +}; =20 struct mtk_efuse_priv { void __iomem *base; @@ -29,6 +34,37 @@ static int mtk_reg_read(void *context, return 0; } =20 +static int mtk_efuse_gpu_speedbin_pp(void *context, const char *id, int in= dex, + unsigned int offset, void *data, size_t bytes) +{ + u8 *val =3D data; + + if (val[0] < 8) + val[0] =3D BIT(val[0]); + + return 0; +} + +static void mtk_efuse_fixup_cell_info(struct nvmem_device *nvmem, + struct nvmem_layout *layout, + struct nvmem_cell_info *cell) +{ + size_t sz =3D strlen(cell->name); + + /* + * On some SoCs, the GPU speedbin is not read as bitmask but as + * a number with range [0-7] (max 3 bits): post process to use + * it in OPP tables to describe supported-hw. + */ + if (cell->nbits <=3D 3 && + strncmp(cell->name, "gpu-speedbin", min(sz, strlen("gpu-speedbin"))) = =3D=3D 0) + cell->read_post_process =3D mtk_efuse_gpu_speedbin_pp; +} + +static struct nvmem_layout mtk_efuse_layout =3D { + .fixup_cell_info =3D mtk_efuse_fixup_cell_info, +}; + static int mtk_efuse_probe(struct platform_device *pdev) { struct device *dev =3D &pdev->dev; @@ -36,6 +72,7 @@ static int mtk_efuse_probe(struct platform_device *pdev) struct nvmem_device *nvmem; struct nvmem_config econfig =3D {}; struct mtk_efuse_priv *priv; + const struct mtk_efuse_pdata *pdata; =20 priv =3D devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); if (!priv) @@ -45,20 +82,32 @@ static int mtk_efuse_probe(struct platform_device *pdev) if (IS_ERR(priv->base)) return PTR_ERR(priv->base); =20 + pdata =3D device_get_match_data(dev); econfig.stride =3D 1; econfig.word_size =3D 1; econfig.reg_read =3D mtk_reg_read; econfig.size =3D resource_size(res); econfig.priv =3D priv; econfig.dev =3D dev; + if (pdata->uses_post_processing) + econfig.layout =3D &mtk_efuse_layout; nvmem =3D devm_nvmem_register(dev, &econfig); =20 return PTR_ERR_OR_ZERO(nvmem); } =20 +static const struct mtk_efuse_pdata mtk_mt8186_efuse_pdata =3D { + .uses_post_processing =3D true, +}; + +static const struct mtk_efuse_pdata mtk_efuse_pdata =3D { + .uses_post_processing =3D false, +}; + static const struct of_device_id mtk_efuse_of_match[] =3D { - { .compatible =3D "mediatek,mt8173-efuse",}, - { .compatible =3D "mediatek,efuse",}, + { .compatible =3D "mediatek,mt8173-efuse", .data =3D &mtk_efuse_pdata }, + { .compatible =3D "mediatek,mt8186-efuse", .data =3D &mtk_mt8186_efuse_pd= ata }, + { .compatible =3D "mediatek,efuse", .data =3D &mtk_efuse_pdata }, {/* sentinel */}, }; MODULE_DEVICE_TABLE(of, mtk_efuse_of_match); --=20 2.25.1 From nobody Wed Feb 11 02:33:36 2026 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 AC457C77B72 for ; Tue, 4 Apr 2023 17:24:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236062AbjDDRYb (ORCPT ); Tue, 4 Apr 2023 13:24:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51020 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236189AbjDDRXo (ORCPT ); Tue, 4 Apr 2023 13:23:44 -0400 Received: from mail-ed1-x52c.google.com (mail-ed1-x52c.google.com [IPv6:2a00:1450:4864:20::52c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6D5EC59F2 for ; Tue, 4 Apr 2023 10:23:04 -0700 (PDT) Received: by mail-ed1-x52c.google.com with SMTP id er13so92599016edb.9 for ; Tue, 04 Apr 2023 10:23:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1680628982; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=ffX6tYkShhHdyHthSV48egZWIylzQga0AguSbk+fhVU=; b=Z8n4csuGKIzZxlP8DBUC2z+H06eocPVGFPZfaiacqqc4wjxVR/CASnYlLluX5uMEOz Rhnfk+obi6KkOBIEly9ZdGnaYWuR73rIVhB+lP1iXnV614j9Ai6SYLsaVY7PCvwVvUAh aIz+mmHOHgDuc66QNT0YQjXGr/uVGDJMjJvWj8T9dVSRMbX/cxHrBf57o2+m1sTW08nZ AH9oD3rkU9WoufYc9wEdIBG8KeyS0TOqHV6H5Y8IEa97fngC4VA/tvDc4TRLT42bAY1N u8E0/iRk434AXNVVKtKrt01iAx8XBvbVXYmWpgE9/rutthFRz86dx9mLK7FaUXhMYKF5 lftg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680628982; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ffX6tYkShhHdyHthSV48egZWIylzQga0AguSbk+fhVU=; b=ir5aSi0q68tUI0Y0ADblUU5a4FGBxm7KIOfZHOuJ6dlIewRdfA5pVKzU/MC8NYWg2i WIWIa5Hb8bgCdXmRaUk9wSxzWkzOsGoJ5uKD2cg7tM6aE9BBvw0ymNiZokk/9laT26O4 dKEQEX7LDzfOQkZKR3qR2DjeSdarcGkKDjxpDu98ih6RAGJPZj70IpNmKGxnYvE/hzS/ wTPnYoZ/CmuFEHFEHp2ZO5J3lhFm9MDoaudnYKfqzWLWmQe3yIAiJrb9zrsTR2CY2m4K 9C/RsTj7yaShj5Bc/xnxxvrXCJhOpOhEwF04ntuR5F9vSdZphywWW8qAZJxbVpskwcWK +Qxw== X-Gm-Message-State: AAQBX9eHERZrHtmuJ/RC8qHw8JRSfyTbLXqWCiKBKo6pRA72Mn8WaJXx EGapRXD3VSF8Pe8geJeu6dm8+Q== X-Google-Smtp-Source: AKy350bM4+TOxZ1k6cDLckP6zhB+GuHGGSy5ExH/I9z7rTrXW5m3g2T6NDdrYXJvCs05vf4u62dU0w== X-Received: by 2002:a17:906:c7d9:b0:946:c1d2:8b53 with SMTP id dc25-20020a170906c7d900b00946c1d28b53mr267541ejb.72.1680628982148; Tue, 04 Apr 2023 10:23:02 -0700 (PDT) Received: from localhost.localdomain ([5.133.47.210]) by smtp.gmail.com with ESMTPSA id bv20-20020a170906b1d400b009447277c2aasm6208333ejb.39.2023.04.04.10.23.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 Apr 2023 10:23:01 -0700 (PDT) From: Srinivas Kandagatla To: gregkh@linuxfoundation.org Cc: linux-kernel@vger.kernel.org, Konrad Dybcio , Krzysztof Kozlowski , Srinivas Kandagatla Subject: [PATCH 28/40] dt-bindings: nvmem: Add compatible for SM6350 Date: Tue, 4 Apr 2023 18:21:36 +0100 Message-Id: <20230404172148.82422-29-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230404172148.82422-1-srinivas.kandagatla@linaro.org> References: <20230404172148.82422-1-srinivas.kandagatla@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Konrad Dybcio Docuemnt the QFPROM on SM6350. Signed-off-by: Konrad Dybcio Acked-by: Krzysztof Kozlowski Signed-off-by: Srinivas Kandagatla --- Documentation/devicetree/bindings/nvmem/qcom,qfprom.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/Documentation/devicetree/bindings/nvmem/qcom,qfprom.yaml b/Doc= umentation/devicetree/bindings/nvmem/qcom,qfprom.yaml index e952907ad1d5..c20bd9bdcea4 100644 --- a/Documentation/devicetree/bindings/nvmem/qcom,qfprom.yaml +++ b/Documentation/devicetree/bindings/nvmem/qcom,qfprom.yaml @@ -32,6 +32,7 @@ properties: - qcom,sdm670-qfprom - qcom,sdm845-qfprom - qcom,sm6115-qfprom + - qcom,sm6350-qfprom - qcom,sm8150-qfprom - qcom,sm8250-qfprom - const: qcom,qfprom --=20 2.25.1 From nobody Wed Feb 11 02:33:36 2026 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 3B5ABC761A6 for ; Tue, 4 Apr 2023 17:24:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236195AbjDDRYh (ORCPT ); Tue, 4 Apr 2023 13:24:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51656 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236058AbjDDRXr (ORCPT ); Tue, 4 Apr 2023 13:23:47 -0400 Received: from mail-ed1-x52f.google.com (mail-ed1-x52f.google.com [IPv6:2a00:1450:4864:20::52f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C445D5BAE for ; Tue, 4 Apr 2023 10:23:06 -0700 (PDT) Received: by mail-ed1-x52f.google.com with SMTP id i5so133795654eda.0 for ; Tue, 04 Apr 2023 10:23:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1680628983; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=kH+IwbdMeiK6l0tr4Mgf/hkCwwTlXl2IJ4KAuxQWnfU=; b=i3IBjuYHfo2XZaNohQQUqRmBp1wDGl9irS+0Dhv55ZFmuQie5qz3RNY9oHdH0rBqEW 2ZX+ELO9qhV6ANn9dtN3PMzqINch1B37MWn5dNghVB1l98gkWLDqCIlqpt8V0yd/zH4y LPHLiCMAAchGvmPO8w55eL2OM7Sa/PXzrfHqPK0wI2ii6/1wtfJpDa1GtQEokSX45ADh ETxZR74jOMm/DCPehP5gTZvfSWn+Ass1bo/3xHkjuAF/mykOHF06oY/HEsYkxhQRBbNH DARtKO+9vUIyEOO+Inl6Lc1+f6TjeYJICHs4aE765/QqHG9w24BdI05YLqhiZNYQ3wo8 4qvg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680628983; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=kH+IwbdMeiK6l0tr4Mgf/hkCwwTlXl2IJ4KAuxQWnfU=; b=jZ/KrvsHXVUq1pQtprlBLqCxIw9IHP+JvJq7XSGxnjL2hoQCNFA/sXz4CzIveJa7eX +0bjJMP+M8XUkIdUXBOO+W7pmdZ6jw4H3xDovDuHAuh/RaRZeICJ4V6RMEBZMYr/XW1d VhFwkkOGndWBix3AmQizIVtxO2ec0QQWArQxnTHY/kUp61LDovOgGw4vBdR1YMHOmZR1 mSW/fktZqpPfyhi+VIXlYDZ3TzyiJ45tLNAxAM1Tkpi+bpxM3b+ozv7Uvywg4GmObe72 oro57C4kqHcUNXZPXE0gvZZhTOWwmaurAXiW7CquIVLik6uspqvbdUM2kSzxcvOoYUSz nvRw== X-Gm-Message-State: AAQBX9cS9OYq/gou1WHPq5InWnRMKzO9m7O4Fl3enwZgbqKQeGXWAsKA v3jX4/VzRQy/4DqDAgy+7p5SVg== X-Google-Smtp-Source: AKy350YTqAZFwLaxRAxkHcZIpncnWCXM5q16ZHwRS34Gvr3e2bUZxTU5aJmlrYDJqfrV67nofoYNQQ== X-Received: by 2002:a17:906:a846:b0:922:cb10:ad06 with SMTP id dx6-20020a170906a84600b00922cb10ad06mr350530ejb.43.1680628983452; Tue, 04 Apr 2023 10:23:03 -0700 (PDT) Received: from localhost.localdomain ([5.133.47.210]) by smtp.gmail.com with ESMTPSA id bv20-20020a170906b1d400b009447277c2aasm6208333ejb.39.2023.04.04.10.23.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 Apr 2023 10:23:02 -0700 (PDT) From: Srinivas Kandagatla To: gregkh@linuxfoundation.org Cc: linux-kernel@vger.kernel.org, Konrad Dybcio , Krzysztof Kozlowski , Srinivas Kandagatla Subject: [PATCH 29/40] dt-bindings: nvmem: Add compatible for SM6375 Date: Tue, 4 Apr 2023 18:21:37 +0100 Message-Id: <20230404172148.82422-30-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230404172148.82422-1-srinivas.kandagatla@linaro.org> References: <20230404172148.82422-1-srinivas.kandagatla@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Konrad Dybcio Docuemnt the QFPROM on SM6375. Signed-off-by: Konrad Dybcio Acked-by: Krzysztof Kozlowski Signed-off-by: Srinivas Kandagatla --- Documentation/devicetree/bindings/nvmem/qcom,qfprom.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/Documentation/devicetree/bindings/nvmem/qcom,qfprom.yaml b/Doc= umentation/devicetree/bindings/nvmem/qcom,qfprom.yaml index c20bd9bdcea4..8d8503dd934b 100644 --- a/Documentation/devicetree/bindings/nvmem/qcom,qfprom.yaml +++ b/Documentation/devicetree/bindings/nvmem/qcom,qfprom.yaml @@ -33,6 +33,7 @@ properties: - qcom,sdm845-qfprom - qcom,sm6115-qfprom - qcom,sm6350-qfprom + - qcom,sm6375-qfprom - qcom,sm8150-qfprom - qcom,sm8250-qfprom - const: qcom,qfprom --=20 2.25.1 From nobody Wed Feb 11 02:33:36 2026 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 5EAE2C6FD1D for ; Tue, 4 Apr 2023 17:24:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236258AbjDDRYe (ORCPT ); Tue, 4 Apr 2023 13:24:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50628 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236107AbjDDRXp (ORCPT ); Tue, 4 Apr 2023 13:23:45 -0400 Received: from mail-ed1-x52b.google.com (mail-ed1-x52b.google.com [IPv6:2a00:1450:4864:20::52b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3AD675B93 for ; Tue, 4 Apr 2023 10:23:05 -0700 (PDT) Received: by mail-ed1-x52b.google.com with SMTP id ew6so133506419edb.7 for ; Tue, 04 Apr 2023 10:23:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1680628984; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=6heumvUXponVh3RKpQNyq3EGPwF7qwIsRx59+iTBPyU=; b=Yp9SCiNZSJTp63JPfZH8YZ8qGzP7rb8oa8MSHHTMu1pl+4b1OyqkCnRiiMDMYWmHOo nIVyUw9tEdSbsFV8xDMi3EWvGOigXnV6SxPpzn++hBQD1qIz2OYsoPm7bAIg8/cicw5Z rtpJtY6pIKQM/MTPITfMNxYTX6bCr65taFdVWJI/V1JmK3hCW8GXwAaxWGSMwEcVWjlL 1l4YufvykMiiO3yPF27TA2TYnhsCLWzYOWXGhJzzBQ1lPLLzcEL5lRqS3ZyC9iseEyLp VreYJtOhvzFsuHYWrTsJAqVeAysGbNObHZzP9igrZ1jcS6XEj+iJEjeFAfRKFJ2V8t0u 6rJA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680628985; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=6heumvUXponVh3RKpQNyq3EGPwF7qwIsRx59+iTBPyU=; b=apc3I3wg/GoOMa6I40kYb0e2m7VBWvRoLFiJOVOrArvLH5NMVtsTp/K0KB66qB6yi5 evmxdlTqSIlBT2c2eEo2DJdTMFJU0AtBzAEXMoi0b/59XC62LsZUt81GoGZ7zEwYG7MC 2WFizuQqBWuqwMdKOIYdOcXZIBepxMLUvUQQbuoGnH2hgU7YiNFC8wreJJtN7DtKG3PU ssXE6NmH5yJwS0qH0qC1l0zwVy4YwE2KGt6elzOH746Cr3EEWxOBbkfR1gnrPNRLLjAA kHO7NHC56WPcIlmxv+NhcL6pQKTrJfrx2XPDSmRi8pyKK/yVEPfj/oVegZ932XZ+mgCf vblg== X-Gm-Message-State: AAQBX9dB5YMWQgUD7dDG4Ngj6a/aAbdx9ENoAgkqg6RPrxqd868tI0Ea 7jusPjoA63WLGkQfgCVN9PlnnsT/okMSbSo9GiI= X-Google-Smtp-Source: AKy350aNqmYN/WQcKwVijzyP7tSEI+6Rjsqzm32p/BK9AK8Oayr3zjOyYBNbJZgJxlAiyvXPjHcnLw== X-Received: by 2002:a17:906:3591:b0:932:6601:4910 with SMTP id o17-20020a170906359100b0093266014910mr263725ejb.54.1680628984848; Tue, 04 Apr 2023 10:23:04 -0700 (PDT) Received: from localhost.localdomain ([5.133.47.210]) by smtp.gmail.com with ESMTPSA id bv20-20020a170906b1d400b009447277c2aasm6208333ejb.39.2023.04.04.10.23.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 Apr 2023 10:23:04 -0700 (PDT) From: Srinivas Kandagatla To: gregkh@linuxfoundation.org Cc: linux-kernel@vger.kernel.org, Yang Li , Srinivas Kandagatla Subject: [PATCH 30/40] nvmem: bcm-ocotp: Use devm_platform_ioremap_resource() Date: Tue, 4 Apr 2023 18:21:38 +0100 Message-Id: <20230404172148.82422-31-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230404172148.82422-1-srinivas.kandagatla@linaro.org> References: <20230404172148.82422-1-srinivas.kandagatla@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Yang Li According to commit 7945f929f1a7 ("drivers: provide devm_platform_ioremap_resource()"), convert platform_get_resource(), devm_ioremap_resource() to a single call to use devm_platform_ioremap_resource(), as this is exactly what this function does. Signed-off-by: Yang Li Signed-off-by: Srinivas Kandagatla --- drivers/nvmem/bcm-ocotp.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/nvmem/bcm-ocotp.c b/drivers/nvmem/bcm-ocotp.c index a128c7f5e351..0c1fa0c4feb2 100644 --- a/drivers/nvmem/bcm-ocotp.c +++ b/drivers/nvmem/bcm-ocotp.c @@ -244,7 +244,6 @@ MODULE_DEVICE_TABLE(acpi, bcm_otpc_acpi_ids); static int bcm_otpc_probe(struct platform_device *pdev) { struct device *dev =3D &pdev->dev; - struct resource *res; struct otpc_priv *priv; struct nvmem_device *nvmem; int err; @@ -259,8 +258,7 @@ static int bcm_otpc_probe(struct platform_device *pdev) return -ENODEV; =20 /* Get OTP base address register. */ - res =3D platform_get_resource(pdev, IORESOURCE_MEM, 0); - priv->base =3D devm_ioremap_resource(dev, res); + priv->base =3D devm_platform_ioremap_resource(pdev, 0); if (IS_ERR(priv->base)) { dev_err(dev, "unable to map I/O memory\n"); return PTR_ERR(priv->base); --=20 2.25.1 From nobody Wed Feb 11 02:33:36 2026 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 BC602C77B60 for ; Tue, 4 Apr 2023 17:24:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236271AbjDDRYj (ORCPT ); Tue, 4 Apr 2023 13:24:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51720 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236118AbjDDRXv (ORCPT ); Tue, 4 Apr 2023 13:23:51 -0400 Received: from mail-ed1-x530.google.com (mail-ed1-x530.google.com [IPv6:2a00:1450:4864:20::530]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DFB1D525D for ; Tue, 4 Apr 2023 10:23:07 -0700 (PDT) Received: by mail-ed1-x530.google.com with SMTP id cn12so133624026edb.4 for ; Tue, 04 Apr 2023 10:23:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1680628986; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=uvAzoe1b3cbHk9YpQHH8E4MaQt9Ov/zayig/gEAkSYY=; b=FejMfnLgJLRtcGzWR6AUIdcnn41XEKgD68h25XfjtAKnbiIwJV1bm5ynjnN/2rRfuW ipuIi+JZZqMRx35LuiihXedJpHzuELyijxgAFyy+SSWwnSm5GFH1R+g6Gwi7cBZTH+e1 LwrGtZrlKgqZIHXqBD3ZJghrj3vtzkdQxSCmpCbPWQmXbFH+uTRyWioM53z5CbydYaXM zWbz7fWoO8Un2B7IG4tgSu+KxfvQ6+l/JFy+wTlqZKQE35vJYdzaSkchiKf5JcJpdwHx oUw1pMmPYaiwpT0MQ1tZBdNueJcg7J4rgNIkDpa3RcwhALp+rXKNI8NoyccXvcJrjx4T /UoQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680628986; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=uvAzoe1b3cbHk9YpQHH8E4MaQt9Ov/zayig/gEAkSYY=; b=42B8w2qi1z4GpHcDkYQQuxHWeMYXr70VwqMV4rHsCRxQbp5MrCxKjc9ewLuxRMxUsM 3DJdssdMHVbAii4INPiZJDSNUzrcAdW2WZDni5YznR5YDjbAhcAJv5gEOx4pZZ7eCEJU SFbp/lHBtqXkI4tTTXAVgcZOb012tW5bHB1SR+QO9ySeQFd3vPSeYfMicCWfXwLH8ReT xh2yqsJw4f3XMfsJl691XLIJWMqpNigIGSgouW09V6yuOFY+yu35mgHeaTutB9LxM9E0 i7HgAP/I3AGws1VwsHPE3G3y5QW0VvLF4ISDVkMxgF/V/0HTFBi8tgdxzsAkxJot0hsA m6rw== X-Gm-Message-State: AAQBX9c9ecZE9PCcgFgYWfor26RQ6kL4BIhl/INwcwyQO76YpD/j3dtO +VxFpI78nKS1YF4AW86qgrgBeA== X-Google-Smtp-Source: AKy350a7ukTbSV4sHBKuqpeH7f3yaADFNC85upAJVD0nscoxc1trtoS1mW16cVomAIS5crwk+TsVig== X-Received: by 2002:a17:906:c253:b0:88c:6345:d0e7 with SMTP id bl19-20020a170906c25300b0088c6345d0e7mr330912ejb.36.1680628985932; Tue, 04 Apr 2023 10:23:05 -0700 (PDT) Received: from localhost.localdomain ([5.133.47.210]) by smtp.gmail.com with ESMTPSA id bv20-20020a170906b1d400b009447277c2aasm6208333ejb.39.2023.04.04.10.23.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 Apr 2023 10:23:05 -0700 (PDT) From: Srinivas Kandagatla To: gregkh@linuxfoundation.org Cc: linux-kernel@vger.kernel.org, Yang Li , Srinivas Kandagatla Subject: [PATCH 31/40] nvmem: nintendo-otp: Use devm_platform_ioremap_resource() Date: Tue, 4 Apr 2023 18:21:39 +0100 Message-Id: <20230404172148.82422-32-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230404172148.82422-1-srinivas.kandagatla@linaro.org> References: <20230404172148.82422-1-srinivas.kandagatla@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Yang Li According to commit 7945f929f1a7 ("drivers: provide devm_platform_ioremap_resource()"), convert platform_get_resource(), devm_ioremap_resource() to a single call to use devm_platform_ioremap_resource(), as this is exactly what this function does. Signed-off-by: Yang Li Signed-off-by: Srinivas Kandagatla --- drivers/nvmem/nintendo-otp.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/nvmem/nintendo-otp.c b/drivers/nvmem/nintendo-otp.c index 33961b17f9f1..355e7f1fc6d5 100644 --- a/drivers/nvmem/nintendo-otp.c +++ b/drivers/nvmem/nintendo-otp.c @@ -76,7 +76,6 @@ static int nintendo_otp_probe(struct platform_device *pde= v) struct device *dev =3D &pdev->dev; const struct of_device_id *of_id =3D of_match_device(nintendo_otp_of_table, dev); - struct resource *res; struct nvmem_device *nvmem; struct nintendo_otp_priv *priv; =20 @@ -92,8 +91,7 @@ static int nintendo_otp_probe(struct platform_device *pde= v) if (!priv) return -ENOMEM; =20 - res =3D platform_get_resource(pdev, IORESOURCE_MEM, 0); - priv->regs =3D devm_ioremap_resource(dev, res); + priv->regs =3D devm_platform_ioremap_resource(pdev, 0); if (IS_ERR(priv->regs)) return PTR_ERR(priv->regs); =20 --=20 2.25.1 From nobody Wed Feb 11 02:33:36 2026 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 48062C6FD1D for ; Tue, 4 Apr 2023 17:24:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236076AbjDDRYm (ORCPT ); Tue, 4 Apr 2023 13:24:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50908 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236073AbjDDRXy (ORCPT ); Tue, 4 Apr 2023 13:23:54 -0400 Received: from mail-ed1-x534.google.com (mail-ed1-x534.google.com [IPv6:2a00:1450:4864:20::534]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3355D1989 for ; Tue, 4 Apr 2023 10:23:11 -0700 (PDT) Received: by mail-ed1-x534.google.com with SMTP id w9so133614422edc.3 for ; Tue, 04 Apr 2023 10:23:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1680628987; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=mFsfV7hsM6XKzUvXvJ4Lm+4Z62w55R1k2YUgVy5mdyg=; b=EKmGUwG1k8r9F3oL6NMW2rFa5NIEDu14lDh1zopBRj7aBtdPn6ev4Du9Y+y+cMmVtq R2oyw0/9YQ5WWaGLfkuJF+Xps4LhWz9E9+cuAmANFtnPsb4AJ/c1+2B5g2O54C9S/tMZ xLgKw3y1EQSS8z4xiqDZkHtrOyYYi7fCItjLHaq1Q+XwFJna28S1P0i3YNCXhA+vr4VK tCOAZNIJTAEd0eh3FEBo/+tAG1eikGoAjKyMKqr+gCUy33SB0auNm4xqYjfZBfbC+JdX OnHjMz6xtwSOI5X73YkQfMYg3rhS8DKhLcSuL8L7Ie7jDSz9qEbQm5vvzeBfkUXtQYIe jmmA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680628987; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=mFsfV7hsM6XKzUvXvJ4Lm+4Z62w55R1k2YUgVy5mdyg=; b=2oxQT2VEQK4v4/Bd4twXcPFrMFWTbMHAhdV4VxGSqHYjSrTWBnEC1zCUsilTTuTw2+ 1Jk4spG90NV67xstYjLLm8J8Ryzz5REVJPqBMMhhG03qFQSdQy5H1FkACey7/y9d8sf9 5Jiagv/y3pnhSYgO+IrMAyi8KqY3zL+n4XGc9wQaSqKn+L6qEVct9fPnA6hW1XCuyjIZ 6dBb50Fy/oWjtFDLwMiZ7rkvDMYWYqYdNzajvXespIk1mmbe9DUW1dQLEKtHck7T+wr8 4j1HyeDntXy7aAvur3hwtf27HsF0491nv2sRqkXxg0Bn+5AZT/BC5Sch0LEJaN3t0Dvt QOGg== X-Gm-Message-State: AAQBX9cBJnMDk5Lpm4bvuh3hpexjNNuMAfOHnrEiOO260nAO6XmADCEx RUh++hqs13uE8VaYSOdO3Kjpxw== X-Google-Smtp-Source: AKy350Zoqr6ggb/KrGaz12ITlEnFnQ3RxoLuz2e3aXAWAbAfFQyjPuI5+OAfcOwzs/ADx5ocuTLqug== X-Received: by 2002:a17:906:13c9:b0:932:5f7d:db33 with SMTP id g9-20020a17090613c900b009325f7ddb33mr317322ejc.34.1680628987496; Tue, 04 Apr 2023 10:23:07 -0700 (PDT) Received: from localhost.localdomain ([5.133.47.210]) by smtp.gmail.com with ESMTPSA id bv20-20020a170906b1d400b009447277c2aasm6208333ejb.39.2023.04.04.10.23.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 Apr 2023 10:23:06 -0700 (PDT) From: Srinivas Kandagatla To: gregkh@linuxfoundation.org Cc: linux-kernel@vger.kernel.org, Yang Li , Srinivas Kandagatla Subject: [PATCH 32/40] nvmem: vf610-ocotp: Use devm_platform_get_and_ioremap_resource() Date: Tue, 4 Apr 2023 18:21:40 +0100 Message-Id: <20230404172148.82422-33-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230404172148.82422-1-srinivas.kandagatla@linaro.org> References: <20230404172148.82422-1-srinivas.kandagatla@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Yang Li According to commit 890cc39a8799 ("drivers: provide devm_platform_get_and_ioremap_resource()"), convert platform_get_resource(), devm_ioremap_resource() to a single call to devm_platform_get_and_ioremap_resource(), as this is exactly what this function does. Signed-off-by: Yang Li Signed-off-by: Srinivas Kandagatla --- drivers/nvmem/vf610-ocotp.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/nvmem/vf610-ocotp.c b/drivers/nvmem/vf610-ocotp.c index 5b6cad16892f..ee9c61ae727d 100644 --- a/drivers/nvmem/vf610-ocotp.c +++ b/drivers/nvmem/vf610-ocotp.c @@ -219,8 +219,7 @@ static int vf610_ocotp_probe(struct platform_device *pd= ev) if (!ocotp_dev) return -ENOMEM; =20 - res =3D platform_get_resource(pdev, IORESOURCE_MEM, 0); - ocotp_dev->base =3D devm_ioremap_resource(dev, res); + ocotp_dev->base =3D devm_platform_get_and_ioremap_resource(pdev, 0, &res); if (IS_ERR(ocotp_dev->base)) return PTR_ERR(ocotp_dev->base); =20 --=20 2.25.1 From nobody Wed Feb 11 02:33:36 2026 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 C9AAFC77B60 for ; Tue, 4 Apr 2023 17:24:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236282AbjDDRYp (ORCPT ); Tue, 4 Apr 2023 13:24:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52474 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236037AbjDDRXz (ORCPT ); Tue, 4 Apr 2023 13:23:55 -0400 Received: from mail-ed1-x533.google.com (mail-ed1-x533.google.com [IPv6:2a00:1450:4864:20::533]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 337971BC0 for ; Tue, 4 Apr 2023 10:23:12 -0700 (PDT) Received: by mail-ed1-x533.google.com with SMTP id i5so133796669eda.0 for ; Tue, 04 Apr 2023 10:23:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1680628988; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=9bSrBEoUzAuZwnOgxeNQWaMOoCVfz/jZ0vkkcRtm1gA=; b=tY+wb8fM9wCLUsGutS9E+AjiYzFE+rr9xd//J5RYqYgdBrGj7pwXkg4gfWCbXQcHCd lHxJMc/2Fts+QvCZxhxQ8LbKEl7A1qcbWimTq0FBHMDcgQ94fniWG0uRCS3DccSq0m85 8wzRVdCha0Q2vSYC5rNabmwvDmfNAJQk7ZS8ttKmDZZTZ6Waq0XPveo7piJGoTUrgLCS HiQXC3T7avLmlyZnHPq6uKu02drGPIewLh8zsMdx5DqZfVBblFXbsKI5+2+rYTEInpda 1IG4okTNnx6/yN3haKRmo7oQKf06lqaa6ZNUjoENq3WfahjDzqQR1Q7roQ/d0k2Vthdq qTwg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680628988; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=9bSrBEoUzAuZwnOgxeNQWaMOoCVfz/jZ0vkkcRtm1gA=; b=FTrdB4buG3gti9roLHYogKIzR1Om1oy8nmBzx9FbrzxgcK6ohzgpybV0U+42A/zjjg kra4iaAbLUKBpE1DILbltcS4jHDcjeWxgDQK07xQEyggdYPGnnyieqYdQlgG1k38Z3/A VCi+VTY9x6pAt/dUi0i0hSsAwZFX3BxZEKdl5jm4POs5M3enLS5Ls7PgRxo67Rkrsirm uWc1rIKZlo61hQc35+nyBk5YTMF8Vp+vSbmPLUmfeVnkuywHD+kM0i5WjvNRHwRUHXn+ szc3YMjHrHU1HxoDyoSnzzKRL+qxmF7+oaptaMqadSbXnMLTN7VpWgwjYFPfxjpeXBku cR2w== X-Gm-Message-State: AAQBX9fzsC0p13gcTtWYHnOZCaXip1IJrcw26R4fv2xjGJQWvnprfnWB 5kRo5E9UVYtRtKyl5N9ycrBhEg== X-Google-Smtp-Source: AKy350YQOncoISSUhSMcMV4SChsXiVpPlZ5linPuEZKQ5XFkkvBxORLO8YfeDp9KmZfQ2bGZk6sAFw== X-Received: by 2002:a17:906:9250:b0:8f6:88b7:73a7 with SMTP id c16-20020a170906925000b008f688b773a7mr88133ejx.7.1680628988850; Tue, 04 Apr 2023 10:23:08 -0700 (PDT) Received: from localhost.localdomain ([5.133.47.210]) by smtp.gmail.com with ESMTPSA id bv20-20020a170906b1d400b009447277c2aasm6208333ejb.39.2023.04.04.10.23.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 Apr 2023 10:23:08 -0700 (PDT) From: Srinivas Kandagatla To: gregkh@linuxfoundation.org Cc: linux-kernel@vger.kernel.org, =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= , Rob Herring , Srinivas Kandagatla Subject: [PATCH 33/40] dt-bindings: nvmem: u-boot,env: add MAC's #nvmem-cell-cells Date: Tue, 4 Apr 2023 18:21:41 +0100 Message-Id: <20230404172148.82422-34-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230404172148.82422-1-srinivas.kandagatla@linaro.org> References: <20230404172148.82422-1-srinivas.kandagatla@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Rafa=C5=82 Mi=C5=82ecki U-Boot's "ethaddr" environment variable is very often used to store *base* MAC address. It's used as a base for calculating addresses for multiple interfaces. It's done by adding proper values. Actual offsets are picked by manufacturers and vary across devices. Signed-off-by: Rafa=C5=82 Mi=C5=82ecki Reviewed-by: Rob Herring Signed-off-by: Srinivas Kandagatla --- Documentation/devicetree/bindings/nvmem/u-boot,env.yaml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Documentation/devicetree/bindings/nvmem/u-boot,env.yaml b/Docu= mentation/devicetree/bindings/nvmem/u-boot,env.yaml index cbc5c69fd405..36d97fb87865 100644 --- a/Documentation/devicetree/bindings/nvmem/u-boot,env.yaml +++ b/Documentation/devicetree/bindings/nvmem/u-boot,env.yaml @@ -50,7 +50,11 @@ properties: =20 ethaddr: type: object - description: Ethernet interface's MAC address + description: Ethernet interfaces base MAC address. + properties: + "#nvmem-cell-cells": + description: The first argument is a MAC address offset. + const: 1 =20 additionalProperties: false =20 @@ -72,6 +76,7 @@ examples: reg =3D <0x40000 0x10000>; =20 mac: ethaddr { + #nvmem-cell-cells =3D <1>; }; }; }; --=20 2.25.1 From nobody Wed Feb 11 02:33:36 2026 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 036BDC6FD1D for ; Tue, 4 Apr 2023 17:25:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236115AbjDDRZL (ORCPT ); Tue, 4 Apr 2023 13:25:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50932 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236205AbjDDRX5 (ORCPT ); Tue, 4 Apr 2023 13:23:57 -0400 Received: from mail-ed1-x533.google.com (mail-ed1-x533.google.com [IPv6:2a00:1450:4864:20::533]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 058845FDC for ; Tue, 4 Apr 2023 10:23:15 -0700 (PDT) Received: by mail-ed1-x533.google.com with SMTP id w9so133614911edc.3 for ; Tue, 04 Apr 2023 10:23:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1680628990; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=vzeb5V/SOEGPt1++ztmrQsHaT6myWHiPy1gZ7kZBJII=; b=JHsg3sox3P/oVO7yc/tm0IKSC3s5sE8Dmoho40tXAtg5RoLy9xAX0UZjXDIfV6gzg1 CRFpKY2O6Y28IiH0HsZHlfDPdLvrGG7GKS1PvMN0r19O/3mzXkjwTfUKjn+86Kdvc8n1 rQ2zDWMjyJ5aJdrHFYBSehkwokcngYcBaCP83Hth4ddzD+c7lZSI7TMQiuVg76FQA6ZO DFec6soEes8FLGltiU3mh51Zsk41+58M2VFJvaAkolaLUGJ6lsvdlajky+XxulWneTX5 Nz8QB820k2aYkVgpGk+V/OpP1irTnSwDZXRX8XX+YqGxiVCuSSa8iWiGz8FK9vLhrpK8 wpsQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680628990; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=vzeb5V/SOEGPt1++ztmrQsHaT6myWHiPy1gZ7kZBJII=; b=OSX1XJlApXseafHJnRVXdD9/91afE3SOZZk7VQGBiWuO3aRlVtV7XlUFLAsuQGWjC2 hR5DLLLtyW03Z85uhnNmI+LluB1NIik3YjC9RtQ7AeONtCjIXn/HiDlf+nuLfCcx3Vcp oMAh9Y81okQHZLxrbbvtFA85Obqu+o6EfW3rMH1DY5wb2MP3xeuQjqrceuTOqLewdecB KZ6gOCHQF2ROHH3quTttYnmv2cLb/VWdJnynxEokYpB6+Fiwak4bMFOArQ+ujxjk6ryz 4jDKE8UoIQu1yguslWWVDQSh1xRicLqHk9ceHEvmqVp9FHWAxHK6SEJGWvjazwa1GJbW fs/Q== X-Gm-Message-State: AAQBX9cWDqqnXrqk6bGycSC++ZJtNGgadllSGSNiX6Kbjz3aNrxGMA9r eNhzmArKOV2FL2pFp28YAlrbIA== X-Google-Smtp-Source: AKy350YOQeYLWZxddlltWQg0FzMK7YV6rINPyt5V0FjVmjK/Y8PjtX1T5RRT8xpmpm2u0nu1nesSfQ== X-Received: by 2002:a17:907:2bd2:b0:931:a0cb:1ef1 with SMTP id gv18-20020a1709072bd200b00931a0cb1ef1mr296415ejc.7.1680628990081; Tue, 04 Apr 2023 10:23:10 -0700 (PDT) Received: from localhost.localdomain ([5.133.47.210]) by smtp.gmail.com with ESMTPSA id bv20-20020a170906b1d400b009447277c2aasm6208333ejb.39.2023.04.04.10.23.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 Apr 2023 10:23:09 -0700 (PDT) From: Srinivas Kandagatla To: gregkh@linuxfoundation.org Cc: linux-kernel@vger.kernel.org, =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= , Srinivas Kandagatla Subject: [PATCH 34/40] nvmem: core: support specifying both: cell raw data & post read lengths Date: Tue, 4 Apr 2023 18:21:42 +0100 Message-Id: <20230404172148.82422-35-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230404172148.82422-1-srinivas.kandagatla@linaro.org> References: <20230404172148.82422-1-srinivas.kandagatla@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Rafa=C5=82 Mi=C5=82ecki Callback .read_post_process() is designed to modify raw cell content before providing it to the consumer. So far we were dealing with modifications that didn't affect cell size (length). In some cases however cell content needs to be reformatted and resized. It's required e.g. to provide properly formatted MAC address in case it's stored in a non-binary format (e.g. using ASCII). There were few discussions how to optimally handle that. Following possible solutions were considered: 1. Allow .read_post_process() to realloc (resize) content buffer 2. Allow .read_post_process() to adjust (decrease) just buffer length 3. Register NVMEM cells using post-read sizes The preferred solution was the last one. The problem is that simply adjusting "bytes" in NVMEM providers would result in core code NOT passing whole raw data to .read_post_process() callbacks. It means callback functions couldn't do their job without somehow manually reading original cell content on their own. This patch deals with that by registering NVMEM cells with both lengths: raw content one and post read one. It allows: 1. Core code to read whole raw cell content 2. Callbacks to return content they want Signed-off-by: Rafa=C5=82 Mi=C5=82ecki Signed-off-by: Srinivas Kandagatla --- drivers/nvmem/core.c | 11 +++++++---- include/linux/nvmem-provider.h | 2 ++ 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c index 212c5ba5789f..a62973d010ff 100644 --- a/drivers/nvmem/core.c +++ b/drivers/nvmem/core.c @@ -50,6 +50,7 @@ struct nvmem_device { struct nvmem_cell_entry { const char *name; int offset; + size_t raw_len; int bytes; int bit_offset; int nbits; @@ -469,6 +470,7 @@ static int nvmem_cell_info_to_nvmem_cell_entry_nodup(st= ruct nvmem_device *nvmem, { cell->nvmem =3D nvmem; cell->offset =3D info->offset; + cell->raw_len =3D info->raw_len ?: info->bytes; cell->bytes =3D info->bytes; cell->name =3D info->name; cell->read_post_process =3D info->read_post_process; @@ -1560,7 +1562,7 @@ static int __nvmem_cell_read(struct nvmem_device *nvm= em, { int rc; =20 - rc =3D nvmem_reg_read(nvmem, cell->offset, buf, cell->bytes); + rc =3D nvmem_reg_read(nvmem, cell->offset, buf, cell->raw_len); =20 if (rc) return rc; @@ -1571,7 +1573,7 @@ static int __nvmem_cell_read(struct nvmem_device *nvm= em, =20 if (cell->read_post_process) { rc =3D cell->read_post_process(cell->priv, id, index, - cell->offset, buf, cell->bytes); + cell->offset, buf, cell->raw_len); if (rc) return rc; } @@ -1594,14 +1596,15 @@ static int __nvmem_cell_read(struct nvmem_device *n= vmem, */ void *nvmem_cell_read(struct nvmem_cell *cell, size_t *len) { - struct nvmem_device *nvmem =3D cell->entry->nvmem; + struct nvmem_cell_entry *entry =3D cell->entry; + struct nvmem_device *nvmem =3D entry->nvmem; u8 *buf; int rc; =20 if (!nvmem) return ERR_PTR(-EINVAL); =20 - buf =3D kzalloc(cell->entry->bytes, GFP_KERNEL); + buf =3D kzalloc(max_t(size_t, entry->raw_len, entry->bytes), GFP_KERNEL); if (!buf) return ERR_PTR(-ENOMEM); =20 diff --git a/include/linux/nvmem-provider.h b/include/linux/nvmem-provider.h index 0cf9f9490514..8ffb42ba0f62 100644 --- a/include/linux/nvmem-provider.h +++ b/include/linux/nvmem-provider.h @@ -51,6 +51,7 @@ struct nvmem_keepout { * struct nvmem_cell_info - NVMEM cell description * @name: Name. * @offset: Offset within the NVMEM device. + * @raw_len: Length of raw data (without post processing). * @bytes: Length of the cell. * @bit_offset: Bit offset if cell is smaller than a byte. * @nbits: Number of bits. @@ -62,6 +63,7 @@ struct nvmem_keepout { struct nvmem_cell_info { const char *name; unsigned int offset; + size_t raw_len; unsigned int bytes; unsigned int bit_offset; unsigned int nbits; --=20 2.25.1 From nobody Wed Feb 11 02:33:36 2026 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 14457C761A6 for ; Tue, 4 Apr 2023 17:25:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236288AbjDDRYt (ORCPT ); Tue, 4 Apr 2023 13:24:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51376 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236199AbjDDRXz (ORCPT ); Tue, 4 Apr 2023 13:23:55 -0400 Received: from mail-ed1-x52e.google.com (mail-ed1-x52e.google.com [IPv6:2a00:1450:4864:20::52e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A26F755AD for ; Tue, 4 Apr 2023 10:23:11 -0700 (PDT) Received: by mail-ed1-x52e.google.com with SMTP id t10so133439305edd.12 for ; Tue, 04 Apr 2023 10:23:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1680628991; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=5nn6Upx/8lI3MwJj2GpjPhoavYIuxq4AilqaxqKCRx0=; b=UnfAlqdR5cf/UygVfOd2H8cn+UiEPU70W94Si7BjJlm0jURmRiuVg1ZrcklHLzZRbL 7XYMIMSMtMlCX46wR5EQRL8obNGo9PWEhSeauRPOBzrKfmz0s1FqF+ADJSfz/q8cL1q3 Jghli4f5KjD28anELeVMuahASqmszAf1Ujdqi+4YMq46F4d45RyEEHLXea88Ndc8DYQD HwOR4WzpBjoUSM3OUz7h5rOgvRc3kMk9xKKFTgnjVuM23oRp+Giw7R/+2QcuqroOx0Jy Lc4m2pJ8B07agCQVcaLm2bWJtP6H/efteGwhQ0HIwJevXcAyNd8zMUcvnUkHZLPkSteP LezQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680628991; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=5nn6Upx/8lI3MwJj2GpjPhoavYIuxq4AilqaxqKCRx0=; b=S6ep1DUji/pveRUOFZYs5OFr9ZdcFNNDfOafXUamJyYH2rMWB0weisfocM7VabCdA7 I9q4f/FfrCIweDKiEfV7zCnkivDzzVef25DUs7DKjKyqakgAGlUb3AUmmtwKiNUHH6gQ IlXYoFemiybaAitqnxp8W+vnMi6jQE+jEqGAkGN0z3H+UtRyJENejM3PhiXdJ23JfrAd qHHDm6LKbSwMigFG71yjfC+asB0/cik4S4sbpPtp5xzB182W0GqRkA/EyLPoCW8OaVKL ZGzXQ0BzWb6T0i6QW7oNf6PFt5ziTQYgh6eKx75ikle8YItIc1sCzhP/3cx90sO8YgV0 FvOQ== X-Gm-Message-State: AAQBX9euym7TFiHsx1W8avHU7af7Fx/MG0mxreTQ/2mgTBvXQKtUAFiu gRZ2f8dBoyIxFZxt7ZftzFVr9lwUfqLJZugDDMQ= X-Google-Smtp-Source: AKy350bAxpPz+Dt5ZpMM3PEpnZ6ZR0QuXo7FWEcga3C4XogDeCkKZOLpq90cu4ysxZ35OVceCo6wSQ== X-Received: by 2002:a17:906:a04c:b0:93d:f7a6:219b with SMTP id bg12-20020a170906a04c00b0093df7a6219bmr270334ejb.65.1680628991274; Tue, 04 Apr 2023 10:23:11 -0700 (PDT) Received: from localhost.localdomain ([5.133.47.210]) by smtp.gmail.com with ESMTPSA id bv20-20020a170906b1d400b009447277c2aasm6208333ejb.39.2023.04.04.10.23.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 Apr 2023 10:23:10 -0700 (PDT) From: Srinivas Kandagatla To: gregkh@linuxfoundation.org Cc: linux-kernel@vger.kernel.org, =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= , Srinivas Kandagatla Subject: [PATCH 35/40] nvmem: u-boot-env: post-process "ethaddr" env variable Date: Tue, 4 Apr 2023 18:21:43 +0100 Message-Id: <20230404172148.82422-36-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230404172148.82422-1-srinivas.kandagatla@linaro.org> References: <20230404172148.82422-1-srinivas.kandagatla@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Rafa=C5=82 Mi=C5=82ecki U-Boot environment variables are stored in ASCII format so "ethaddr" requires parsing into binary to make it work with Ethernet interfaces. This includes support for indexes to support #nvmem-cell-cells =3D <1>. Signed-off-by: Rafa=C5=82 Mi=C5=82ecki Signed-off-by: Srinivas Kandagatla --- drivers/nvmem/Kconfig | 1 + drivers/nvmem/u-boot-env.c | 26 ++++++++++++++++++++++++++ 2 files changed, 27 insertions(+) diff --git a/drivers/nvmem/Kconfig b/drivers/nvmem/Kconfig index a2afba11c890..b291b27048c7 100644 --- a/drivers/nvmem/Kconfig +++ b/drivers/nvmem/Kconfig @@ -340,6 +340,7 @@ config NVMEM_U_BOOT_ENV tristate "U-Boot environment variables support" depends on OF && MTD select CRC32 + select GENERIC_NET_UTILS help U-Boot stores its setup as environment variables. This driver adds support for verifying & exporting such data. It also exposes variables diff --git a/drivers/nvmem/u-boot-env.c b/drivers/nvmem/u-boot-env.c index 29b1d87a3c51..ee9fd9989b6e 100644 --- a/drivers/nvmem/u-boot-env.c +++ b/drivers/nvmem/u-boot-env.c @@ -4,6 +4,8 @@ */ =20 #include +#include +#include #include #include #include @@ -70,6 +72,25 @@ static int u_boot_env_read(void *context, unsigned int o= ffset, void *val, return 0; } =20 +static int u_boot_env_read_post_process_ethaddr(void *context, const char = *id, int index, + unsigned int offset, void *buf, size_t bytes) +{ + u8 mac[ETH_ALEN]; + + if (bytes !=3D 3 * ETH_ALEN - 1) + return -EINVAL; + + if (!mac_pton(buf, mac)) + return -EINVAL; + + if (index) + eth_addr_add(mac, index); + + ether_addr_copy(buf, mac); + + return 0; +} + static int u_boot_env_add_cells(struct u_boot_env *priv, uint8_t *buf, size_t data_offset, size_t data_len) { @@ -101,6 +122,11 @@ static int u_boot_env_add_cells(struct u_boot_env *pri= v, uint8_t *buf, priv->cells[idx].offset =3D data_offset + value - data; priv->cells[idx].bytes =3D strlen(value); priv->cells[idx].np =3D of_get_child_by_name(dev->of_node, priv->cells[i= dx].name); + if (!strcmp(var, "ethaddr")) { + priv->cells[idx].raw_len =3D strlen(value); + priv->cells[idx].bytes =3D ETH_ALEN; + priv->cells[idx].read_post_process =3D u_boot_env_read_post_process_eth= addr; + } } =20 if (WARN_ON(idx !=3D priv->ncells)) --=20 2.25.1 From nobody Wed Feb 11 02:33:36 2026 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 6ADC2C6FD1D for ; Tue, 4 Apr 2023 17:25:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236206AbjDDRZT (ORCPT ); Tue, 4 Apr 2023 13:25:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52716 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236213AbjDDRYD (ORCPT ); Tue, 4 Apr 2023 13:24:03 -0400 Received: from mail-ed1-x529.google.com (mail-ed1-x529.google.com [IPv6:2a00:1450:4864:20::529]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1234049C3 for ; Tue, 4 Apr 2023 10:23:18 -0700 (PDT) Received: by mail-ed1-x529.google.com with SMTP id r11so133624578edd.5 for ; Tue, 04 Apr 2023 10:23:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1680628992; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=MAEqSElgDVGM5o/UBJBKZXNuT/CdyDaLnFaIEgRZepU=; b=YO8Qhmdl6K5H3uQVYIiiwcRc2OoL429H9mAllTm7ZtmwbDzJcID1fW9BWGyA3S0nKG wUrwdDmnS3d+L7lrFoM1mbmvgZFaPpE+Rl7PuTudbg/6q8EoH6RdBpC/oyifzVcrLkAh mEJ+oaKbZByt3NC1PyNqJB4GFyfeimYlt0ZAke3NqSlDUq7PpSe0QZMdzRO/k89y8FcE LELYkTVCPxbXYKqN8VEKzSDkushNl9qP8sk71ZhG/GXh2NKl8c96TRydK62x9hF7CLCD S+mnc0Q0y2ehj1zB9qay2LDGb2SE6UbptVng64zMdWh+H0wZlx9SOGcJWfn2HYAlxhcV uHDw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680628992; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=MAEqSElgDVGM5o/UBJBKZXNuT/CdyDaLnFaIEgRZepU=; b=ixct9iYId/ww2Pdi16H/DIuVudmOcanz2FlpxWIHckPrL8FQajxvvTxnhsZ9zjWnZO Waw8DQKVJUXX7bpPBCLDpzmhRqyGuNIn4x2GRrGr9eVaz0OqjHLYRj2HkD//InvUSIXR g6xEV89vuDYX7axlcZKgNItk9jcxaBtBck59d1z5dOPsZsgU7GltocvruBjTdCcVZAzA DVtCfG8EWPuzL5dwKosVXmuMVE9JUaNuQuIAzhbRQIXaY99Wt5FB5ti1I6EXoBXZ0V8e 5fd0yTbrlZKxqX5o97kb1+8IOYjsFhA3JyA1A+vvsFDDuYZMnstYPmGjTuLvZEXi6Rzp jlHw== X-Gm-Message-State: AAQBX9fEZ9cgVDpW4hgMh/2swy1sevHleT6YgPie/jcAvWaSb1nnT/2Y Sa/6yJPtMOr7cORFqROho/xe/g== X-Google-Smtp-Source: AKy350aPqDjGf5zdihJRpUGXsxMjsHfF1Nr2e/mLmeyTzMgQdZuFk66zd1/rtbMZJpTyil+ZnkM8oQ== X-Received: by 2002:a17:906:2319:b0:932:b790:932c with SMTP id l25-20020a170906231900b00932b790932cmr329683eja.44.1680628992374; Tue, 04 Apr 2023 10:23:12 -0700 (PDT) Received: from localhost.localdomain ([5.133.47.210]) by smtp.gmail.com with ESMTPSA id bv20-20020a170906b1d400b009447277c2aasm6208333ejb.39.2023.04.04.10.23.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 Apr 2023 10:23:11 -0700 (PDT) From: Srinivas Kandagatla To: gregkh@linuxfoundation.org Cc: linux-kernel@vger.kernel.org, Miquel Raynal , Srinivas Kandagatla , =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= Subject: [PATCH 36/40] nvmem: Add macro to register nvmem layout drivers Date: Tue, 4 Apr 2023 18:21:44 +0100 Message-Id: <20230404172148.82422-37-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230404172148.82422-1-srinivas.kandagatla@linaro.org> References: <20230404172148.82422-1-srinivas.kandagatla@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Miquel Raynal Provide a module_nvmem_layout_driver() macro at the end of the nvmem-provider.h header to reduce the boilerplate when registering nvmem layout drivers. Suggested-by: Srinivas Kandagatla Signed-off-by: Miquel Raynal Acked-by: Rafa=C5=82 Mi=C5=82ecki Signed-off-by: Srinivas Kandagatla --- include/linux/nvmem-provider.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/include/linux/nvmem-provider.h b/include/linux/nvmem-provider.h index 8ffb42ba0f62..dae26295e6be 100644 --- a/include/linux/nvmem-provider.h +++ b/include/linux/nvmem-provider.h @@ -9,6 +9,7 @@ #ifndef _LINUX_NVMEM_PROVIDER_H #define _LINUX_NVMEM_PROVIDER_H =20 +#include #include #include #include @@ -242,4 +243,9 @@ nvmem_layout_get_match_data(struct nvmem_device *nvmem, } =20 #endif /* CONFIG_NVMEM */ + +#define module_nvmem_layout_driver(__layout_driver) \ + module_driver(__layout_driver, nvmem_layout_register, \ + nvmem_layout_unregister) + #endif /* ifndef _LINUX_NVMEM_PROVIDER_H */ --=20 2.25.1 From nobody Wed Feb 11 02:33:36 2026 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 03EE5C6FD1D for ; Tue, 4 Apr 2023 17:25:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236054AbjDDRZI (ORCPT ); Tue, 4 Apr 2023 13:25:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51394 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236202AbjDDRX4 (ORCPT ); Tue, 4 Apr 2023 13:23:56 -0400 Received: from mail-ed1-x531.google.com (mail-ed1-x531.google.com [IPv6:2a00:1450:4864:20::531]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 17A195BA3 for ; Tue, 4 Apr 2023 10:23:13 -0700 (PDT) Received: by mail-ed1-x531.google.com with SMTP id r11so133624761edd.5 for ; Tue, 04 Apr 2023 10:23:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1680628993; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=yyKUqzjTOS4NtnX4zkx/hkORtB7SmmNghDilqsPIWHE=; b=PweQcIJph41f6Ud2YWqxtd4OZYP7DsTJMVCpchAWMks95EFNcz925CzpqCPc23EO46 0C6vuO2x4bR8eqjzE3LC1MX5AGL5lBjHzlGapi8uxIYVtRT5rYY2TC2QlwIfu8JZ2XgK VJbzdW9yb0B0DOczw2Klplq6XdMfefPMF6U8OXDy03awozo67cswU9yJqutFs+9D/YjP hiADlmMbv92DCOK5D2+QxVyUidTm34BjlQSJRQOFhgoOH/g8Qk4mjeiAVIEn3V26zLl4 qfEC1gIqtGVtiTAchGTxkXKQTzim/GCaxtvnMhd4y8wtwjSLouVsBa4mVfV0pGKPIbnh xLwg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680628993; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=yyKUqzjTOS4NtnX4zkx/hkORtB7SmmNghDilqsPIWHE=; b=5oKUfKtU4P1JZpX1cu6IYoDlTABIO3FMSsWbLs2GIkkuRf9JQPg4u+Iz70nAP3yGTL zcOJ4k6t+geDCllx12dgEtCpn+yj/+3qdXGoEyYTTuBHsFoY6NBJajqFdDjvBLjTdMaL YCpZDaEwHeQbaXamTHdkPh7Ac5g86bXqjwCqvBm2PRrfi3Iao8VNwuzr400MUQ34O3zk Bms4Mx9a5loooBOBAnNwsMbzVjK+vD1/+Vhm9qTSBC7s6IWApjScxZwtShX/ygxfIMkL mFkqL7Nvp7+RW5o6dHHgcYuVAhBEmPmYAYXZBhKJl3+7qkQOhhgsBIcutxkGHJstvjFB 0gyA== X-Gm-Message-State: AAQBX9d86LpzxRYRNUVis7ihP0kperZLzIM1WAnRK9pZPUHTgQyOLiD9 IWTOv0n0QslB9AvUG/qgBlUslA== X-Google-Smtp-Source: AKy350aHo0Zarrj6I6c/SdCpH4cEPlwnImtQHdOmdUqwJc5wMeC36wlOZk+NHu0QSqOvujRHBFCL4g== X-Received: by 2002:a17:906:718f:b0:948:d1af:3a11 with SMTP id h15-20020a170906718f00b00948d1af3a11mr286864ejk.50.1680628993561; Tue, 04 Apr 2023 10:23:13 -0700 (PDT) Received: from localhost.localdomain ([5.133.47.210]) by smtp.gmail.com with ESMTPSA id bv20-20020a170906b1d400b009447277c2aasm6208333ejb.39.2023.04.04.10.23.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 Apr 2023 10:23:13 -0700 (PDT) From: Srinivas Kandagatla To: gregkh@linuxfoundation.org Cc: linux-kernel@vger.kernel.org, Miquel Raynal , Srinivas Kandagatla Subject: [PATCH 37/40] nvmem: layouts: sl28vpd: Use module_nvmem_layout_driver() Date: Tue, 4 Apr 2023 18:21:45 +0100 Message-Id: <20230404172148.82422-38-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230404172148.82422-1-srinivas.kandagatla@linaro.org> References: <20230404172148.82422-1-srinivas.kandagatla@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Miquel Raynal Stop open-coding the module init/exit functions. Use the module_nvmem_layout_driver() instead. Signed-off-by: Miquel Raynal Signed-off-by: Srinivas Kandagatla --- drivers/nvmem/layouts/sl28vpd.c | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/drivers/nvmem/layouts/sl28vpd.c b/drivers/nvmem/layouts/sl28vp= d.c index 9370e41bad73..9cc1715c2fd5 100644 --- a/drivers/nvmem/layouts/sl28vpd.c +++ b/drivers/nvmem/layouts/sl28vpd.c @@ -146,19 +146,7 @@ struct nvmem_layout sl28vpd_layout =3D { .of_match_table =3D sl28vpd_of_match_table, .add_cells =3D sl28vpd_add_cells, }; - -static int __init sl28vpd_init(void) -{ - return nvmem_layout_register(&sl28vpd_layout); -} - -static void __exit sl28vpd_exit(void) -{ - nvmem_layout_unregister(&sl28vpd_layout); -} - -module_init(sl28vpd_init); -module_exit(sl28vpd_exit); +module_nvmem_layout_driver(sl28vpd_layout); =20 MODULE_LICENSE("GPL"); MODULE_AUTHOR("Michael Walle "); --=20 2.25.1 From nobody Wed Feb 11 02:33:36 2026 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 2DD5AC761A6 for ; Tue, 4 Apr 2023 17:25:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236186AbjDDRZQ (ORCPT ); Tue, 4 Apr 2023 13:25:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51476 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236215AbjDDRYD (ORCPT ); Tue, 4 Apr 2023 13:24:03 -0400 Received: from mail-ed1-x52c.google.com (mail-ed1-x52c.google.com [IPv6:2a00:1450:4864:20::52c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EDE3510EB for ; Tue, 4 Apr 2023 10:23:18 -0700 (PDT) Received: by mail-ed1-x52c.google.com with SMTP id b20so133612893edd.1 for ; Tue, 04 Apr 2023 10:23:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1680628994; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=M8H0YgMUpIWLdD2v+hIJLczLnys0/j8ZGQWwWDvOJPQ=; b=uj6aPbjT5mFUfaBgt+1hNn+3Ve2/ulCqReD2aJ9yhmDXwd8YJI36fj9GsjxakVwpls AkUGeosrKe6RNbWmDBKNoBb4p08m+82m0QmPnQq8l4JmyhMUP6g0rGyfs1K/z4BlCLep PjteFCDFJClPQgf6veciNtekP2MLkfoAM+4KT6YAPb6niJ+TC1WSstEjSIAWLHW7AjK1 GCg0/36qlCMleX0619KJ/gh83gaJy2/hDdocZfjeLOEaKSmhlt0MjUkYCACMV6B4pAOo 7V0b/jKQAHRgW9O+bn9AiDbvxT6iKg9T/8zeMqzcA3p3MdwDZFalBpz6ihSPqnaFkscZ WVUQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680628994; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=M8H0YgMUpIWLdD2v+hIJLczLnys0/j8ZGQWwWDvOJPQ=; b=B4GOPZTJqSIVPPNFc6cygiVt2CNH0uTHFovLEl/e7IDyqRxvx6OZw/Xg1JhrAgFps9 h6WcQQkEXtLqZ7lSR8UaIwvqHqSMfXLHqTfzqo8c3nqhoOM1Qr6BSHOB8oiEz+9x7t9N WKPAXTk2qNNN/FwLLmPku1fAsCDdLouH+wNP0saDhH+WVgYXf/hDF7Oqc5nhXmJyQAY+ p9AyWtR0Nyr7lCWfyVOjzZx58MPRgDujp2BEL6tLCK8mAtfmmCYhotVMC4JaBJ25vNZx +vhEWgPszqmSsW+5vJZO/NMc/2mT90Y7AZjID9wbb3m6b0eGVvqpQUcVCBNBjDrnolh7 bGhw== X-Gm-Message-State: AAQBX9eHl5B4ZVq2e4ITP+Xz86u7q9cddPp15nxSgOXxDN3FaNw5Eszl YHODAy/aNlYB1NpreVVtDwLjHA== X-Google-Smtp-Source: AKy350Zs3+ZoCTl+rhZsIgm6tXx8kKe2NrdWHP0thfF2vR+BQhZ9rfF3yh5QqWMXjVDm9AC9ly8HQw== X-Received: by 2002:a17:906:c407:b0:931:a321:7640 with SMTP id u7-20020a170906c40700b00931a3217640mr273152ejz.74.1680628994738; Tue, 04 Apr 2023 10:23:14 -0700 (PDT) Received: from localhost.localdomain ([5.133.47.210]) by smtp.gmail.com with ESMTPSA id bv20-20020a170906b1d400b009447277c2aasm6208333ejb.39.2023.04.04.10.23.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 Apr 2023 10:23:14 -0700 (PDT) From: Srinivas Kandagatla To: gregkh@linuxfoundation.org Cc: linux-kernel@vger.kernel.org, Miquel Raynal , Srinivas Kandagatla Subject: [PATCH 38/40] nvmem: layouts: onie-tlv: Use module_nvmem_layout_driver() Date: Tue, 4 Apr 2023 18:21:46 +0100 Message-Id: <20230404172148.82422-39-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230404172148.82422-1-srinivas.kandagatla@linaro.org> References: <20230404172148.82422-1-srinivas.kandagatla@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Miquel Raynal Stop open-coding the module init/exit functions. Use the module_nvmem_layout_driver() instead. Signed-off-by: Miquel Raynal Signed-off-by: Srinivas Kandagatla --- drivers/nvmem/layouts/onie-tlv.c | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/drivers/nvmem/layouts/onie-tlv.c b/drivers/nvmem/layouts/onie-= tlv.c index d45b7301a69d..661093de33b4 100644 --- a/drivers/nvmem/layouts/onie-tlv.c +++ b/drivers/nvmem/layouts/onie-tlv.c @@ -237,19 +237,7 @@ static struct nvmem_layout onie_tlv_layout =3D { .of_match_table =3D onie_tlv_of_match_table, .add_cells =3D onie_tlv_parse_table, }; - -static int __init onie_tlv_init(void) -{ - return nvmem_layout_register(&onie_tlv_layout); -} - -static void __exit onie_tlv_exit(void) -{ - nvmem_layout_unregister(&onie_tlv_layout); -} - -module_init(onie_tlv_init); -module_exit(onie_tlv_exit); +module_nvmem_layout_driver(onie_tlv_layout); =20 MODULE_LICENSE("GPL"); MODULE_AUTHOR("Miquel Raynal "); --=20 2.25.1 From nobody Wed Feb 11 02:33:36 2026 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 60FCFC761A6 for ; Tue, 4 Apr 2023 17:25:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236216AbjDDRZV (ORCPT ); Tue, 4 Apr 2023 13:25:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51572 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236227AbjDDRYI (ORCPT ); Tue, 4 Apr 2023 13:24:08 -0400 Received: from mail-ed1-x529.google.com (mail-ed1-x529.google.com [IPv6:2a00:1450:4864:20::529]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C934655B4 for ; Tue, 4 Apr 2023 10:23:20 -0700 (PDT) Received: by mail-ed1-x529.google.com with SMTP id ek18so133640288edb.6 for ; Tue, 04 Apr 2023 10:23:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1680628996; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=eFCSoVeAEvW5gqvvfyLsUBPVai0I20mD5NqsmqyKO4g=; b=mVyLnmuqaNREuo9+slU9EpCW4KbVi+jpmRzd6bfeMDD4VX6qlkaxaDd0bwZSka5vvm JR1FXxPwVzg4HhVd7cgVm64FcE6Znq+fNlRrGCw6pun4B4qnhYy0EzQZRfH7ARx/0+Rx 4j7tbMi0D7WrOfELszxamwDTPwtEmoCywcncKakPK4qYjZLID7kKaUZneHyIxrbhKeEd D25qPg8DBmoLVxFDIiPvPrs1kGss4Px4YVjfphzvl9wZyfrTQkdRo6b79/Kx53L65ESH JzjUuh0uXUcjtYyvNviSaojDqcOfDHvulJf+NBOr5rkIU1XiiKYagtqoil/nBD6KTtus Pk6Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680628996; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=eFCSoVeAEvW5gqvvfyLsUBPVai0I20mD5NqsmqyKO4g=; b=b27aGtY5BxP+TL5n1hyfofv1A1+1zxi9oLwD0t8eCBa2n0k4lItn2YNZJhghh0p7jN 8aMJSpWp5MZ4zZgy0zAyOZ+72Wejyrch2mnuxUjnbi7jhdaSrlPpEBBjEcww54Sz0goE XmL7zAKmReqxurbcydhrYKlbLf0inL3jN7xP3AVdWbCWszDwwlQKpbNLk0JgtEj12TeQ gu8LdvQMSmoZDHC9M96MX1RVjItPj/l0m5xdzJtJ0JJ9UwalNdCKwHXPC6CBn7e4u8be PDuJCVY/SEv4c1PQiV+TAMMQebv7B8v2or2/cgND/ohiL+bxJ3HAs+6XnEXLKUPcq/E8 OIiA== X-Gm-Message-State: AAQBX9cJ7Sd6otsoGZb7fXh22rwwjBxjJ4DeG5xnTsx4LB6Fk9TgWZyQ rSqZoB1BeaB+7jtqIw/bBByqAQ== X-Google-Smtp-Source: AKy350Z3dEzSmhm63+DEj4K065hahnDk2jWcYnRWk2BngeT47M+vGcI4GKSb2gYg5f5Ad+ukzVm5bw== X-Received: by 2002:a17:906:2b49:b0:939:e928:5323 with SMTP id b9-20020a1709062b4900b00939e9285323mr243457ejg.54.1680628995937; Tue, 04 Apr 2023 10:23:15 -0700 (PDT) Received: from localhost.localdomain ([5.133.47.210]) by smtp.gmail.com with ESMTPSA id bv20-20020a170906b1d400b009447277c2aasm6208333ejb.39.2023.04.04.10.23.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 Apr 2023 10:23:15 -0700 (PDT) From: Srinivas Kandagatla To: gregkh@linuxfoundation.org Cc: linux-kernel@vger.kernel.org, Miquel Raynal , Srinivas Kandagatla Subject: [PATCH 39/40] nvmem: layouts: onie-tlv: Drop wrong module alias Date: Tue, 4 Apr 2023 18:21:47 +0100 Message-Id: <20230404172148.82422-40-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230404172148.82422-1-srinivas.kandagatla@linaro.org> References: <20230404172148.82422-1-srinivas.kandagatla@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Miquel Raynal The MODULE_ALIAS macro is misused here as it carries the description. There is currently no relevant alias to provide so let's just drop it. Signed-off-by: Miquel Raynal Signed-off-by: Srinivas Kandagatla --- drivers/nvmem/layouts/onie-tlv.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/nvmem/layouts/onie-tlv.c b/drivers/nvmem/layouts/onie-= tlv.c index 661093de33b4..59fc87ccfcff 100644 --- a/drivers/nvmem/layouts/onie-tlv.c +++ b/drivers/nvmem/layouts/onie-tlv.c @@ -242,4 +242,3 @@ module_nvmem_layout_driver(onie_tlv_layout); MODULE_LICENSE("GPL"); MODULE_AUTHOR("Miquel Raynal "); MODULE_DESCRIPTION("NVMEM layout driver for Onie TLV table parsing"); -MODULE_ALIAS("NVMEM layout driver for Onie TLV table parsing"); --=20 2.25.1 From nobody Wed Feb 11 02:33:36 2026 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 D4B1AC761A6 for ; Tue, 4 Apr 2023 17:25:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235814AbjDDRZN (ORCPT ); Tue, 4 Apr 2023 13:25:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52628 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236207AbjDDRX6 (ORCPT ); Tue, 4 Apr 2023 13:23:58 -0400 Received: from mail-ed1-x52d.google.com (mail-ed1-x52d.google.com [IPv6:2a00:1450:4864:20::52d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 802235FDF for ; Tue, 4 Apr 2023 10:23:17 -0700 (PDT) Received: by mail-ed1-x52d.google.com with SMTP id ek18so133640503edb.6 for ; Tue, 04 Apr 2023 10:23:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1680628997; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=sWNaFjjalHwpYTlFI10ff7cViPg4jdonFx6GrJYQjf8=; b=qTt1wU5ZCDaAEz5fBVWHiMsHvtaUHaWDjMbKnjrfv95y8t6TugeagPxy+QM+fNLRrL NOedmsRO1sTNoOD9WI4dfMw9hT7ShcSxr79ms6aH0zdwHcuGnf56fN+/nFvmtWAtK5Uq tpaGZ+CAXBBqTB5L1rfgpwJ864/vZkwR/rM3g0E+TiyBmbElaHC2cOahEj2YesXiX/9G 7sn5xhW57/fw8Nu92zc9pg5rdgQWtOtArWFxvArSrKl/NJN3E0WHxrAJRf04PNKfBi25 MUgM0Q+ioBg7NFYWi+mGYhWGN3dXKvqTEQ7/m6nxZK7jSq//G7MQ+KMgka9YhpgzbWh9 /SMQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680628997; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=sWNaFjjalHwpYTlFI10ff7cViPg4jdonFx6GrJYQjf8=; b=1v6CLKG824yo8iTnKp9JdAounemVmqRqCBeUUhdN1lsNXelUZ5HGOsBiPRZ3dl6Upa eahPTcbhK8YassQB3M0kCzwkC83jO9l8+YQRwOn7ej11tF89p5eWIAocq775UvwcRN2z +JWblSqSoS27PRcBnZIp0WZWF0MbHt2NBhZpwsrCppF0NHCSKjhgs9V5lC02F+LTBtaY bjrFhWLZmQXmq4T1JHb/WjPwZgqDmWfEp0SXdWncOxcjSl7YBRid1C6iuCEjJTPy+iNP 6IoxdWKKH0hbGi4bnrc/X5psaMubjmaaB7a5Vp14SMwCygxTpJwRt2oXOZOl/YiVkVoP bIeQ== X-Gm-Message-State: AAQBX9fhJYBQdqoNvOz7I38Ro7UlWwChET02UMIk1atMRbSaXVN+Pms2 3SGRz3gikpCfRhikT0ORWNfzoQ== X-Google-Smtp-Source: AKy350ZBRe4bdYk1W67YW57UF0cZmvQp8VXkUcHNgIADK+bT/Zd2bV+erfY6GpZ+e8KjuprszH1KXw== X-Received: by 2002:a17:907:9607:b0:930:3916:df19 with SMTP id gb7-20020a170907960700b009303916df19mr485434ejc.5.1680628997109; Tue, 04 Apr 2023 10:23:17 -0700 (PDT) Received: from localhost.localdomain ([5.133.47.210]) by smtp.gmail.com with ESMTPSA id bv20-20020a170906b1d400b009447277c2aasm6208333ejb.39.2023.04.04.10.23.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 Apr 2023 10:23:16 -0700 (PDT) From: Srinivas Kandagatla To: gregkh@linuxfoundation.org Cc: linux-kernel@vger.kernel.org, Tom Rix , Srinivas Kandagatla Subject: [PATCH 40/40] nvmem: layouts: sl28vpd: set varaiable sl28vpd_layout storage-class-specifier to static Date: Tue, 4 Apr 2023 18:21:48 +0100 Message-Id: <20230404172148.82422-41-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230404172148.82422-1-srinivas.kandagatla@linaro.org> References: <20230404172148.82422-1-srinivas.kandagatla@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Tom Rix smatch reports drivers/nvmem/layouts/sl28vpd.c:144:21: warning: symbol 'sl28vpd_layout' was not declared. Should it be static? This variable is only used in one file so it should be static. Signed-off-by: Tom Rix Signed-off-by: Srinivas Kandagatla --- drivers/nvmem/layouts/sl28vpd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/nvmem/layouts/sl28vpd.c b/drivers/nvmem/layouts/sl28vp= d.c index 9cc1715c2fd5..05671371f631 100644 --- a/drivers/nvmem/layouts/sl28vpd.c +++ b/drivers/nvmem/layouts/sl28vpd.c @@ -141,7 +141,7 @@ static const struct of_device_id sl28vpd_of_match_table= [] =3D { }; MODULE_DEVICE_TABLE(of, sl28vpd_of_match_table); =20 -struct nvmem_layout sl28vpd_layout =3D { +static struct nvmem_layout sl28vpd_layout =3D { .name =3D "sl28-vpd", .of_match_table =3D sl28vpd_of_match_table, .add_cells =3D sl28vpd_add_cells, --=20 2.25.1