From patchwork Mon Dec 18 13:37:20 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: 13497007 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id A4817C46CCD for ; Mon, 18 Dec 2023 13:38:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=NfO/RHEjgGUEi+dsbxgIwK/gzQmUvwTjsNm+MZamq/M=; b=LO91e2Jy6ze4xn rr/oJ/iCzxeRav7g1sUVjGmYP5EMn8inxx0/ARN8NWX6DDXbxqTqGrrEDiACAGnF8S/zFiXl7RCuU k7GPOAwsM3meNMoXhxJHkUszhQL+Mfzi+9tbUVKfact9LTba9yUDF+oGOVbDNfYDCETJFZJTpEGlU 7erqoVWiuk3X7oHgXefSStNUre2mAFccwe/eGVV2M5dBeqEHcA8uavZPa4IneqTtYfivFx3pz6+aE AanayNC2YqXS9jZu8CxvbWCfVh6/LF/+iUHjO1wpNB+HzGnP8egh45DbJtNcs8yl6Ug+ltbsDgFZf 8QQ1odn5qJvJKVpTRMvw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1rFDod-00AtC8-0R; Mon, 18 Dec 2023 13:37:51 +0000 Received: from mail-ej1-x629.google.com ([2a00:1450:4864:20::629]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1rFDoZ-00AtAE-1O; Mon, 18 Dec 2023 13:37:48 +0000 Received: by mail-ej1-x629.google.com with SMTP id a640c23a62f3a-a22f59c6ae6so381867866b.1; Mon, 18 Dec 2023 05:37:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1702906663; x=1703511463; darn=lists.infradead.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=jS+kNQn7NoqdE3GjXHPXf8bK2TlI6c/nXZn27d9GKWLfXMMhdaI5fg/0F3GGLndSxa NKcadWyBaOmu41zwwTPvotdUAYcVXg23eoRAEbP6q5EUshMiAiODiuZffU8YjVga51MA tRli10GvaoLYqdLKFrmpU1iIzA4q89MDPfSXoOLzEm8V6J4bnBa19LDTGYyJlTS4vCpl jDCpC8MZfZYm+VKEt1qM5+dWLY1P0FwMHKwyNXLSBWWf+RM9zFIgWwXz7drp1uFyyBO3 4Jjic/V+VhSG94xU0nnSSYrdQAlJ3b0uM7MZ6mky3x+aIaqPG/g8a0BW+npIUcP4ncj2 hx/w== 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=nek1kDAFkP5tjHhAKyLYxw9XMQ2BaCZ5mGHVXzsZ0E4H+GYFsBlYk8Irfsht/qCWMh dS+PviP++lqI3RhzJlbeRzlcQSQGwxntlA6Q9jE/a1CaoEmc2bI0p/8/nZSiv2uyYEGO TPOw1fv6M1STbTd0i4gNTt73aZwhciaK9+m4nzRxPH3/hDcZkYSVJRYFPcyKFM2m8Br+ Zm/9ox172mTvb3c7PYzDyq0PtrUokVvgcgtM1Nn8vWrmjvi60lSHwy2W8YPDbYcsLiyM f3Vk6nVl/LGH7oVpdMEAReYVmwEM15quS8aeeRuE/xPlQQ8j+t1+rb9KOZI2orjRGiXV qS6A== X-Gm-Message-State: AOJu0Yx3vEuBl3Hz/j9wvYNXkMlSewxM1zd7rfI/U7YIUT/yTjiJger2 GS1oioNmuP592ypgpLZbOayY8gg37Po= X-Google-Smtp-Source: AGHT+IGtGbsdUUc3O88BnV6j6UsM+dxyCX5fJtxHEDFGyKvcLjEb50ze3OtdtgF9HqxDX13eg9axjw== 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?b?UmFmYcWCIE1pxYJlY2tp?= 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?b?UmFmYcWCIE1pxYJlY2tp?= 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> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231218_053747_471586_7ACEE34D X-CRM114-Status: GOOD ( 11.06 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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 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);