Received: by 2002:a05:7412:b995:b0:f9:9502:5bb8 with SMTP id it21csp306088rdb; Thu, 21 Dec 2023 09:35:19 -0800 (PST) X-Google-Smtp-Source: AGHT+IEEVte97rmAw2mkZe/gwdQv7IhNB/83LCjDBDnef5Hyf4w74AMc1tLv5yqVErjU1oUoKH2r X-Received: by 2002:a05:6214:1c81:b0:67f:6f2b:d1a4 with SMTP id ib1-20020a0562141c8100b0067f6f2bd1a4mr1726qvb.77.1703180118847; Thu, 21 Dec 2023 09:35:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703180118; cv=none; d=google.com; s=arc-20160816; b=ZCjt/aCUiAUS+AcNnD/6jf4IRGQQfdCBzYDwILO6lkRL1IzFeAtemFQuERhvurZHhf dyoHi/ovQ+sdFnPHAWGeemuyVJK+oTyQ9sz4F1QuECzmGossfBl6atkp6R0jgeoDih8I aMF3TWfEKiJYORNh/OcdnjZCHjpDJTJwHxvdWRsXXdr9CUqut3W9aiqelwHStdeEIsZE hPDXCsr5HIGnqNmk0n/Mlgy9R1s/lo53PO4mQbbXE/hr2IXdtdlYxLMD6c6RLIxXDJGV PyZKr67VBhDzZvZvq6KtpnSjtrn3vXjGeOdWJRW1K6czss6UIG8n3o6pTTREpQD0GYyM uzRQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=HS/utwklj/mQdHgmYltSxcVR9bMR4HdMDBmcgJXrZDU=; fh=dfLNqWOtm0UaHb8GCHMuBSVlbZCi7eV095mQO5nOqs8=; b=IDPO/u7otPMLivN1+7JjzF9l8fMMjisc5K1H1L+oJyDmPUdnr+qXfaasDwPU8MYzAk Dqru1do6BgQ+ZUNA6UpgBFsv/S81IFkkofNJhl9B1HfbT4y/bZqgU+PZmNbGjhdd47Ni nbhRhMVG1Gp+v9CpQefcVjUM5zkFuOZYXEA5eBSgSJg1U7ic5BHCg8bejkDueGvap4dD 1otNAqyfLQQJGAxk207xnsGFaqvQ2a0DEh9bpCHxwp9shLAXKTJavGIH8aEr9apacTfm Hc+ZrgJFMmwrvTEy3hU5a0inrCyvOUaSUcY0fZzNfYzx1g4GwXfUpNFslAp322i16bge q/Rw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=Eu0UUoTW; spf=pass (google.com: domain of linux-kernel+bounces-8856-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-8856-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id a18-20020a0ce392000000b0067f28c2becbsi2679398qvl.97.2023.12.21.09.35.18 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Dec 2023 09:35:18 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-8856-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=Eu0UUoTW; spf=pass (google.com: domain of linux-kernel+bounces-8856-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-8856-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 031731C26092 for ; Thu, 21 Dec 2023 17:34:56 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6C014634F4; Thu, 21 Dec 2023 17:34:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Eu0UUoTW" X-Original-To: linux-kernel@vger.kernel.org Received: from mail-ej1-f43.google.com (mail-ej1-f43.google.com [209.85.218.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2CCCD634F0; Thu, 21 Dec 2023 17:34:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-ej1-f43.google.com with SMTP id a640c23a62f3a-a2340c803c6so129382066b.0; Thu, 21 Dec 2023 09:34:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1703180074; x=1703784874; darn=vger.kernel.org; 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=HS/utwklj/mQdHgmYltSxcVR9bMR4HdMDBmcgJXrZDU=; b=Eu0UUoTWpKyE3YCGUdSsqVezppxNYEp9/2/S74PEgflbINlV+iD6vnfbrY48bwVRma /VLUT8X2y7aMVwleN4WeUJtYBKSshIxKAe50wyNCuQu774t4ti4obsBuTE7I2yt+EWqQ fhaRHNq7eO9luv6dVpP3u40Oa78fEf0G5hegiF4y+4pY0cXoOVEe19KKewT3NK4Zcd7z jXs5wpVn8m9OXebZ0t9fEfEIpqqCmogv1JQXDmLWo4EYXPozyeX/YVd4wr79mtKSjez2 xGWeRPoAV8D44uTjyBWYhE6hjOrM5OxxN5lREzYSMe6f6U35rt/yfcG89hlKjB3wQnCO ExUg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1703180074; x=1703784874; 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=HS/utwklj/mQdHgmYltSxcVR9bMR4HdMDBmcgJXrZDU=; b=xQcWSgkKmizNCS6hqM45+6M1W7uqfEqiwt5OizhHsDOwhL+db2usTpIM/SAkGhjQgX pQosyIOE1ChN4Q696cFs3Q+4jJP7TqXTLrNkEcMEnneCz6a2Oo15gPPm13MkHqIdFq7y DeSYiZQWuQKPk85Dj5c2+xRZKFrGSE46dOI61Xsb7HkOdPTG8ljAEDga57V5MpRZmKLy tL24IHZadXN7ZbWYPLdE7cW4wIeVBR5EyVsmtDzpaIfaGHmQJo/jEB0ZDymUvR1hhNIC s9D6bCHBcWNKAT7KHOd/ft7AdPqtTPQzxQ7n3sZmsAMPcjnuwnfe6I8xUxB13gdTfE8S 8D6Q== X-Gm-Message-State: AOJu0YxhLVUKcMDcO1jjtzavhiwacanX+x5Pa22qwZS4pGjcC71E60dg 4EoBMqbF3b2qybn6cmX3vWs= X-Received: by 2002:a17:906:4749:b0:a23:65de:419c with SMTP id j9-20020a170906474900b00a2365de419cmr75233ejs.144.1703180074094; Thu, 21 Dec 2023 09:34:34 -0800 (PST) Received: from localhost.lan (031011218106.poznan.vectranet.pl. [31.11.218.106]) by smtp.gmail.com with ESMTPSA id z25-20020a1709060ad900b00a23499f1d7dsm1176118ejf.209.2023.12.21.09.34.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Dec 2023 09:34:33 -0800 (PST) From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= To: Srinivas Kandagatla , Rob Herring , Krzysztof Kozlowski , Conor Dooley Cc: Greg Kroah-Hartman , Michael Walle , Miquel Raynal , linux-mtd@lists.infradead.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, u-boot@lists.denx.de, =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= Subject: [PATCH V3 2/6] nvmem: core: add nvmem_dev_size() helper Date: Thu, 21 Dec 2023 18:34:17 +0100 Message-Id: <20231221173421.13737-2-zajec5@gmail.com> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20231221173421.13737-1-zajec5@gmail.com> References: <20231221173421.13737-1-zajec5@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From: Rafał Miłecki This is required by layouts that need to read whole NVMEM content. It's especially useful for NVMEM devices without hardcoded layout (like U-Boot environment data block). Signed-off-by: Rafał Miłecki Reviewed-by: Miquel Raynal --- 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 4ed54076346d..980123fb4dde 100644 --- a/drivers/nvmem/core.c +++ b/drivers/nvmem/core.c @@ -2163,6 +2163,19 @@ const char *nvmem_dev_name(struct nvmem_device *nvmem) } EXPORT_SYMBOL_GPL(nvmem_dev_name); +/** + * 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); + static int __init nvmem_init(void) { int ret; diff --git a/include/linux/nvmem-consumer.h b/include/linux/nvmem-consumer.h index 2d306fa13b1a..34c0e58dfa26 100644 --- a/include/linux/nvmem-consumer.h +++ b/include/linux/nvmem-consumer.h @@ -81,6 +81,7 @@ int nvmem_device_cell_write(struct nvmem_device *nvmem, struct nvmem_cell_info *info, void *buf); const char *nvmem_dev_name(struct nvmem_device *nvmem); +size_t nvmem_dev_size(struct nvmem_device *nvmem); void nvmem_add_cell_lookups(struct nvmem_cell_lookup *entries, size_t nentries); -- 2.35.3