Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp7214201imm; Tue, 28 Aug 2018 08:10:49 -0700 (PDT) X-Google-Smtp-Source: ANB0VdZI3AR5pFLWzIMeuu4YNKIWQrL30xqNIOWGzGGSAaxqWljZEisL2UiADqGhH+4Ty/tWxNfr X-Received: by 2002:a17:902:864b:: with SMTP id y11-v6mr1981884plt.335.1535469049062; Tue, 28 Aug 2018 08:10:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535469049; cv=none; d=google.com; s=arc-20160816; b=s36mDBGndJ6hDNIoFzMde0NXSPJe0OurXoGK+Ny1Xnd0s5AgJeDc4dvxX1GBOsPUGp RxPwkbmyL+Q1sOIhkvJCACK5NXHC6tnTNqY/VE0jNOme1SC0aRZXkG663xayHKQ02/Hb yqG59R7cb6Jn4nxmp/hwB+gEkvqMU5ygh9wPL9QKvwzNqPB1U6shzgQ8cj0x9NVtyrbK 4+zzKKb/iFH55WNIdFlrErkTCRxT7e22PNlPLL0MCBt3asJ8jpK6iec0dxdm26y93x5g WM+g1HUBtR5NsGAwiclnGHVj8THSPnO6TOqwoVdMkfbJKwQeriQNQouX86XGp2R1VAFD c1EQ== 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:from:references:cc:to:subject:dkim-signature :arc-authentication-results; bh=1ysuMyjslnNmKPvA1Q8Cl4aIB7ZkQNm5F4YreX8quzE=; b=rNzAvnGQEwTx1Le3DSHUauEU2T7Tr/UGgKX1aglXTPgZN7b3bHQes5Lh3OCVjRCtt8 Q1w919USojtL4uF/vWhICG/n70xKG/ArXVU4Mn5E6U9h4dU3QdbFO7M0d8lq3OkFtIGj xHKgLkjGfWQHeFXWxaYTlbd5nrGIgUrcNK4EdRDKdS29sSnwPgrJfq0NgHMitlkhObWY 1IlPI5XZup5J+nnO2b1pudFTQ/+d8L9Xq9kX7hit07aglAFY6EsEA6e+b0fTPw2wLdYk 8qhN4X5/F6LphZLlKrBMe7Rc9NTzTkS3z5YKYaUbyDTAWA3q8sI/6LzWN91Pr6FNSq76 0i0g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Y6VHVVXy; 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 m9-v6si1164891plt.478.2018.08.28.08.10.32; Tue, 28 Aug 2018 08:10:49 -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=Y6VHVVXy; 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 S1727166AbeH1TBS (ORCPT + 99 others); Tue, 28 Aug 2018 15:01:18 -0400 Received: from mail-wr1-f67.google.com ([209.85.221.67]:40735 "EHLO mail-wr1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727040AbeH1TBR (ORCPT ); Tue, 28 Aug 2018 15:01:17 -0400 Received: by mail-wr1-f67.google.com with SMTP id n2-v6so1917696wrw.7 for ; Tue, 28 Aug 2018 08:09:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=1ysuMyjslnNmKPvA1Q8Cl4aIB7ZkQNm5F4YreX8quzE=; b=Y6VHVVXy5OcolDYbpbhoDyREzRqmZ1OeUNDfaefg67fOCHmuvoeI3O8KVbOkLo0gbn qsHXscBoQ+iZDexppXZu965fWr8OZYXgA5dI5IDotqdUmsfHUysYfVkuvHMH9k1yb7is 8OPV0PhODqnISuILw5nrTb4LJjtXFbN+mbq+Y= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=1ysuMyjslnNmKPvA1Q8Cl4aIB7ZkQNm5F4YreX8quzE=; b=Ed0of3WydMtw27xGaE5d/J9OOy4MdpwbcYCKHBgFaiWhSFUJK2sA/Xy07dYtv9tY3i /1pPgxdche9Oil6/SSHT9llxQNi6q4vLyn79U3cEiDz0fZhcNplXxnCzptLPdDtDz9Vf kMyZ/qUGNu2zVy69w4SDR+cIaIKhTFf9c4mZyNHtW2K9h5iNygEHXFsyHbN0p6Se0wY6 0KhMbSXme3Uot9bMwMuLETIO8yxmsUUzpKTwucwTAN/eKEd8RsEdyiE+f2SBi8UyLY6/ RQiyq2jy6CYkHfghAI7wZRzlGyh1VDdf5unhIyFw56z6eAiWVBkWBhQFRhnHLipAb/O2 9HXQ== X-Gm-Message-State: APzg51BrZYdh2sOc/X+c0G/niMZb3JoD/M+8aMnAq4bZhru5Eqz1mI5I PL1xXudFuIMHm1ACM8h4Z/WO/Q== X-Received: by 2002:a5d:4fc3:: with SMTP id h3-v6mr1462763wrw.261.1535468949787; Tue, 28 Aug 2018 08:09:09 -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 l24-v6sm2676159wrb.65.2018.08.28.08.09.08 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 28 Aug 2018 08:09:09 -0700 (PDT) Subject: Re: [PATCH v2 01/29] nvmem: add support for cell lookups To: Boris Brezillon , Bartosz Golaszewski Cc: Andrew Lunn , linux-doc , Sekhar Nori , Bartosz Golaszewski , linux-i2c , Mauro Carvalho Chehab , Rob Herring , Florian Fainelli , Kevin Hilman , Richard Weinberger , Russell King , Marek Vasut , Paolo Abeni , Dan Carpenter , Grygorii Strashko , David Lechner , Arnd Bergmann , Sven Van Asbroeck , "open list:MEMORY TECHNOLOGY..." , Linux-OMAP , Linux ARM , Ivan Khoronzhuk , Greg Kroah-Hartman , Jonathan Corbet , Linux Kernel Mailing List , Lukas Wunner , Naren , netdev , Alban Bedel , Andrew Morton , Brian Norris , David Woodhouse , "David S . Miller" References: <20180810080526.27207-1-brgl@bgdev.pl> <20180810080526.27207-2-brgl@bgdev.pl> <20180824170848.29594318@bbrezillon> <20180824152740.GD27483@lunn.ch> <20180825082722.567e8c9a@bbrezillon> <20180827110055.122988d0@bbrezillon> <8cb75723-dc87-f127-2aab-54dd0b08eee8@linaro.org> <916e3e89-82b3-0d52-2b77-4374261a9d0f@linaro.org> <20180828165309.0594ae13@bbrezillon> From: Srinivas Kandagatla Message-ID: Date: Tue, 28 Aug 2018 16:09:07 +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: <20180828165309.0594ae13@bbrezillon> 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 28/08/18 15:53, Boris Brezillon wrote: > On Tue, 28 Aug 2018 16:41:04 +0200 > Bartosz Golaszewski wrote: > ... > >>> >>> static struct nvmem_cell *nvmem_find_cell(const char *cell_id) > > Can we get rid of this function and just have the the version that > takes an nvmem_name and a cell_id. That should be feasible! >>>>> >>>>> I hope you got the reason why of_nvmem_cell_get() always allocates new >>>>> instance for every get!! >>>> >>>> >>>> >>>> I admit I didn't test it, but just from reading the code it seems like >>>> in nvmem_cell_get() for DT-users we'll always get to >>>> of_nvmem_cell_get() and in there we always end up calling line 873: >>>> cell = kzalloc(sizeof(*cell), GFP_KERNEL); >>>> >>> That is correct, this cell is created when we do a get and release when we >>> do a put(). >>> >> >> Shouldn't we add the cell to the list, and check first if it's there >> and only create it if not? > > Or even better: create the cells at registration time so that the > search code is the same for both DT and non-DT cases. Only the > registration would differ (with one path parsing the DT, and the other > one searching for nvmem cells defined with a nvmem-provider-lookup > table). Makes sense! and that would go very well with the plan of "nvmem-cell" compatible for cells!. >