From patchwork Thu Dec 21 17:34:17 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: 13502447 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 3C870C46CD2 for ; Thu, 21 Dec 2023 17:35:08 +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=g2UusGQMlzWpXG8Z3kfC/tR+G2AByqvmvrb+NcfYi/M=; b=jyFCpaT/ENtyAE LIxioR0Eon08pI4e3t9cXSXGFB272jFYh1ANvzWk8+ZqOuqq2J5e9chC07roqZtinU7bU+IYomELW qJOYVzuxdJcNkwDyq+aJheWRyK+wVaSXrWC1XmT+qCrl7pbrjaWt3vya158U9+I6HmY9TFc80+m86 /q4evfhSXCRejVliCAxSUFOwE1U/CB7vreCfGDL/znfkbV7vHt4bXxFqKpgSgEWyMHFdY7BgxyKGW 7lgzPLBTQ6qXai7Y+dJVsLKLvWJq4itsHP4vPhDEd3qDdbMfm9zl+zj/qJcxSP/y0KrKlrdJl5EC9 rr8MhLZCGHjsr8pkwZIw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1rGMwX-003g6F-0v; Thu, 21 Dec 2023 17:34:45 +0000 Received: from mail-ej1-x62d.google.com ([2a00:1450:4864:20::62d]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1rGMwP-003g19-0k; Thu, 21 Dec 2023 17:34:38 +0000 Received: by mail-ej1-x62d.google.com with SMTP id a640c23a62f3a-a1fae88e66eso126856766b.3; 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=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=HS/utwklj/mQdHgmYltSxcVR9bMR4HdMDBmcgJXrZDU=; b=a1OwRddjsOw6e3WNbVkhKKEcx11OjL+rna3wr2DYQN/2sdR8pSw9zFmGGXhcnsQP/w Tz3RavdMczSfcWQP6tDZnBS4gTq9KONbboFemoEEULhD5QsCncRiNtJMLRaomV0JI0VR PGcTtxojqwouEgFnd6bd3aCQWjJVlpqxDCuh2iuP8SJNNiJoZi+l/dkX6tbLkfqektiH IK2MQOsZZNVyoCKPYTA6vJPU23hteOWCaD8661p/oaZZtoDSEWVUxHd0PWlRZPll/TGK 2o1t+rdmKBMWrBnyFlKeLMZJkhlLplAKc3sGDXeIJLIwt7RMxkIyZkzS7OSKmP40P+vB RmQw== 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=woynU/iQ6J6XHHCpbzHHKnmJ9eEwn7zKWYOVWpkR++U1/6FGKWhH8NUX1OD7cVKEUw dKOTEynupo2O37veiIKcCBtpjFGQnHD3Jd72PnBPkuRtY7DcYrjKx0i1lc35ppoocY3P iSkelcBzQo1g34tZInDd6X0ghWpR7XkiiEoN2JTslZMf0bQeuVNUBGOuczDIVg1ZIdxs s/QVA/uLHe+QPupZmaEX0lZ801DToXuJl36RYV6/a6Oz5fY5rE2HketzEiXs1ddGI38w 0SpuTQdF9JZX7gHXH4MH9geE9jKlpcL+eeI/iedAy2c1GSwYY+pnFf1a56bxDzdE36Dx W/eQ== X-Gm-Message-State: AOJu0YxaJtBVlYcUZ3FNxsDaG48b94C6c19WPHfeYQFpDHtqczrJfpfS dVvYqNg5WmyITpMvGJ4LM3s= X-Google-Smtp-Source: AGHT+IGgwY5w6AQTHQ1MgBWS25JJJBhWhKSdij/Jvg0xGBl8Vj+fXysVr5sbWXq5EX6J52TSERKREQ== 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?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 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> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231221_093437_286606_F032FB9A X-CRM114-Status: GOOD ( 10.91 ) 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 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);