From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on archive.lwn.net X-Spam-Level: X-Spam-Status: No, score=-5.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham autolearn_force=no version=3.4.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by archive.lwn.net (Postfix) with ESMTP id 2A21E7D00B for ; Tue, 28 Aug 2018 15:09:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727074AbeH1TBR (ORCPT ); Tue, 28 Aug 2018 15:01:17 -0400 Received: from mail-wr1-f65.google.com ([209.85.221.65]:43753 "EHLO mail-wr1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726120AbeH1TBR (ORCPT ); Tue, 28 Aug 2018 15:01:17 -0400 Received: by mail-wr1-f65.google.com with SMTP id k5-v6so1916864wre.10 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=NSaGk020Jk/wo+PhQ7DRnrowFEtpDeIoFhslKQdDyhSaDfgIz4n/0IPkWeuxl8buW0 c0BSSpgtMWsybYlUWLwvnVkAsn9aY9aIkXRMfYnaZegCBy2sYGe6ZckSp2LByeEsDwz3 N1OSyLt43SlCxCja0T3wjkrhX3Peav3TmEwe6/VJUNT/SAWAzD0EwoTibq2Wg9JcM+eI suhfscRL++/V9bR1Hb4tuy8FZKihrwIxg6ljtXHbNYUA+N7ScaRBnv5giHG5MsnJ5ZlB 7CW8Sk1JT7XXZgtjp79tcbekktI+Yo9p/S0Rh9Xhi1Q7WWnZIhp6BHDKCsXefUJJX8Ny JuKA== X-Gm-Message-State: APzg51Ag+12tdvSKnYD/La6KFv+IbqA+Kil76lwoHZaTgDhZB2kb+3t2 p8x8fXoJNbpEvscOcmh9XLhreA== X-Google-Smtp-Source: ANB0VdYfJDCvkUlbOerVbEIU868dvteCd+l+UHkYxuwCGPGBZjvBeGVQ4sWOtPuuoLQGHkU6d1vz4g== 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-doc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-doc@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!. >