* [PATCH] ocxl: sysfs.c: Replace scnprintf() with sysfs_emit()
@ 2025-07-10 7:18 Ryan Chung
2025-07-10 7:23 ` Andrew Donnellan
0 siblings, 1 reply; 3+ messages in thread
From: Ryan Chung @ 2025-07-10 7:18 UTC (permalink / raw)
To: fbarrat, ajd, arnd, gregkh; +Cc: linuxppc-dev, linux-kernel, Ryan Chung
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.
Signed-off-by: Ryan Chung <seokwoo.chung130@gmail.com>
---
drivers/misc/ocxl/sysfs.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/drivers/misc/ocxl/sysfs.c b/drivers/misc/ocxl/sysfs.c
index e849641687a0..f194c159a778 100644
--- a/drivers/misc/ocxl/sysfs.c
+++ b/drivers/misc/ocxl/sysfs.c
@@ -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,
--
2.43.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] ocxl: sysfs.c: Replace scnprintf() with sysfs_emit()
2025-07-10 7:18 [PATCH] ocxl: sysfs.c: Replace scnprintf() with sysfs_emit() Ryan Chung
@ 2025-07-10 7:23 ` Andrew Donnellan
2025-07-10 8:35 ` Ryan Chung
0 siblings, 1 reply; 3+ messages in thread
From: Andrew Donnellan @ 2025-07-10 7:23 UTC (permalink / raw)
To: Ryan Chung, fbarrat, arnd, gregkh; +Cc: linuxppc-dev, linux-kernel
On Thu, 2025-07-10 at 16:18 +0900, Ryan Chung wrote:
> 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.
>
> Signed-off-by: Ryan Chung <seokwoo.chung130@gmail.com>
An identical patch has already been merged in char-misc-next:
https://patchwork.ozlabs.org/project/linuxppc-dev/patch/20250620024705.11321-1-ankitchauhan2065@gmail.com/
Andrew
--
Andrew Donnellan OzLabs, ADL Canberra
ajd@linux.ibm.com IBM Australia Limited
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] ocxl: sysfs.c: Replace scnprintf() with sysfs_emit()
2025-07-10 7:23 ` Andrew Donnellan
@ 2025-07-10 8:35 ` Ryan Chung
0 siblings, 0 replies; 3+ messages in thread
From: Ryan Chung @ 2025-07-10 8:35 UTC (permalink / raw)
To: Andrew Donnellan; +Cc: fbarrat, arnd, gregkh, linuxppc-dev, linux-kernel
On Thu, Jul 10, 2025 at 05:23:12PM +1000, Andrew Donnellan wrote:
> On Thu, 2025-07-10 at 16:18 +0900, Ryan Chung wrote:
> > 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.
> >
> > Signed-off-by: Ryan Chung <seokwoo.chung130@gmail.com>
>
> An identical patch has already been merged in char-misc-next:
>
> https://patchwork.ozlabs.org/project/linuxppc-dev/patch/20250620024705.11321-1-ankitchauhan2065@gmail.com/
>
>
> Andrew
>
> --
> Andrew Donnellan OzLabs, ADL Canberra
> ajd@linux.ibm.com IBM Australia Limited
Thank you. I did not see this.
Best,
Ryan
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-07-10 8:35 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-10 7:18 [PATCH] ocxl: sysfs.c: Replace scnprintf() with sysfs_emit() Ryan Chung
2025-07-10 7:23 ` Andrew Donnellan
2025-07-10 8:35 ` Ryan Chung
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).