From patchwork Wed Jan 11 07:30:57 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?UmFmYcWCIE1pxYJlY2tp?= X-Patchwork-Id: 1724488 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=LKZl3Yl1; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4NsK9j2NHbz23fY for ; Wed, 11 Jan 2023 18:31:21 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id CE108856BC; Wed, 11 Jan 2023 08:31:18 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="LKZl3Yl1"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id E7466856BF; Wed, 11 Jan 2023 08:31:15 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-1.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-ed1-x533.google.com (mail-ed1-x533.google.com [IPv6:2a00:1450:4864:20::533]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 7D0D680241 for ; Wed, 11 Jan 2023 08:31:13 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=zajec5@gmail.com Received: by mail-ed1-x533.google.com with SMTP id w14so3758654edi.5 for ; Tue, 10 Jan 2023 23:31:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=8DBHbw8SRKxIaaEznlgvFtV6o4AQh3C5twMwXmVKndw=; b=LKZl3Yl1yaH9pHPcrGazQYIO/+lPuf0TVx5YL6feozCkqA0Y3rsXDrPv7+ShBohCGE mav3xeeCzvYfgs7cVqj2k8cDb4fur4tYELCuJfHlTGMbAFF0LCN14a9bLzyiMCsef1WH wl7/sxpMWWGKhzMEV2FjqMmAMatKIqDjV8E0Vu9Mx6XHPOglF4ZP83Jt828aQfXaGeDe 5742PSda/syaQ0PJFDoHuNopxeADoOKLpitq3OAuD84Q8VnMeVrVYn5mUaJsQi0r8vH3 VNnsVGX3qIbYEuYlTKe3T3xALuE8WUuSFOe6BbP58ExuaMQAAxTpzLNJ+gQwRZLu7qMT UQPw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=8DBHbw8SRKxIaaEznlgvFtV6o4AQh3C5twMwXmVKndw=; b=3ZZo37UUqcruuLSQKEGRvdWboYcLr3lwPUy7UOlCYO4NBLlaSvL2COeI1vx9p81J7W obii3upfj9J3Vq+PGOyhKGRYA29LtspN80rVp/3ufpFURgSNSgMwxk9Mrra8qrODJV7+ 4yFZxuzLH8/34dILFy+BIcVVEqpzZBZppvcqk1yPyc6OMct+tx7uYUWMNkr8vnveycmq WgdYWFvUEMVaPZFoQ1lnxMtrvEU0a+tOuVB1DgoqlxoTit2T+OtXQ5x1eOWO6Q/DbKCs TBrb7XsMC3QmdCPcM8Kxrm6ylZu2kJKEe7TxPeiLxxMGtooEVlfWR7dp5tbuwqFYs6Bh mnDQ== X-Gm-Message-State: AFqh2kruMNdT1IRz9PPODMGIO7eYpyxFuTA19+aAujn4FAQUGavfqlUD 8VR6RpBm25rkwejUMjnZL54= X-Google-Smtp-Source: AMrXdXsw6vb7Yhx0xIv6eleitRwomvZGl2Ys/JovDBbL5+Orm3lT8EcRZCM5TMZQiwbRXUkftpCrNg== X-Received: by 2002:a05:6402:456:b0:484:8b49:e117 with SMTP id p22-20020a056402045600b004848b49e117mr50242343edw.3.1673422271823; Tue, 10 Jan 2023 23:31:11 -0800 (PST) Received: from localhost.lan (ip-194-187-74-233.konfederacka.maverick.com.pl. [194.187.74.233]) by smtp.gmail.com with ESMTPSA id ed6-20020a056402294600b00499e5659988sm593193edb.68.2023.01.10.23.31.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Jan 2023 23:31:11 -0800 (PST) From: =?utf-8?b?UmFmYcWCIE1pxYJlY2tp?= To: Srinivas Kandagatla , Rob Herring , Krzysztof Kozlowski Cc: Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , Miquel Raynal , Michael Walle , devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, u-boot@lists.denx.de, =?utf-8?b?UmFmYcWCIE1p?= =?utf-8?b?xYJlY2tp?= Subject: [PATCH V2 1/6] nvmem: core: add nvmem_dev_size() helper Date: Wed, 11 Jan 2023 08:30:57 +0100 Message-Id: <20230111073102.8147-1-zajec5@gmail.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.6 at phobos.denx.de X-Virus-Status: Clean From: Rafał Miłecki This is required by layouts that need to read whole NVMEM space. It applies to NVMEM devices without hardcoded layout (like U-Boot environment data block). Signed-off-by: Rafał Miłecki --- V2: Drop "const" from "const size_t" --- drivers/nvmem/core.c | 13 +++++++++++++ include/linux/nvmem-consumer.h | 1 + 2 files changed, 14 insertions(+) diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c index d3be50ed2d0b..32f7fb81375a 100644 --- a/drivers/nvmem/core.c +++ b/drivers/nvmem/core.c @@ -2062,6 +2062,19 @@ void nvmem_del_cell_lookups(struct nvmem_cell_lookup *entries, size_t nentries) } EXPORT_SYMBOL_GPL(nvmem_del_cell_lookups); +/** + * nvmem_dev_size() - Get the size of a given nvmem device. + * + * @nvmem: nvmem device. + * + * Return: size of the nvmem device. + */ +size_t nvmem_dev_size(struct nvmem_device *nvmem) +{ + return nvmem->size; +} +EXPORT_SYMBOL_GPL(nvmem_dev_size); + /** * nvmem_dev_name() - Get the name of a given nvmem device. * diff --git a/include/linux/nvmem-consumer.h b/include/linux/nvmem-consumer.h index fa030d93b768..c3005ab6cc4f 100644 --- a/include/linux/nvmem-consumer.h +++ b/include/linux/nvmem-consumer.h @@ -78,6 +78,7 @@ ssize_t nvmem_device_cell_read(struct nvmem_device *nvmem, int nvmem_device_cell_write(struct nvmem_device *nvmem, struct nvmem_cell_info *info, void *buf); +size_t nvmem_dev_size(struct nvmem_device *nvmem); const char *nvmem_dev_name(struct nvmem_device *nvmem); void nvmem_add_cell_lookups(struct nvmem_cell_lookup *entries,