public inbox for linux-kernel-mentees@lists.linux-foundation.org
 help / color / mirror / Atom feed
From: Marcelo Moreira <marcelomoreira1905@gmail.com>
To: Yazen Ghannam <yazen.ghannam@amd.com>,
	skhan@linuxfoundation.org,
	linux-kernel-mentees@lists.linuxfoundation.org,
	~lkcamp/patches@lists.sr.ht
Cc: Borislav Petkov <bp@alien8.de>, Tony Luck <tony.luck@intel.com>,
	James Morse <james.morse@arm.com>,
	linux-edac@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH] EDAC/amd64: replace sprintf with sysfs_emit in show functions
Date: Sun, 29 Jun 2025 15:24:48 -0300	[thread overview]
Message-ID: <20250629182448.265407-1-marcelomoreira1905@gmail.com> (raw)

Update all device attribute 'show' callbacks in the EDAC AMD64 driver to
utilize sysfs_emit(). This change adheres to the recommendation outlined
in Documentation/filesystems/sysfs.rst.

This modification aligns with current sysfs subsystem guidelines.

Signed-off-by: Marcelo Moreira <marcelomoreira1905@gmail.com>
---
 drivers/edac/amd64_edac.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/edac/amd64_edac.c b/drivers/edac/amd64_edac.c
index b681c0663203..b6d211255ef0 100644
--- a/drivers/edac/amd64_edac.c
+++ b/drivers/edac/amd64_edac.c
@@ -552,7 +552,7 @@ static ssize_t reg##_show(struct device *dev,				\
 	struct mem_ctl_info *mci = to_mci(dev);				\
 	struct amd64_pvt *pvt = mci->pvt_info;				\
 									\
-	return sprintf(data, "0x%016llx\n", (u64)pvt->reg);		\
+	return  sysfs_emit(data, "0x%016llx\n", (u64)pvt->reg);		\
 }
 
 EDAC_DCT_ATTR_SHOW(dhar);
@@ -571,7 +571,7 @@ static ssize_t dram_hole_show(struct device *dev, struct device_attribute *mattr
 
 	get_dram_hole_info(mci, &hole_base, &hole_offset, &hole_size);
 
-	return sprintf(data, "%llx %llx %llx\n", hole_base, hole_offset,
+	return sysfs_emit(data, "%llx %llx %llx\n", hole_base, hole_offset,
 						 hole_size);
 }
 
@@ -602,7 +602,7 @@ static ssize_t inject_section_show(struct device *dev,
 {
 	struct mem_ctl_info *mci = to_mci(dev);
 	struct amd64_pvt *pvt = mci->pvt_info;
-	return sprintf(buf, "0x%x\n", pvt->injection.section);
+	return sysfs_emit(buf, "0x%x\n", pvt->injection.section);
 }
 
 /*
@@ -638,7 +638,7 @@ static ssize_t inject_word_show(struct device *dev,
 {
 	struct mem_ctl_info *mci = to_mci(dev);
 	struct amd64_pvt *pvt = mci->pvt_info;
-	return sprintf(buf, "0x%x\n", pvt->injection.word);
+	return sysfs_emit(buf, "0x%x\n", pvt->injection.word);
 }
 
 /*
@@ -675,7 +675,7 @@ static ssize_t inject_ecc_vector_show(struct device *dev,
 {
 	struct mem_ctl_info *mci = to_mci(dev);
 	struct amd64_pvt *pvt = mci->pvt_info;
-	return sprintf(buf, "0x%x\n", pvt->injection.bit_map);
+	return sysfs_emit(buf, "0x%x\n", pvt->injection.bit_map);
 }
 
 /*
-- 
2.50.0


             reply	other threads:[~2025-06-29 18:25 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-29 18:24 Marcelo Moreira [this message]
2025-06-30  5:06 ` [PATCH] EDAC/amd64: replace sprintf with sysfs_emit in show functions Greg KH
2025-07-01  0:03   ` Marcelo Moreira

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=20250629182448.265407-1-marcelomoreira1905@gmail.com \
    --to=marcelomoreira1905@gmail.com \
    --cc=bp@alien8.de \
    --cc=james.morse@arm.com \
    --cc=linux-edac@vger.kernel.org \
    --cc=linux-kernel-mentees@lists.linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=skhan@linuxfoundation.org \
    --cc=tony.luck@intel.com \
    --cc=yazen.ghannam@amd.com \
    --cc=~lkcamp/patches@lists.sr.ht \
    /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