public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH linux-next] genirq: use sysfs_emit()/sysfs_emit_at() instead of scnprintf().
@ 2025-03-17  6:54 xie.ludan
  2025-03-17  7:14 ` Jiri Slaby
  0 siblings, 1 reply; 4+ messages in thread
From: xie.ludan @ 2025-03-17  6:54 UTC (permalink / raw)
  To: tglx; +Cc: linux-kernel, xu.xin16, yang.yang29


[-- Attachment #1.1.1: Type: text/plain, Size: 2052 bytes --]

From: XieLudan <xie.ludan@zte.com.cn>

Follow the advice in Documentation/filesystems/sysfs.rst: show() should
only use sysfs_emit() or sysfs_emit_at() when formatting the value to be
returned to user space.

Signed-off-by: XieLudan <xie.ludan@zte.com.cn>
---
 kernel/irq/irqdesc.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/kernel/irq/irqdesc.c b/kernel/irq/irqdesc.c
index 287830739783..8d1f4ecfe880 100644
--- a/kernel/irq/irqdesc.c
+++ b/kernel/irq/irqdesc.c
@@ -257,11 +257,11 @@ static ssize_t per_cpu_count_show(struct kobject *kobj,
 	for_each_possible_cpu(cpu) {
 		unsigned int c = irq_desc_kstat_cpu(desc, cpu);
 
-		ret += scnprintf(buf + ret, PAGE_SIZE - ret, "%s%u", p, c);
+		ret += sysfs_emit_at(buf, ret, "%s%u", p, c);
 		p = ",";
 	}
 
-	ret += scnprintf(buf + ret, PAGE_SIZE - ret, "\n");
+	ret += sysfs_emit_at(buf, ret, "\n");
 	return ret;
 }
 IRQ_ATTR_RO(per_cpu_count);
@@ -274,7 +274,7 @@ static ssize_t chip_name_show(struct kobject *kobj,
 
 	raw_spin_lock_irq(&desc->lock);
 	if (desc->irq_data.chip && desc->irq_data.chip->name) {
-		ret = scnprintf(buf, PAGE_SIZE, "%s\n",
+		ret = sysfs_emit(buf, "%s\n",
 				desc->irq_data.chip->name);
 	}
 	raw_spin_unlock_irq(&desc->lock);
@@ -337,7 +337,7 @@ static ssize_t name_show(struct kobject *kobj,
 
 	raw_spin_lock_irq(&desc->lock);
 	if (desc->name)
-		ret = scnprintf(buf, PAGE_SIZE, "%s\n", desc->name);
+		ret = sysfs_emit(buf, "%s\n", desc->name);
 	raw_spin_unlock_irq(&desc->lock);
 
 	return ret;
@@ -354,14 +354,14 @@ static ssize_t actions_show(struct kobject *kobj,
 
 	raw_spin_lock_irq(&desc->lock);
 	for_each_action_of_desc(desc, action) {
-		ret += scnprintf(buf + ret, PAGE_SIZE - ret, "%s%s",
+		ret += sysfs_emit_at(buf, ret, "%s%s",
 				 p, action->name);
 		p = ",";
 	}
 	raw_spin_unlock_irq(&desc->lock);
 
 	if (ret)
-		ret += scnprintf(buf + ret, PAGE_SIZE - ret, "\n");
+		ret += sysfs_emit_at(buf, ret, "\n");
 
 	return ret;
 }
-- 
2.25.1

[-- Attachment #1.1.2: Type: text/html , Size: 3969 bytes --]

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH linux-next] genirq: use sysfs_emit()/sysfs_emit_at() instead of scnprintf().
  2025-03-17  6:54 [PATCH linux-next] genirq: use sysfs_emit()/sysfs_emit_at() instead of scnprintf() xie.ludan
@ 2025-03-17  7:14 ` Jiri Slaby
  2025-03-17  8:22   ` xie.ludan
  0 siblings, 1 reply; 4+ messages in thread
From: Jiri Slaby @ 2025-03-17  7:14 UTC (permalink / raw)
  To: xie.ludan, tglx; +Cc: linux-kernel, xu.xin16, yang.yang29

Are you a bot?

On 17. 03. 25, 7:54, xie.ludan@zte.com.cn wrote:
> From: XieLudan <xie.ludan@zte.com.cn>
> 
> 
> Follow the advice in Documentation/filesystems/sysfs.rst: show() should
> 
> only use sysfs_emit() or sysfs_emit_at() when formatting the value to be
> 
> returned to user space.


-- 
js
suse labs


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH linux-next] genirq: use sysfs_emit()/sysfs_emit_at() instead of scnprintf().
  2025-03-17  7:14 ` Jiri Slaby
@ 2025-03-17  8:22   ` xie.ludan
  2025-03-17  8:48     ` Krzysztof Kozlowski
  0 siblings, 1 reply; 4+ messages in thread
From: xie.ludan @ 2025-03-17  8:22 UTC (permalink / raw)
  To: jirislaby; +Cc: tglx, linux-kernel, xu.xin16, yang.yang29


[-- Attachment #1.1.1: Type: text/plain, Size: 1263 bytes --]

> Are you a bot?

> On 17. 03. 25, 7:54, xie.ludan@zte.com.cn wrote:> From: XieLudan <xie.ludan@zte.com.cn>
> > 
> > 
> > Follow the advice in Documentation/filesystems/sysfs.rst: show() should
> > 
> > only use sysfs_emit() or sysfs_emit_at() when formatting the value to be
> > 
> > returned to user space.

I'm sorry if I make any mistakes. I'm just starting to learn how to submit patches to the community and I'm still learning the proper submission process. 
I would greatly appreciate your patience and guidance during this learning phase. Thank you for your understanding!

Best Regards
Xie Ludan



Original


From: jirislaby <jirislaby@kernel.org>
To: Xie Ludan00297061;tglx <tglx@linutronix.de>;
Cc: linux-kernel <linux-kernel@vger.kernel.org>;Xu Xin10311587;Yang Yang10192021;
Date: 2025/03/17 15:15
Subject: Re: [PATCH linux-next] genirq: use sysfs_emit()/sysfs_emit_at() instead of scnprintf().

Are you a bot?
 
On 17. 03. 25, 7:54, xie.ludan@zte.com.cn wrote:
> From: XieLudan <xie.ludan@zte.com.cn> 
>  
>  
> Follow the advice in Documentation/filesystems/sysfs.rst: show() should
>  
> only use sysfs_emit() or sysfs_emit_at() when formatting the value to be
>  
> returned to user space.
 
 
--  
js
suse labs

[-- Attachment #1.1.2: Type: text/html , Size: 3417 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH linux-next] genirq: use sysfs_emit()/sysfs_emit_at() instead of scnprintf().
  2025-03-17  8:22   ` xie.ludan
@ 2025-03-17  8:48     ` Krzysztof Kozlowski
  0 siblings, 0 replies; 4+ messages in thread
From: Krzysztof Kozlowski @ 2025-03-17  8:48 UTC (permalink / raw)
  To: xie.ludan, jirislaby
  Cc: tglx, linux-kernel, xu.xin16, yang.yang29, feng.wei8, xie.ludan,
	shao.mingyin, xie.ludan, tang.dongxing

On 17/03/2025 09:22, xie.ludan@zte.com.cn wrote:
>> Are you a bot?
> 
>> On 17. 03. 25, 7:54, xie.ludan@zte.com.cn wrote:> From: XieLudan <xie.ludan@zte.com.cn>
>>>
>>>
>>> Follow the advice in Documentation/filesystems/sysfs.rst: show() should
>>>
>>> only use sysfs_emit() or sysfs_emit_at() when formatting the value to be
>>>
>>> returned to user space.
> 
> I'm sorry if I make any mistakes. I'm just starting to learn how to submit patches to the community and I'm still learning the proper submission process. 
> I would greatly appreciate your patience and guidance during this learning phase. Thank you for your understanding!


So you decided to learn by sending 60 patches last two/three days?
Several of these contributions received feedback already but you never
responded to that.

If you want to learn, then send one patch and learn from it.

Sending 60 patches and making the same mistakes, like not even building
the code, means huge review effort on the community side.

Best regards,
Krzysztof

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2025-03-17  8:48 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-03-17  6:54 [PATCH linux-next] genirq: use sysfs_emit()/sysfs_emit_at() instead of scnprintf() xie.ludan
2025-03-17  7:14 ` Jiri Slaby
2025-03-17  8:22   ` xie.ludan
2025-03-17  8:48     ` Krzysztof Kozlowski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox