nvmem: Replace spaces with tab in documentation
Subsystems (2)
PATCH v2 1/4 nvmem: Replace spaces with tab in documentation
Replace two spaces with tab in the sysfs attribute documentation. No functional change.
---
Cc: Alexandre Belloni <[email protected]>
Cc: Arnd Bergmann <[email protected]>
Cc: Bartosz Golaszewski <[email protected]>
Cc: Greg Kroah-Hartman <[email protected]>
Cc: Srinivas Kandagatla <[email protected]>
Cc: [email protected]
---
V2: - New patch
--- Documentation/ABI/stable/sysfs-bus-nvmem | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Documentation/ABI/stable/sysfs-bus-nvmem +1 -1
@@ -1,6 +1,6 @@ What: /sys/bus/nvmem/devices/.../nvmem Date: July 2015 -KernelVersion: 4.2 +KernelVersion: 4.2 Contact: Srinivas Kandagatla <[email protected]> Description: This file allows user to read/write the raw NVMEM contents.
Signature · 1 line
2.43.0
PATCH v2 2/4 nvmem: Document type attribute
Document a type attribute used by userspace to discern different types of NVMEM devices. The implementation is already present, the ABI document is missing, add it.
---
Cc: Alexandre Belloni <[email protected]>
Cc: Arnd Bergmann <[email protected]>
Cc: Bartosz Golaszewski <[email protected]>
Cc: Greg Kroah-Hartman <[email protected]>
Cc: Srinivas Kandagatla <[email protected]>
Cc: [email protected]
---
V2: - New patch
--- Documentation/ABI/stable/sysfs-bus-nvmem | 11 +++++++++++ 1 file changed, 11 insertions(+)
Documentation/ABI/stable/sysfs-bus-nvmem +11 -0
@@ -20,3 +20,14 @@ Description: ... * 0001000 + +What: /sys/bus/nvmem/devices/.../type +Date: November 2018 +KernelVersion: 5.0 +Contact: Alexandre Belloni <[email protected]> +Description: + This read-only attribute allows user to read the NVMEM + device type. Supported types are "Unknown", "EEPROM", + "OTP", "Battery backed", "FRAM". + Note: This file is only present if CONFIG_NVMEM_SYSFS + is enabled
Signature · 1 line
2.43.0
Re: [PATCH v2 2/4] nvmem: Document type attribute
Quoted 5 lines · Marek Vasut
Document a type attribute used by userspace to discern different types of NVMEM devices. The implementation is already present, the ABI document is missing, add it.
Signed-off-by Marek Vasut <[email protected]>
Quoted 35 lines
---
Cc: Alexandre Belloni <[email protected]>
Cc: Arnd Bergmann <[email protected]>
Cc: Bartosz Golaszewski <[email protected]>
Cc: Greg Kroah-Hartman <[email protected]>
Cc: Srinivas Kandagatla <[email protected]>
Cc: [email protected]
---
V2: - New patch--- Documentation/ABI/stable/sysfs-bus-nvmem | 11 +++++++++++ 1 file changed, 11 insertions(+)Documentation/ABI/stable/sysfs-bus-nvmem +11
-0@@ -20,3 +20,14 @@ Description: * 0001000 + +What: /sys/bus/nvmem/devices/.../type +Date: November 2018 +KernelVersion: 5.0 +Contact: Alexandre Belloni <[email protected]> +Description: + This read-only attribute allows user to read the NVMEM + device type. Supported types are "Unknown", "EEPROM", + "OTP", "Battery backed", "FRAM". + Note: This file is only present if CONFIG_NVMEM_SYSFS + is enabledSignature · 1 line
2.43.0
Signature · 3 lines
Alexandre Belloni, co-owner and COO, Bootlin Embedded Linux and Kernel engineering https://bootlin.com
PATCH v2 3/4 nvmem: Use sysfs_emit() for type attribute
In reply to Marek VasutUse sysfs_emit() instead of sprintf() to follow best practice per Documentation/filesystems/sysfs.rst
"show() should only use sysfs_emit()...
"
---
Cc: Alexandre Belloni <[email protected]>
Cc: Arnd Bergmann <[email protected]>
Cc: Bartosz Golaszewski <[email protected]>
Cc: Greg Kroah-Hartman <[email protected]>
Cc: Srinivas Kandagatla <[email protected]>
Cc: [email protected]
---
V2: - New patch
--- drivers/nvmem/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/nvmem/core.c +1 -1
@@ -179,7 +179,7 @@ static ssize_t type_show(struct device *dev, {struct nvmem_device *nvmem =to_nvmem_device (dev); -return sprintf (buf,"%s\n" , nvmem_type_str[nvmem->type]); +return sysfs_emit (buf,"%s\n" , nvmem_type_str[nvmem->type]); }static DEVICE_ATTR_RO (type);
Signature · 1 line
2.43.0
PATCH v2 4/4 nvmem: core: Implement force_ro sysfs attribute
In reply to Marek VasutImplement "force_ro" sysfs attribute to allow users to set read-write devices as read-only and back to read-write from userspace. The choice of the name is based on MMC core 'force_ro' attribute.
This solves a situation where an AT24 I2C EEPROM with GPIO based nWP signal may have to be occasionally updated. Such I2C EEPROM device is usually set as read-only during most of the regular system operation, but in case it has to be updated in a controlled manner, it could be unlocked using this new "force_ro" sysfs attribute and then re-locked again.
The "read-only" DT property and config->read_only configuration is respected and is used to set default state of the device, read-only or read-write, for devices which do implement .reg_write function. For devices which do not implement .reg_write function, the device is unconditionally read-only and the "force_ro" attribute is not visible.
---
Cc: Alexandre Belloni <[email protected]>
Cc: Arnd Bergmann <[email protected]>
Cc: Bartosz Golaszewski <[email protected]>
Cc: Greg Kroah-Hartman <[email protected]>
Cc: Srinivas Kandagatla <[email protected]>
Cc: [email protected]
---
V2: - Document the force_ro attribute
- Use sysfs_emit()
--- Documentation/ABI/stable/sysfs-bus-nvmem | 13 +++++++ drivers/nvmem/core.c | 44 ++++++++++++++++++++++++ drivers/nvmem/internals.h | 1 + 3 files changed, 58 insertions(+)
Documentation/ABI/stable/sysfs-bus-nvmem +13 -0
@@ -1,3 +1,16 @@ +What: /sys/bus/nvmem/devices/.../force_ro +Date: June 2024 +KernelVersion: 6.11 +Contact: Marek Vasut <[email protected]> +Description: + This read/write attribute allows users to set read-write + devices as read-only and back to read-write from userspace. + This can be used to unlock and relock write-protection of + devices which are generally locked, except during sporadic + programming operation. + Note: This file is only present if CONFIG_NVMEM_SYSFS + is enabled + What: /sys/bus/nvmem/devices/.../nvmem Date: July 2015 KernelVersion: 4.2
drivers/nvmem/core.c +44 -0
69 lines not on this page · raw message
drivers/nvmem/internals.h +1 -0
@@ -16,6 +16,7 @@ struct nvmem_device {int id;struct kref refcnt;size_t size; +bool default_read_only;bool read_only;bool root_only;int flags;
Signature · 1 line
2.43.0
Re: [PATCH v2 4/4] nvmem: core: Implement force_ro sysfs attribute
Quoted 42 lines · Marek Vasut
Implement "
force_ro" sysfs attribute to allow users to set read-write devices as read-only and back to read-write from userspace. The choice of the name is based on MMC core 'force_ro' attribute.This solves a situation where an AT24 I2C EEPROM with GPIO based nWP signal may have to be occasionally updated. Such I2C EEPROM device is usually set as read-only during most of the regular system operation, but in case it has to be updated in a controlled manner, it could be unlocked using this new "
force_ro" sysfs attribute and then re-locked again.The "read-only" DT property and
config->read_onlyconfiguration is respected and is used to set default state of the device, read-only or read-write, for devices which do implement .reg_write function. For devices which do not implement .reg_write function, the device is unconditionally read-only and the "force_ro" attribute is not visible.Signed-off-by Marek Vasut <[email protected]>---
Cc: Alexandre Belloni <[email protected]>
Cc: Arnd Bergmann <[email protected]>
Cc: Bartosz Golaszewski <[email protected]>
Cc: Greg Kroah-Hartman <[email protected]>
Cc: Srinivas Kandagatla <[email protected]>
Cc: [email protected]
---
V2: - Document theforce_roattribute
- Usesysfs_emit()--- Documentation/ABI/stable/sysfs-bus-nvmem | 13 +++++++ drivers/nvmem/core.c | 44 ++++++++++++++++++++++++ drivers/nvmem/internals.h | 1 + 3 files changed, 58 insertions(+)Documentation/ABI/stable/sysfs-bus-nvmem +2
-0@@ -1,3 +1,16 @@ +What: /sys/bus/nvmem/devices/.../force_ro +Date: June 2024
Documentation/ABI/stable/sysfs-bus-nvmem line 12
Quoted 10 lines
Documentation/ABI/stable/sysfs-bus-nvmem +10
-0+KernelVersion: 6.11 +Contact: Marek Vasut <[email protected]> +Description: + This read/write attribute allows users to set read-write + devices as read-only and back to read-write from userspace. + This can be used to unlock and relock write-protection of + devices which are generally locked, except during sporadic + programming operation. + Note: This file is only present if CONFIG_NVMEM_SYSFS + is enabled
And what exactly are the values that can be read or written here?
thanks,
greg k-h
Re: [PATCH v2 4/4] nvmem: core: Implement force_ro sysfs attribute
Quoted 47 lines · Greg Kroah-Hartman
Quoted 46 lines · Marek Vasut
Implement "
force_ro" sysfs attribute to allow users to set read-write devices as read-only and back to read-write from userspace. The choice of the name is based on MMC core 'force_ro' attribute.This solves a situation where an AT24 I2C EEPROM with GPIO based nWP signal may have to be occasionally updated. Such I2C EEPROM device is usually set as read-only during most of the regular system operation, but in case it has to be updated in a controlled manner, it could be unlocked using this new "
force_ro" sysfs attribute and then re-locked again.The "read-only" DT property and
config->read_onlyconfiguration is respected and is used to set default state of the device, read-only or read-write, for devices which do implement .reg_write function. For devices which do not implement .reg_write function, the device is unconditionally read-only and the "force_ro" attribute is not visible.Signed-off-by Marek Vasut <[email protected]>---
Cc: Alexandre Belloni <[email protected]>
Cc: Arnd Bergmann <[email protected]>
Cc: Bartosz Golaszewski <[email protected]>
Cc: Greg Kroah-Hartman <[email protected]>
Cc: Srinivas Kandagatla <[email protected]>
Cc: [email protected]
---
V2: - Document theforce_roattribute
- Usesysfs_emit()--- Documentation/ABI/stable/sysfs-bus-nvmem | 13 +++++++ drivers/nvmem/core.c | 44 ++++++++++++++++++++++++ drivers/nvmem/internals.h | 1 + 3 files changed, 58 insertions(+)Documentation/ABI/stable/sysfs-bus-nvmem +6
-0@@ -1,3 +1,16 @@ +What: /sys/bus/nvmem/devices/.../force_ro +Date: June 2024 +KernelVersion: 6.11 +Contact: Marek Vasut <[email protected]> +Description: + This read/write attribute allows users to set read-write
Quoted 8 lines
Documentation/ABI/stable/sysfs-bus-nvmem line 12
Quoted 6 lines
Documentation/ABI/stable/sysfs-bus-nvmem +6
-0+ devices as read-only and back to read-write from userspace. + This can be used to unlock and relock write-protection of + devices which are generally locked, except during sporadic + programming operation. + Note: This file is only present if CONFIG_NVMEM_SYSFS + is enabledAnd what exactly are the values that can be read or written here?
I expanded it to this:
This read/write attribute allows users to set read-write devices as read-only and back to read-write from userspace. This can be used to unlock and relock write-protection of devices which are generally locked, except during sporadic programming operation.
+Read returns '0' or '1' for read-write or read-only modes +respectively.
+Write parses one of 'YyTt1NnFf0', or [oO][NnFf] for "on" +and "off", i.e. what kstrbool() supports.
Note: This file is only present if CONFIG_NVMEM_SYSFS is enabled.
But I wonder, wouldn't it be better if write only supported '0' and '1' too, instead of the whole list of stuff that kstrbool() supports ?