Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp5141842imm; Tue, 21 Aug 2018 07:00:46 -0700 (PDT) X-Google-Smtp-Source: AA+uWPzsFJP1An6LhWBBz6j5p7yO1f5AxA8cFg3bjNKfl0c+gUSBniO0jZor0Qrgn7On9rpFZexm X-Received: by 2002:a62:7f91:: with SMTP id a139-v6mr42710459pfd.99.1534860046147; Tue, 21 Aug 2018 07:00:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1534860046; cv=none; d=google.com; s=arc-20160816; b=X37okYNzuwg2RbGsb2WDLk0uNEA4uqtVJvE6teohdmfs26I53rzIeYxdfnbgKCHKDJ PE5vVAJKb+QPZtSN9X/xkKShTONTUhw2DEcvVUAqrwAg8oCLctcdusmf+typoIB8Y+CD 7lhao07GIOeB6nOxG86o5Jk1a9mfYQJTMYjOUKRoiwmNq198vzQfhH5ARRyI5m4MVxQw zy7klTjh2K233ms+xObehxZcGcsMIwJrIlsaSAvvOiPhOsDqNxG6pyUxktljYR0It8ej dp13zLYkfL+GzQzxQABLyx5KseEi8gG8VcoqNlyoXX7yLGO6wsgv8iTCbdeb1DpT54Vn lOqA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :arc-authentication-results; bh=vc+vDbfteMxQqhzlpTUguZCWRYdHxZlR+QR+HlStABk=; b=BKsfRjy09ziq/el6aBiD0XiPdyxVfVdhGKDlNj6Q9gEwmY8imiGuWwr1Z1ANNUaby7 rFr9J9eCWcaDfFfhQschKhmHMhJlUSbKhNrSv4i13GS48TJ8u4bM+4w9Ryn3P4jIv5jN 20QcO+snNdOp+54r8qkOfAthSv2zd9H5SP6OxA3poC+C/vnm+G+aSu37Ksf+S4Kebka3 mEzrFYYSbP/vtmzy/CSGSIW3yh8SfCpnhmbaYG/dMXjb6BYeOOE0BiN+MEvsJ3tDzQfw jkGTLJfRST1R3S9QICCwqWm+dreGIyHcmkwGpFkb/8BBiHqX7gzpHe8JFz1ESlTBmpiy yHbA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k130-v6si13658513pfc.282.2018.08.21.07.00.30; Tue, 21 Aug 2018 07:00:46 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727507AbeHURRz (ORCPT + 99 others); Tue, 21 Aug 2018 13:17:55 -0400 Received: from mail.bootlin.com ([62.4.15.54]:42945 "EHLO mail.bootlin.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727415AbeHURRy (ORCPT ); Tue, 21 Aug 2018 13:17:54 -0400 Received: by mail.bootlin.com (Postfix, from userid 110) id EF7B8207B1; Tue, 21 Aug 2018 15:57:35 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mail.bootlin.com X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,SHORTCIRCUIT, URIBL_BLOCKED shortcircuit=ham autolearn=disabled version=3.4.0 Received: from bbrezillon (91-160-177-164.subs.proxad.net [91.160.177.164]) by mail.bootlin.com (Postfix) with ESMTPSA id A2D002072F; Tue, 21 Aug 2018 15:57:33 +0200 (CEST) Date: Tue, 21 Aug 2018 15:57:31 +0200 From: Boris Brezillon To: Srinivas Kandagatla , Rob Herring Cc: Alban , Bartosz Golaszewski , Jonathan Corbet , Sekhar Nori , Kevin Hilman , Russell King , Arnd Bergmann , Greg Kroah-Hartman , David Woodhouse , Brian Norris , Marek Vasut , Richard Weinberger , Grygorii Strashko , "David S . Miller" , Naren , Mauro Carvalho Chehab , Andrew Morton , Lukas Wunner , Dan Carpenter , Florian Fainelli , Ivan Khoronzhuk , Sven Van Asbroeck , Paolo Abeni , David Lechner , Andrew Lunn , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-i2c@vger.kernel.org, linux-mtd@lists.infradead.org, linux-omap@vger.kernel.org, netdev@vger.kernel.org, Bartosz Golaszewski Subject: Re: [PATCH v2 06/29] mtd: Add support for reading MTD devices via the nvmem API Message-ID: <20180821155731.11cae21b@bbrezillon> In-Reply-To: References: <20180810080526.27207-1-brgl@bgdev.pl> <20180810080526.27207-7-brgl@bgdev.pl> <20180817182720.6a6e5e8e@bbrezillon> <20180819133106.0420df5f@tock> <20180819184609.6dcdbb9a@bbrezillon> <20180821005327.0d312a85@tock> <20180821074404.23aaeb6b@bbrezillon> <81407b4d-a02f-4085-f333-a96102bd96ce@linaro.org> <20180821133136.1fada1b6@bbrezillon> <6fb36da4-c985-6d6e-f9e1-572f5cd7609b@linaro.org> X-Mailer: Claws Mail 3.15.0-dirty (GTK+ 2.24.31; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 21 Aug 2018 14:37:37 +0100 Srinivas Kandagatla wrote: > On 21/08/18 14:34, Srinivas Kandagatla wrote: > > > > > > On 21/08/18 12:31, Boris Brezillon wrote: > >>> * struct nvmem_config - NVMEM device configuration > >>> @@ -58,6 +62,7 @@ struct nvmem_config { > >>> bool root_only; > >>> nvmem_reg_read_t reg_read; > >>> nvmem_reg_write_t reg_write; > >>> + nvmem_match_t match; > >>> int size; > >>> int word_size; > >>> int stride; > >>> > >> That might work if nvmem cells are defined directly under the mtdnode. > > Layout should not matter! which is the purpose of this callback. > > > > The only purpose of this callback is to tell nvmem core that the > > node(nvmem cell) belongs to that provider or not, if it is then we > > successfully found the provider. Its up to the provider on which layout > > it describes nvmem cells. Additionally the provider can add additional > > sanity checks in this match function to ensure that cell is correctly > > represented. > > > > > >> If we go for this approach, I'd recommend replacing this ->match() hook > >> by ->is_nvmem_cell() and pass it the cell node instead of the nvmem > >> node, because what we're really after here is knowing which subnode is > >> an nvmem cell and which subnode is not. > > > > I agree on passing cell node instead of its parent. Regarding basic > > validating if its nvmem cell or not, we can check compatible string in > > nvmem core if we decide to use "nvmem-cell" compatible. > > > > Also just in case if you missed this, nvmem would not iterate the > Sorry !! i hit send button too quickly I guess. > > What I meant to say here, is that nvmem core would not iterate the > provider node in any case. > > Only time it looks at the cell node is when a consumer requests for the > cell. I did miss that, indeed. Thanks for the heads up. So, the "old partitions being considered as nvmem cells" is not really a problem, because those parts shouldn't be referenced. This leaves us with the config->force_compat_check topic, which I'd like to have to ensure that nvmem cells under MTD nodes actually have compatible = "nvmem-cell" and prevent people from inadvertently omitting this prop. And of course, we need Rob's approval on this new binding :-).