From patchwork Fri Jan 27 12:57:04 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: 13118674 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 AE592C38142 for ; Fri, 27 Jan 2023 13:25:48 +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=SkOxQE7YHE+lNQENNYxaeavCuNm+v5CCbRSYp9AJsjw=; b=UOn6iSOSToP+TL Ga13ZM6xQf9q37YVdkVD000LhH0EdlXnG1GGzficScfjNVTRlwRsvGwgWDPja5VsEsCd+KFwG5+qQ tKqVuWVx0uq6sbT8hwob5mSxiCDE6nWU3R0FftCmlWBLYe4O62BKxPVY2LTjsIs7DW5BtcFovKJZP sOT6JlUOzKlH9u3Z3ZrmupnSYxUVWVr2IQWQs7YdHlUqVtI5VmTLjlw8xe1pzi5vR3qtNtHdhHL78 kJKcWSsRxN7FraCWtI4oj+BTjgMDsVzkDqyxpQMjekTmeb4zZCceA7DECwAFc88VhQI2qVfg6s+KO bTipLGt42I0npunY4sGA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pLOiU-00Ey95-Uj; Fri, 27 Jan 2023 13:24:31 +0000 Received: from mail-ed1-x529.google.com ([2a00:1450:4864:20::529]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pLOID-00Em0q-Kp for linux-arm-kernel@lists.infradead.org; Fri, 27 Jan 2023 12:57:25 +0000 Received: by mail-ed1-x529.google.com with SMTP id z11so4680127ede.1 for ; Fri, 27 Jan 2023 04:57:18 -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=WSGMh7tRNAaLj5yI1m4PdJqLgl2acNMOyBtFtlK7OZk=; b=QwChc0PKt4BnWFjr/KdVghPRZqy3T2yTdWM7BYwvCzsYOHWWkhWqkuBK/CKWB+hiuR 74a55Kfc/aa1z76rQBd6a9a0PK2/7SXelwmC88ai1mm/2KEqZNxjUIftDMrUj15rWPo+ J5EohSEHtCCOJfLHHgQszp62I/bCTWMR5llQP9DpchNEnIClDFjE1uJWxxVRi7MgBJCm Q01Subftos9N9h14/ntJjV9G97HO/g0kS3Mx3jWzMRjtIacVz4V43rfM96IPR+d/KrNO Gnc7HsmPRFgujE0Tt/hUyGW/XQepQHsoQZEs1sooSM59OtGkpcXc46d42bUi7YzLvfnk NbwQ== 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=WSGMh7tRNAaLj5yI1m4PdJqLgl2acNMOyBtFtlK7OZk=; b=yE8F1ImcMAQTGsXu9jSQdosSfEDhb/HEjt3juA2TxV/ic+1Tyf1MLAfzz2CMKY/8Fo vcAvUuo3f25qjHOzhWnnJJt31YWR63nX3d+J8UR0HlEYz7btCY7Ps+/a+qmhSYoyBwBL oUk4POtBcs7VuFmQ1tUm8MoKPok3KdCIQ89Nx7U5qC8J1D9s+J+fbeHlKLfZCJReWoh7 jFAJHRqGborOsln8OFFrkvbYIhJYDUqwdg3h6mpK0VoJ9NZCJu+b5F2HwO15l5yglZKD dpfgqo6gt0jCrGtR31FJYHeHKUmD+sfiYl5zcHD4Xufl/88FukqdWJ6SRtkVj1oqkF2Y I1+Q== X-Gm-Message-State: AO0yUKUMJu2J2vPmSZelhomThOBmFA9ET6EuGZi0/TSsTl11fQvA1Sis VsFOxe/BSV8ndBikhY9biA8= X-Google-Smtp-Source: AK7set9fiieDJvoI0cIIXqfh2KwwgHZ/FqCug9cxZlmhbl+skSmKi2RvQL5akuVkh2MI4nIWsO2p5w== X-Received: by 2002:a05:6402:298c:b0:49f:a3d7:b84d with SMTP id eq12-20020a056402298c00b0049fa3d7b84dmr16189411edb.34.1674824237029; Fri, 27 Jan 2023 04:57:17 -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 y5-20020a056402358500b00482e0c55e2bsm2248136edc.93.2023.01.27.04.57.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 27 Jan 2023 04:57:16 -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 V3 1/6] nvmem: core: add nvmem_dev_size() helper Date: Fri, 27 Jan 2023 13:57:04 +0100 Message-Id: <20230127125709.32191-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-20230127_045721_747133_A5B7122A X-CRM114-Status: GOOD ( 11.79 ) 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 Reviewed-by: Miquel Raynal --- 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 38a5728bc65c..9e77af0164aa 100644 --- a/drivers/nvmem/core.c +++ b/drivers/nvmem/core.c @@ -2063,6 +2063,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,