Thread (26 messages) 26 messages, 9 authors, 2019-08-21

Re: [PATCH v4 3/9] nvmem: core: add nvmem_device_find

From: Srinivas Kandagatla <hidden>
Date: 2019-08-14 12:53:32
Also in: linux-input, linux-mips, linux-rtc, lkml, netdev


On 14/08/2019 12:46, Thomas Bogendoerfer wrote:
On Tue, 13 Aug 2019 10:40:34 +0100
Srinivas Kandagatla [off-list ref] wrote:
quoted

On 09/08/2019 11:32, Thomas Bogendoerfer wrote:
quoted
nvmem_device_find provides a way to search for nvmem devices with
the help of a match function simlair to bus_find_device.

Signed-off-by: Thomas Bogendoerfer <redacted>
---
   drivers/nvmem/core.c           | 62 ++++++++++++++++++++++--------------------
   include/linux/nvmem-consumer.h |  9 ++++++
   2 files changed, 41 insertions(+), 30 deletions(-)
Have you considered using nvmem_register_notifier() ?
yes, that was the first idea. But then I realized I need to build up
a private database of information already present in nvmem bus. So I
looked for a way to retrieve it from there. Unfortunately I couldn't
use bus_find_device directly, because nvmem_bus_type and struct nvmem_device
is hidden. So I refactured the lookup code and added a more universal
lookup function, which fits my needs and should be usable for more.
I see your point.

overall the patch as it is look good, but recently we added more generic 
lookups for DT node, looks like part of your patch is un-doing generic 
device name lookup.

DT node match lookup is in 
https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core.git/log/?h=generic_lookup_helpers

of_nvmem_match and nvmem_match_name are duplicating the code here.
Looks like its possible to use generic lookups along with custom match 
by splitting __nvmem_device_get() to two functions, one for lookup and 
other for refcounting.

Other missing bit is adding this api to documentation in 
./Documentation/driver-api/nvmem.rst


thanks,
srini
Thomas.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help