Received: by 2002:a05:7412:a9a3:b0:f9:327e:43ab with SMTP id o35csp100312rdh; Mon, 18 Dec 2023 05:39:06 -0800 (PST) X-Google-Smtp-Source: AGHT+IGiotwcAoehh5l7Zz1+9O+jdpLWlMATjkenFRbnS5s37HDyNEgD2agPwiKN9GZ938tMWDXm X-Received: by 2002:a17:906:a851:b0:a23:6306:60cf with SMTP id dx17-20020a170906a85100b00a23630660cfmr259988ejb.261.1702906746087; Mon, 18 Dec 2023 05:39:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702906746; cv=none; d=google.com; s=arc-20160816; b=0/vKC6RKpsCJ+xw1b/5pL6WpoZPAib4IDvHcGv8irVl3Vsz4XSHv5UC0r96RQvp23J 0DjM1sFFog4fR2R+KzY4VQLwigFj+GvrwpWRZuC4aREdj5pyfQbajFxLTxsGJehm2wcM 774UHE2LMGMXIGQGtJ7TC4O1HQeuHNIXNPgbb7ntppzaRBsv5Zf+2dKHgYfp3O55ItJk dPipE6bhECf/BbOIrMoTNwUfElDRp5l/se+F77oiqDMQGdr2Xd4PdsGDrMsjIU3pe0Se f/O1YmHZZjo4n8Cj21bcYdIqkPmhblM7RovnmWAwxIgciKCem8+LNG1f+LtRW3zBeV+e fKdQ== 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=lNpHTEQT4LZHegIzvZ+kMOyv6eP7HeX0Sd04kR5jmCY=; fh=dfLNqWOtm0UaHb8GCHMuBSVlbZCi7eV095mQO5nOqs8=; b=Njz/sYoebmDV4RI9TL/YqE7pHDhAelaio0Jy0BYJyirAs2cJ4BIUzANTF1FZAqWRPK KzZ8ZP0WW/k3L0CuWgc6rMvsXxdWiZus9KegB7j/pkXbeImdnl8nAMLsWWoPjJlyEgjU v44wfIBWO1zx1vT3MuvdSgDSDcsAn2dIM064h5oLYSQ73AZwZafxHLLEBGMnZCu446MA 9Quzg0gANfuzjoKiDHam35wROa8m5e9o+aaCFk7F0Ub89oADuT5m1emeWwEtEXdf7LkU K406gn50iJ+L7hRgH8eHjFuzmZLLmCqLmceb+ODaQeqXINuLb9gE/hpelVaGdf1Mq2KE TF/w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=HuuAdaOY; spf=pass (google.com: domain of linux-kernel+bounces-3755-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-3755-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id j22-20020a170906255600b00a2336235429si1553717ejb.587.2023.12.18.05.39.06 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Dec 2023 05:39:06 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-3755-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=HuuAdaOY; spf=pass (google.com: domain of linux-kernel+bounces-3755-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-3755-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 am.mirrors.kernel.org (Postfix) with ESMTPS id 23CEC1F2338F for ; Mon, 18 Dec 2023 13:38:07 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B7D941D12B; Mon, 18 Dec 2023 13:37:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="HuuAdaOY" X-Original-To: linux-kernel@vger.kernel.org Received: from mail-ej1-f48.google.com (mail-ej1-f48.google.com [209.85.218.48]) (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 73E3D129ED0; Mon, 18 Dec 2023 13:37:44 +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-f48.google.com with SMTP id a640c23a62f3a-a234205785dso162700066b.0; Mon, 18 Dec 2023 05:37:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1702906663; x=1703511463; 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=lNpHTEQT4LZHegIzvZ+kMOyv6eP7HeX0Sd04kR5jmCY=; b=HuuAdaOYspw94wdKG5bxUvEwaSKcJwHgm21VXu42XHPfv0xkuizanPZtMM+MSgVwjP 3geGuAyYD02xoOvt3XocMyKMnFFSHDnFFbxUA71/h8Cr8RF7yfgzYIfIknE1e0uBIQpp pn3aj/afodScdM8BTNBkZLopVs6hcybjKx5Tz/UR5pX+P8P5piZNPH57xwRdMspWrVwK EixReDzSZ1TWfF4dqXdrr2F5w3Qi3xjNxWl0q2FWCTPF8b9/K4t+O6iR2KPPwqoIT5Yr iDeW2VoMhicMpQWAv4n55p8lmTNK4owoqNn64CaAkkYbR7l4friYS8Mv0NbSaQ1Pm9xr uIJA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702906663; x=1703511463; 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=lNpHTEQT4LZHegIzvZ+kMOyv6eP7HeX0Sd04kR5jmCY=; b=F3lZoSUZKngm4sNGSzO0rpCs9i+XrWe6g9L5MFru9EWLUz2oa1vIQvbCv4SI/C97Ou M04Wxpz0i28N+Zeto0CZXScVqN/wUuIt5wDVGQltEBaHogyO+Ne3tt2EiAoZ4dj2DJOs joY28ZkKTxSeFgPMoel7MXlFM0s7udpaTNjdUyE1DAF1um6Pc0OlQaUqusCwP28z40mf eB/XvFnOLY++EoT+amA3qUQ7c3laD7Rjn7cXuHeulKvdh0R8N3gNlBUG2S4tc7EfU5SD TXeunLYYaK43NQHKqXYvIeePVmvHtoP+fUPAQ7gRECCQH7VMcI7CtkZsxzTybec8U4+J 5+mw== X-Gm-Message-State: AOJu0YwKkXskzHwMA4gZ31dhhTUlUG7dB8qdsVxKKGXBolSE9RGAC+PY n3lASoBy8vWf3xrL6Mm6eos= X-Received: by 2002:a17:906:3f46:b0:a19:a1ba:bad8 with SMTP id f6-20020a1709063f4600b00a19a1babad8mr3339416ejj.126.1702906662688; Mon, 18 Dec 2023 05:37:42 -0800 (PST) Received: from localhost.lan (031011218106.poznan.vectranet.pl. [31.11.218.106]) by smtp.gmail.com with ESMTPSA id f20-20020a1709067f9400b00a234907311asm1891537ejr.55.2023.12.18.05.37.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Dec 2023 05:37:42 -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 2/4] nvmem: core: add nvmem_dev_size() helper Date: Mon, 18 Dec 2023 14:37:20 +0100 Message-Id: <20231218133722.16150-2-zajec5@gmail.com> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20231218133722.16150-1-zajec5@gmail.com> References: <20231218133722.16150-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 --- 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 ba559e81f77f..1b08bb072f86 100644 --- a/drivers/nvmem/core.c +++ b/drivers/nvmem/core.c @@ -2176,6 +2176,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