From: Rujra Bhatt <braker.noob.kernel@gmail.com>
To: geert@linux-m68k.org
Cc: linux-m68k@lists.linux-m68k.org, linux-kernel@vger.kernel.org,
skhan@linuxfoundation.org, linux-kernel-mentees@lists.linux.dev
Subject: [PATCH] drivers:zorro:zorro-sysfs.c Replace sprintf() with sysfs_emit()
Date: Tue, 22 Jul 2025 09:09:08 +0530 [thread overview]
Message-ID: <aH8H3D0WRrqqZYc4@brak3rDesk> (raw)
Reply-To:
replace sprintf() with sysfs_emit() in sysfs
*_show() functions in zorro-sysfs.c to follow the kernel's guidelines
from Documentation/filesystems/sysfs.rst.
This improves consistency, safety, and makes the code easier to
maintain and update in the future.
Signed-off-by: Rujra Bhatt <braker.noob.kernel@gmail.com>
---
drivers/zorro/zorro-sysfs.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/zorro/zorro-sysfs.c b/drivers/zorro/zorro-sysfs.c
index 10aedcd21363..a552724b7fc7 100644
--- a/drivers/zorro/zorro-sysfs.c
+++ b/drivers/zorro/zorro-sysfs.c
@@ -29,7 +29,7 @@ static ssize_t name##_show(struct device *dev, \
struct zorro_dev *z; \
\
z = to_zorro_dev(dev); \
- return sprintf(buf, format_string, z->field); \
+ return sysfs_emit(buf, format_string, z->field); \
} \
static DEVICE_ATTR_RO(name);
@@ -44,7 +44,7 @@ static ssize_t serial_show(struct device *dev, struct device_attribute *attr,
struct zorro_dev *z;
z = to_zorro_dev(dev);
- return sprintf(buf, "0x%08x\n", be32_to_cpu(z->rom.er_SerialNumber));
+ return sysfs_emit(buf, "0x%08x\n", be32_to_cpu(z->rom.er_SerialNumber));
}
static DEVICE_ATTR_RO(serial);
@@ -53,7 +53,7 @@ static ssize_t resource_show(struct device *dev, struct device_attribute *attr,
{
struct zorro_dev *z = to_zorro_dev(dev);
- return sprintf(buf, "0x%08lx 0x%08lx 0x%08lx\n",
+ return sysfs_emit(buf, "0x%08lx 0x%08lx 0x%08lx\n",
(unsigned long)zorro_resource_start(z),
(unsigned long)zorro_resource_end(z),
zorro_resource_flags(z));
@@ -65,7 +65,7 @@ static ssize_t modalias_show(struct device *dev, struct device_attribute *attr,
{
struct zorro_dev *z = to_zorro_dev(dev);
- return sprintf(buf, ZORRO_DEVICE_MODALIAS_FMT "\n", z->id);
+ return sysfs_emit(buf, ZORRO_DEVICE_MODALIAS_FMT "\n", z->id);
}
static DEVICE_ATTR_RO(modalias);
--
2.43.0
next reply other threads:[~2025-07-22 3:39 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-22 3:39 Rujra Bhatt [this message]
2025-07-22 5:53 ` [PATCH] drivers:zorro:zorro-sysfs.c Replace sprintf() with sysfs_emit() Greg KH
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=aH8H3D0WRrqqZYc4@brak3rDesk \
--to=braker.noob.kernel@gmail.com \
--cc=geert@linux-m68k.org \
--cc=linux-kernel-mentees@lists.linux.dev \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-m68k@lists.linux-m68k.org \
--cc=skhan@linuxfoundation.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox