Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp8994349rwl; Tue, 10 Jan 2023 23:24:37 -0800 (PST) X-Google-Smtp-Source: AMrXdXvkUYYQNEZmNeo7IPG5vRZk1yHrHMEj/p6eFLfFElpJ1XZiaXRvShL7/T7vHmhRJYUdCVpC X-Received: by 2002:a17:902:6b02:b0:191:1c99:57ef with SMTP id o2-20020a1709026b0200b001911c9957efmr77902622plk.67.1673421877336; Tue, 10 Jan 2023 23:24:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673421877; cv=none; d=google.com; s=arc-20160816; b=ROj27T0vjLddfksqSRWZwM4tH07q2tt+K/r39flJ4zr8Hktypf3yEC/sItD4uWk6E5 8v0kNhWIphf2e9yUMj6Cw8QI90/KDXKjbaLX0FadYXuq/N1cuxnMZ4wjjkAkJxS1UvHF nyGOskxG1smu7a88e1/Z+axRzi/7PxzP4NDZjAqUG+PmKLySAjl1JMsN3/FprN1X+cTS U54NPbOMcL6opZnuPKX+4SCgbjOtrPULBwEen0I8dgCmJ6EbFHq+uSwKyQ/VisgsZYbu kI1SpX+uZ+5yrx16xx555+lAOIWaRQrixQx8m3mLC72VcX0CcVJmM/K/5T5KMiAF0bfW XJ5w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id; bh=wzSH7lp1JSzUePjd++hGliCB7X/6oFspTaBIyKOUT9g=; b=cIMWFfYHgZfP2vOrH5Xhw+9frJzcsy1gRqiSBxC0+MvPe0aXEkwFJWuTopKrB7gWbZ VHc+81hxM0sLE9e8ANhOVQ00fTBc79jJ+eDGsqtKM4jwipu3RzToTnVINEUcrYtqHDKF DQpuHIpsUQnrH2GzJNBp9atpUMJLRM65Lsaj8cuU0t/INntFAfokyas9O2BY2uNi938v RzgqCf5Y8fqmAdkV8GZcEWbOBRk8VpeZgBFpj/NKPCYcoBRjaXXnHyoQGYV98nVeZ+fl tdIxwjTXqk5Hh/bVmXxssnqWrtjpM/YUn5uoTJyCYAdhEF/pimx+oh9vvz5PskIUU8r/ eGAw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id m4-20020a170902bb8400b001895a1d382dsi3533738pls.451.2023.01.10.23.24.30; Tue, 10 Jan 2023 23:24:37 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235723AbjAKGwt (ORCPT + 53 others); Wed, 11 Jan 2023 01:52:49 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56056 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235515AbjAKGwh (ORCPT ); Wed, 11 Jan 2023 01:52:37 -0500 Received: from metis.ext.pengutronix.de (metis.ext.pengutronix.de [IPv6:2001:67c:670:201:290:27ff:fe1d:cc33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 29F41614C for ; Tue, 10 Jan 2023 22:52:36 -0800 (PST) Received: from ptz.office.stw.pengutronix.de ([2a0a:edc0:0:900:1d::77] helo=[127.0.0.1]) by metis.ext.pengutronix.de with esmtp (Exim 4.92) (envelope-from ) id 1pFUyJ-0006cZ-Bc; Wed, 11 Jan 2023 07:52:27 +0100 Message-ID: Date: Wed, 11 Jan 2023 07:52:22 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.5.0 Subject: Re: [PATCH 1/6] nvmem: core: add nvmem_dev_size() helper Content-Language: en-US To: =?UTF-8?B?UmFmYcWCIE1pxYJlY2tp?= , Srinivas Kandagatla , Rob Herring , Krzysztof Kozlowski Cc: devicetree@vger.kernel.org, Shawn Guo , Sascha Hauer , linux-kernel@vger.kernel.org, u-boot@lists.denx.de, Michael Walle , NXP Linux Team , Pengutronix Kernel Team , Miquel Raynal , =?UTF-8?B?UmFmYcWCIE1pxYJlY2tp?= , Fabio Estevam , linux-arm-kernel@lists.infradead.org References: <20230110105425.13188-1-zajec5@gmail.com> From: Ahmad Fatoum In-Reply-To: <20230110105425.13188-1-zajec5@gmail.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-SA-Exim-Connect-IP: 2a0a:edc0:0:900:1d::77 X-SA-Exim-Mail-From: a.fatoum@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,NICE_REPLY_A, RCVD_IN_DNSWL_MED,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 10.01.23 11:54, Rafał Miłecki wrote: > 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 > --- > 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 1f05f0a50d86..81743ae8793b 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. > + */ > +const size_t nvmem_dev_size(struct nvmem_device *nvmem) The const here is quite unusual. You can make the parameter a const struct nvmem_device though. > +{ > + 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..d88294ddf562 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); > > +const 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, -- Pengutronix e.K. | | Steuerwalder Str. 21 | http://www.pengutronix.de/ | 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |