ocxl: sysfs.c: Replace scnprintf() with sysfs_emit()
Subsystems (2)
PATCH 1/1 ocxl: sysfs.c: Replace scnprintf() with sysfs_emit()
This change uses sysfs_emit() API usage for sysfs 'show' functions as recommended from Documentation/filesystems/sysfs.rst. Intended for safety and consistency.
No functional change intended.
--- drivers/misc/ocxl/sysfs.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/misc/ocxl/sysfs.c +6 -6
@@ -16,7 +16,7 @@ static ssize_t global_mmio_size_show(struct device *device, {struct ocxl_afu *afu =to_afu (device); -return scnprintf (buf,PAGE_SIZE ,"%d\n" , +return sysfs_emit (buf,"%d\n" , afu->config.global_mmio_size); }
@@ -26,7 +26,7 @@ static ssize_t pp_mmio_size_show(struct device *device, {struct ocxl_afu *afu =to_afu (device); -return scnprintf (buf,PAGE_SIZE ,"%d\n" , +return sysfs_emit (buf,"%d\n" , afu->config.pp_mmio_stride); }
@@ -36,7 +36,7 @@ static ssize_t afu_version_show(struct device *device, {struct ocxl_afu *afu =to_afu (device); -return scnprintf (buf,PAGE_SIZE ,"%hhu:%hhu\n" , +return sysfs_emit (buf,"%hhu:%hhu\n" , afu->config.version_major, afu->config.version_minor); }
@@ -47,7 +47,7 @@ static ssize_t contexts_show(struct device *device, {struct ocxl_afu *afu =to_afu (device); -return scnprintf (buf,PAGE_SIZE ,"%d/%d\n" , +return sysfs_emit (buf,"%d/%d\n" , afu->pasid_count, afu->pasid_max); }
@@ -61,9 +61,9 @@ static ssize_t reload_on_reset_show(struct device *device,int val;if (ocxl_config_get_reset_reload (pci_dev, &val)) -return scnprintf (buf,PAGE_SIZE ,"unavailable\n" ); +return sysfs_emit (buf,"unavailable\n" ); -return scnprintf (buf,PAGE_SIZE ,"%d\n" , val); +return sysfs_emit (buf,"%d\n" , val); } static ssize_t reload_on_reset_store(struct device *device,
Signature · 1 line
2.43.0
Quoted 7 lines · Ryan Chung
This change uses
sysfs_emit()API usage for sysfs 'show' functions as recommended fromDocumentation/filesystems/sysfs.rst. Intended for safety and consistency.No functional change intended.
Signed-off-by Ryan Chung <[email protected]>
An identical patch has already been merged in char-misc-next:
https://patchwork.ozlabs.org/project/linuxppc-dev/patch/[email protected]/
Andrew
Signature · 2 lines
Andrew Donnellan OzLabs, ADL Canberra [email protected] IBM Australia Limited
Quoted 7 lines · Andrew Donnellan
Quoted 6 lines · Ryan Chung
This change uses
sysfs_emit()API usage for sysfs 'show' functions as recommended fromDocumentation/filesystems/sysfs.rst. Intended for safety and consistency.No functional change intended.
Quoted 12 lines
Quoted 1 line
Signed-off-by Ryan Chung <[email protected]>An identical patch has already been merged in char-misc-next:
https://patchwork.ozlabs.org/project/linuxppc-dev/patch/[email protected]/
Andrew
Signature · 2 lines
Andrew Donnellan OzLabs, ADL Canberra [email protected] IBM Australia Limited
Thank you. I did not see this.
Best,
Ryan