Re: [PATCH v3 4/4] nvmem: core: Implement force_ro sysfs attribute

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 





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.

--srini

switched between read-write and read-only mode ; the later cannot be switched to read-write mode .





[Index of Archives]     [Linux GPIO]     [Linux SPI]     [Linux Hardward Monitoring]     [LM Sensors]     [Linux USB Devel]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux