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: 13096154 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 A4470C54EBE for ; Wed, 11 Jan 2023 07:32: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: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:In-Reply-To:References: List-Owner; bh=FQPvVZmuiElWtQgRmQBW9Vs7ob6PzKdFmGCnyqTbmK4=; b=Kodelfdn8yr4gL 8XMiW8+QY2EEP1oM5ENWj52s3OmjGjRLANvqU9/3DKmtCplzwh27EneHWvojC1V6aAi9D6Jf7HXiM wmbEBndbdP53oUlZHH5N2kYPveuNdKW+xeM61d5dRcEPoPRHIRA7pAFw4MGQNew+q2CrS/E2KiYHq LfeG1RSbCsnkMvKfia1Skr6xd4V8KEaUEi2qaGWT/AGuZL4HaO07OZZBFpULnXA0Rhttb03FVx5Y0 5b7UExddjLaRQt1rtLbDPB6Bn3HhuqWCbAA9oiYGXwo60tzdi0tvIoAOq6fZFVqjOdngddvlvKr6H /Va9w01JACJXFmVuE2og==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pFVZx-00A34Z-7t; Wed, 11 Jan 2023 07:31:21 +0000 Received: from mail-ed1-x532.google.com ([2a00:1450:4864:20::532]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pFVZs-00A32O-9I for linux-arm-kernel@lists.infradead.org; Wed, 11 Jan 2023 07:31:17 +0000 Received: by mail-ed1-x532.google.com with SMTP id s5so21050421edc.12 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=z41zDs86SU+V10dyeIFqTpq3E5TGBJRPyvseVSEEUxBtKIRBvzW57+xQIznWwnbK4O gjYVwwuBuZ1El2NNBW0wW7N5Vm0HDLoueLRkgL1NVaggeGzbpp2YMGPHWnANQrmu6VAT JS0u2+lrfUM5EAMDp42ZZjZcqOp2YUrzYAIN9FkXMRq1xQ3hwzdhVuGQB6XZH0TFQM4c zqL5FNZBtKCYHq/BizxFVCZe9mFjkWoFp8G2P4QlY929vvHmrpp4pD7GZoLKVndJwyMQ gcXbYFlFwJnX2zqtlAzaKUy5WFSfxz4XpEgOUrNn++O7Peec94K+9uWrrapAG4Xodp8+ KS0A== X-Gm-Message-State: AFqh2kqPmA1hjJ0XUDG8yVj84X/U27a2a3Zz6wjoPqNX4uYgf3PbedPs fLheIQHcWI70Ci6NCa/tbCI= 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-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230110_233116_361693_0396FE56 X-CRM114-Status: GOOD ( 12.21 ) 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 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,