Thread (91 messages) 91 messages, 10 authors, 2018-10-04

[PATCH v2 01/29] nvmem: add support for cell lookups

From: Srinivas Kandagatla <hidden>
Date: 2018-08-28 15:09:14
Also in: linux-doc, linux-i2c, linux-omap, lkml, netdev


On 28/08/18 15:53, Boris Brezillon wrote:
On Tue, 28 Aug 2018 16:41:04 +0200
Bartosz Golaszewski [off-list ref] wrote:
...
quoted
quoted
  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!

quoted
quoted
quoted
quoted
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!.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help