From mboxrd@z Thu Jan 1 00:00:00 1970 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 phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 4A654C64EC4 for ; Thu, 9 Mar 2023 13:12:39 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 5D10F85E72; Thu, 9 Mar 2023 14:12:36 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=milecki.pl Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Received: by phobos.denx.de (Postfix, from userid 109) id 2192E85C8A; Thu, 9 Mar 2023 12:52:44 +0100 (CET) Received: from 12.mo583.mail-out.ovh.net (12.mo583.mail-out.ovh.net [46.105.39.65]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 1BA5285C14 for ; Thu, 9 Mar 2023 12:52:41 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=milecki.pl Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=rafal@milecki.pl Received: from director4.ghost.mail-out.ovh.net (unknown [10.108.16.108]) by mo583.mail-out.ovh.net (Postfix) with ESMTP id 1DAC223D8C for ; Thu, 9 Mar 2023 11:52:39 +0000 (UTC) Received: from ghost-submission-6684bf9d7b-ml9bn (unknown [10.108.1.233]) by director4.ghost.mail-out.ovh.net (Postfix) with ESMTPS id 23E731FE55; Thu, 9 Mar 2023 11:52:38 +0000 (UTC) Received: from RCM-web10.webmail.mail.ovh.net ([151.80.29.18]) by ghost-submission-6684bf9d7b-ml9bn with ESMTPSA id Tff4BobICWQMaB4AKXspMQ (envelope-from ); Thu, 09 Mar 2023 11:52:38 +0000 MIME-Version: 1.0 Date: Thu, 09 Mar 2023 12:52:37 +0100 From: =?UTF-8?Q?Rafa=C5=82_Mi=C5=82ecki?= To: Srinivas Kandagatla Cc: Miquel Raynal , =?UTF-8?Q?Rafa=C5=82_Mi?= =?UTF-8?Q?=C5=82ecki?= , Rob Herring , Krzysztof Kozlowski , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , Michael Walle , gregkh@linuxfoundation.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, u-boot@lists.denx.de Subject: Re: [PATCH 2/4] nvmem: core: allow nvmem_cell_post_process_t callbacks to adjust buffer In-Reply-To: References: <20230222172245.6313-1-zajec5@gmail.com> <20230222172245.6313-3-zajec5@gmail.com> <37f821b8-f681-08e4-d4f1-d37be191ff7f@linaro.org> <20230309113211.6321ce3d@xps-13> <2dc096f5-f5ce-f99b-42ac-0fb24682239a@linaro.org> <20230309122324.4b012a58@xps-13> User-Agent: Roundcube Webmail/1.4.13 Message-ID: X-Sender: rafal@milecki.pl X-Originating-IP: 194.187.74.233 X-Webmail-UserID: rafal@milecki.pl Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Ovh-Tracer-Id: 14449517931571489705 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -100 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedvhedrvdduiedgfeduucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuqfggjfdpvefjgfevmfevgfenuceurghilhhouhhtmecuhedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhepggffhffvvefujghffgfkgihitgfgsehtkehjtddtreejnecuhfhrohhmpeftrghfrghlucfoihhlvggtkhhiuceorhgrfhgrlhesmhhilhgvtghkihdrphhlqeenucggtffrrghtthgvrhhnpeejvdelgfeutdfhfeelheegfedtleduleeuvdfgfeefvefhvedtheetjeetfeehgeenucfkphepuddvjedrtddrtddruddpudelgedrudekjedrjeegrddvfeefpdduhedurdektddrvdelrddukeenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepihhnvghtpeduvdejrddtrddtrddupdhmrghilhhfrhhomhepoehrrghfrghlsehmihhlvggtkhhirdhplheqpdhnsggprhgtphhtthhopedupdhrtghpthhtohepuhdqsghoohhtsehlihhsthhsrdguvghngidruggvpdfovfetjfhoshhtpehmohehkeefpdhmohguvgepshhmthhpohhuth X-Mailman-Approved-At: Thu, 09 Mar 2023 14:12:34 +0100 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean On 2023-03-09 12:44, Srinivas Kandagatla wrote: > On 09/03/2023 11:23, Miquel Raynal wrote: >> Hi Srinivas, >> >> srinivas.kandagatla@linaro.org wrote on Thu, 9 Mar 2023 10:53:07 >> +0000: >> >>> On 09/03/2023 10:32, Miquel Raynal wrote: >>>> Hi Srinivas, >>>> >>>> srinivas.kandagatla@linaro.org wrote on Thu, 9 Mar 2023 10:12:24 >>>> +0000: >>>> >>>>> On 22/02/2023 17:22, Rafał Miłecki wrote: >>>>>> @@ -1791,11 +1792,15 @@ ssize_t nvmem_device_cell_read(struct >>>>>> nvmem_device *nvmem, >>>>>> if (!nvmem) >>>>>> return -EINVAL; >>>>>> > + /* Cells with read_post_process hook may realloc buffer we >>>>>> can't allow here */ >>>>>> + if (info->read_post_process) >>>>>> + return -EINVAL; >>>>> This should probably go in 1/4 patch. Other than that series looks >>>>> good to me. >>>> >>>> FYI patch 1/4 is also carried by the nvmem-layouts series, so it's >>>> probably best to keep these 2 patches separated to simplify the >>>> merging. >>> that is intermediate thing, but Ideally this change belongs to 1/4 >>> patch, so once I apply these patches then we can always rebase layout >>> series on top of nvmem-next >> >> Well, I still don't see the need for this patch because we have no use >> for it *after* the introduction of layouts. Yes in some cases changing >> the size of a cell might maybe be needed, but right now the use case >> is >> to provide a MAC address, we know beforehand the size of the cell, so >> there is no need, currently, for this hack. >> > Am confused, should I ignore this series ? I'm confused no less. I think we have 3 different opinions and no agreement on how to proceed. Rafał (me): NVMEM cells should be registered as they are in the raw format. No size adjustments should happen while registering them. If NVMEM cell requires some read post-processing then its size should be adjusted *while* reading. Michael: .read_post_process() should be realloc the buffer Miquel: While registering NVMEM cell its size should be already adjusted to match what .read_post_process() is about to return. I'm really sorry if I got anyone's view wrong.