lkml.org 
[lkml]   [2019]   [Jan]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH 3/8] nvmem: Add nvmem_cell_get_optional and devm_nvmem_cell_get_optional
From
Date


On 16/01/2019 18:26, Alban wrote:
>> What is the real use-case here, it does not make sense to me to add this
>> additional call just to return NULL when cell is not found!
> It also return NULL when nvmem is not compiled in. I quiet like such
> convenience functions as they make the driver code much simpler and
> the intent explicit. It replace:
>
> data->cell = devm_nvmem_cell_get(dev, "my-cell");
> if (IS_ERR(data->cell) {
> if (PTR_ERR(data->cell) == -ENOENT ||
> PTR_ERR(data->cell) == -EOPNOTSUPP)
> data->cell = NULL;
> else
> return PTR_ERR(data->cell);
> }
>
> with:
>
> data->cell = dev_nvmem_cell_get_optional(dev, "my-cell");
> if (IS_ERR(cell))
> return PTR_ERR(data->cell);
>
> It's your call if you find that useful or not.
I don't think this should belong to nvmem core in anyway! Its more of
consumer specific logic!

I have already applied all of the patches in this series except this one!

thanks,
srini

\
 
 \ /
  Last update: 2019-01-17 11:21    [W:0.045 / U:4.312 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site