I don't think this should belong to nvmem core in anyway! Its more of consumer specific logic!What is the real use-case here, it does not make sense to me to add thisIt also return NULL when nvmem is not compiled in. I quiet like such
additional call just to return NULL when cell is not found!
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.