Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp5121475imm; Tue, 21 Aug 2018 06:40:15 -0700 (PDT) X-Google-Smtp-Source: AA+uWPyV6AY2ZKtj3wa1oArvBltskpyDUXEhkEa3DVHLfhJphS/QltUnseVMJgslVO6RGgbELqdI X-Received: by 2002:a63:f50a:: with SMTP id w10-v6mr47892080pgh.23.1534858815776; Tue, 21 Aug 2018 06:40:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1534858815; cv=none; d=google.com; s=arc-20160816; b=ylYPoJ/FDz4l1Ec1y/o751gR9+i19fuZgmtFbll71ELajwVMtyTAw6CMwBYsFkuVGH p0HVOhNcvfZ8pFPgkdqAvBaCdGysgj2QyhMuhGdiFkM0fUQ9O0ZaZ9CPORlRB8H21eof HPWRV2KmsGMAnTrxJ7N6IYKmVFLX6DPWtunDiHjOr40mGeIB52OWcaJdQMzp2uhIk2CL 1qpaFK4TtGKuh5xKL3w/AzxmZrtIBOOqNiInai+EMcpaRCGTPC7cW8sJ/YibHe3H199Q K5GFNdizOKf3FqPngaTrKoaU2Sy0cIrKmw77uFZ5wrBeV/fO0zSu1Pg6X1LCajvdDxfx E6Yw== 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 :content-language:in-reply-to:mime-version:user-agent:date :message-id:references:cc:to:from:subject:dkim-signature :arc-authentication-results; bh=c3FGXtXraDYavnNHQ6PfwMtvYlepArQRRSDaOYb2QoM=; b=ANx+0xVgmalvPb8OtO/yycdjvxERl60VcaQ9ZPWqdGEptiZQCxNT3BS9g2XYH/g5Of YARCIG6eCiDk6muBdFXoJpszSFX+0HVv7E+VKJp2NnbYqh2Hss+CEaMoO1vG3NTBhB6l Kg1A8v3y/K6aGxknKJxpNsWv4GQLAZGoC8NZnJhJjbS9QeWy2KW2n0jJYibBoIxBXMtK piv9ol5e9vMS0lgdGs7KyN/1c3RPx6DOTzcXrQCoVfGTGx9gqtcol03UUBCEjNJS/+16 LTTzn9shHDGdG/oQK6GpWjoQw2TnwvdsDg5l1kYNksvWmXusYBaOIyCMTMclNzc7xS5l s2Ww== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=TlSoGFQ9; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h11-v6si13374589plk.141.2018.08.21.06.40.00; Tue, 21 Aug 2018 06:40:15 -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; dkim=pass header.i=@linaro.org header.s=google header.b=TlSoGFQ9; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727046AbeHUQ5y (ORCPT + 99 others); Tue, 21 Aug 2018 12:57:54 -0400 Received: from mail-wm0-f67.google.com ([74.125.82.67]:50431 "EHLO mail-wm0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726881AbeHUQ5w (ORCPT ); Tue, 21 Aug 2018 12:57:52 -0400 Received: by mail-wm0-f67.google.com with SMTP id s12-v6so2997308wmc.0 for ; Tue, 21 Aug 2018 06:37:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=subject:from:to:cc:references:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=c3FGXtXraDYavnNHQ6PfwMtvYlepArQRRSDaOYb2QoM=; b=TlSoGFQ9YfWHcfa3msWSwmkJFxCv9Ts9rQKHv+44b3T2U8qrtZZMRtwSan2cVIQT0K AMFG7Ez0NeLll7Bcfmbg+Ulu6alAgi+8jySgCHkXQ+UOGAGZMXg3/BLgHq7Wk7hAxA+E KNVDqrEXzwqSBeb39VvmSDo/RwrQFEY7++bbA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:from:to:cc:references:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=c3FGXtXraDYavnNHQ6PfwMtvYlepArQRRSDaOYb2QoM=; b=El6z/6909d4ASrMToxABQB1IsnvDR1FJKGC8xfOOxQEjhc0LzNPbMaEtHI23dBauj4 p+GtBpxmzHNk6JI+ao8hI2/jBgTVM3/gISC8YyIBtadfdlIeH6kRzJEw185orBceu1fA WYt4s5Ojv2ZiRIwvDu6SpXT+KmElcS+32Wctb3h9gWNyo6i1Eqahzs9k/AqREMtoJlV2 nLcn5COaZcYt8ekKESdHXXdm+EMWPg8pm7gQGVtp2VqaeWht7wnecMLg73Hn2johVD4X j1gL/s+Q1d0g7Dj/U95NsBokmy0l4gxA8MGkqOHCjeboL/hRYeUQZd3w0knkFrx9lBNs Cglg== X-Gm-Message-State: AOUpUlEqaPwp7iI9sGzdgidsOLhlGBN3nHxXJV45qSM+SsjhAFRz6ZKZ WPAke+wiLh903D48CimGE6IHOQ== X-Received: by 2002:a1c:c019:: with SMTP id q25-v6mr28160061wmf.148.1534858659737; Tue, 21 Aug 2018 06:37:39 -0700 (PDT) Received: from [192.168.0.18] (cpc90716-aztw32-2-0-cust92.18-1.cable.virginm.net. [86.26.100.93]) by smtp.googlemail.com with ESMTPSA id t25-v6sm1985449wmh.15.2018.08.21.06.37.38 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 21 Aug 2018 06:37:39 -0700 (PDT) Subject: Re: [PATCH v2 06/29] mtd: Add support for reading MTD devices via the nvmem API From: Srinivas Kandagatla To: Boris Brezillon 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 , Rob Herring , 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 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> Message-ID: Date: Tue, 21 Aug 2018 14:37:37 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 MIME-Version: 1.0 In-Reply-To: <6fb36da4-c985-6d6e-f9e1-572f5cd7609b@linaro.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. --srini