On 6/27/24 4:58 PM, Srinivas Kandagatla wrote:
On 26/06/2024 17:07, Marek Vasut wrote:
On 6/26/24 3:07 PM, Srinivas Kandagatla wrote:
On 26/06/2024 05:11, Marek Vasut wrote:
static const struct attribute_group *nvmem_dev_groups[] = {
@@ -945,6 +988,7 @@ struct nvmem_device *nvmem_register(const struct
nvmem_config *config)
nvmem->read_only = device_property_present(config->dev,
"read-only") ||
config->read_only || !nvmem->reg_write;
+ nvmem->default_read_only = nvmem->read_only;
#ifdef CONFIG_NVMEM_SYSFS
nvmem->dev.groups = nvmem_dev_groups;
diff --git a/drivers/nvmem/internals.h b/drivers/nvmem/internals.h
index 18fed57270e5e..0667937ebb86b 100644
--- a/drivers/nvmem/internals.h
+++ b/drivers/nvmem/internals.h
@@ -16,6 +16,7 @@ struct nvmem_device {
int id;
struct kref refcnt;
size_t size;
+ bool default_read_only;
Its not very clear what is the need for this?
This field is used to discern devices which are by default read-write
provider drivers or any drivers should not be accessing this struct
directly.
from ones which are by default read-only. Only the former can be
Why should the drivers care about this?
If the read_only flag is set in the core, nvmem core should prohibit any
writes for this provider.
I think this is a nvmem core patch , isn't it ?