From: Wang Jiayue <akaieurus@gmail.com>
To: linux@armlinux.org.uk
Cc: linux-kernel@vger.kernel.org, Wang Jiayue <akaieurus@gmail.com>
Subject: [PATCH RESEND v2] amba: bus: Replace sprintf with sysfs_emit
Date: Wed, 4 Feb 2026 17:29:18 +0800 [thread overview]
Message-ID: <20260204092918.106538-1-akaieurus@gmail.com> (raw)
Use sysfs_emit() instead of sprintf() when writing to sysfs buffers, as
recommended by the kernel documentation.
Signed-off-by: Wang Jiayue <akaieurus@gmail.com>
---
v2:
* Correct the prefix and content in title.
---
drivers/amba/bus.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/amba/bus.c b/drivers/amba/bus.c
index 952c45ca6e48..59ae95d106ec 100644
--- a/drivers/amba/bus.c
+++ b/drivers/amba/bus.c
@@ -89,7 +89,7 @@ static ssize_t driver_override_show(struct device *_dev,
ssize_t len;
device_lock(_dev);
- len = sprintf(buf, "%s\n", dev->driver_override);
+ len = sysfs_emit(buf, "%s\n", dev->driver_override);
device_unlock(_dev);
return len;
}
@@ -114,7 +114,7 @@ static ssize_t name##_show(struct device *_dev, \
struct device_attribute *attr, char *buf) \
{ \
struct amba_device *dev = to_amba_device(_dev); \
- return sprintf(buf, fmt, arg); \
+ return sysfs_emit(buf, fmt, arg); \
} \
static DEVICE_ATTR_RO(name)
--
2.34.1
reply other threads:[~2026-02-04 9:29 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20260204092918.106538-1-akaieurus@gmail.com \
--to=akaieurus@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@armlinux.org.uk \
/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
all inboxes | Powered by JetHome®