Message ID | 20240626041214.513242-1-marex@denx.de |
---|---|
State | Superseded |
Headers | show |
Series | [v3,1/4] nvmem: Replace spaces with tab in documentation | expand |
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 .
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 ?
On 27/06/2024 16:55, Marek Vasut wrote: > 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 ? All that I see in this patch is setting default_read_only and no user for it. unless am looking at wrong patch. --srin
On 6/27/24 6:21 PM, Srinivas Kandagatla wrote: > > > On 27/06/2024 16:55, Marek Vasut wrote: >> 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 ? > All that I see in this patch is setting default_read_only and no user > for it. unless am looking at wrong patch. Oh, now I understand, doh ... this is a remnant which should be removed. The force_ro attribute is now hidden for read-only devices outright in nvmem_attr_is_visible, so they cannot be switched to read-write mode. Fixed in V4, thanks.
diff --git a/Documentation/ABI/stable/sysfs-bus-nvmem b/Documentation/ABI/stable/sysfs-bus-nvmem index c399323f37de3..854bd11d72ac4 100644 --- a/Documentation/ABI/stable/sysfs-bus-nvmem +++ b/Documentation/ABI/stable/sysfs-bus-nvmem @@ -1,6 +1,6 @@ What: /sys/bus/nvmem/devices/.../nvmem Date: July 2015 -KernelVersion: 4.2 +KernelVersion: 4.2 Contact: Srinivas Kandagatla <srinivas.kandagatla@linaro.org> Description: This file allows user to read/write the raw NVMEM contents.
Replace two spaces with tab in the sysfs attribute documentation. No functional change. Signed-off-by: Marek Vasut <marex@denx.de> --- Cc: Alexandre Belloni <alexandre.belloni@bootlin.com> Cc: Arnd Bergmann <arnd@arndb.de> Cc: Bartosz Golaszewski <brgl@bgdev.pl> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Cc: Srinivas Kandagatla <srinivas.kandagatla@linaro.org> Cc: linux-i2c@vger.kernel.org --- V2: - New patch V3: - No change --- Documentation/ABI/stable/sysfs-bus-nvmem | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)