The Linux Kernel Mailing List
 help / color / mirror / Atom feed
* [PATCH] w1: core: use sysfs_emit() instead of sprintf()
@ 2024-11-23  8:04 zhangheng
  0 siblings, 0 replies; 6+ messages in thread
From: zhangheng @ 2024-11-23  8:04 UTC (permalink / raw)
  To: krzk; +Cc: linux-kernel, zhangheng

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: zhangheng <zhangheng@kylinos.cn>
---
 drivers/w1/slaves/w1_ds28e17.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/w1/slaves/w1_ds28e17.c b/drivers/w1/slaves/w1_ds28e17.c
index 52261b54d842..34861ae3609b 100644
--- a/drivers/w1/slaves/w1_ds28e17.c
+++ b/drivers/w1/slaves/w1_ds28e17.c
@@ -583,7 +583,7 @@ static ssize_t speed_show(struct device *dev, struct device_attribute *attr,
 		return result;
 
 	/* Return current speed value. */
-	return sprintf(buf, "%d\n", result);
+	sysfs_emit(buf, "%d\n", result);
 }
 
 static ssize_t speed_store(struct device *dev, struct device_attribute *attr,
@@ -633,7 +633,7 @@ static ssize_t stretch_show(struct device *dev, struct device_attribute *attr,
 	struct w1_f19_data *data = sl->family_data;
 
 	/* Return current stretch value. */
-	return sprintf(buf, "%d\n", data->stretch);
+	sysfs_emit(buf, "%d\n", data->stretch);
 }
 
 static ssize_t stretch_store(struct device *dev, struct device_attribute *attr,
-- 
2.45.2


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

* [PATCH] w1: core: use sysfs_emit() instead of sprintf()
@ 2024-11-23 10:23 zhangheng
  2024-11-23 15:55 ` Krzysztof Kozlowski
  0 siblings, 1 reply; 6+ messages in thread
From: zhangheng @ 2024-11-23 10:23 UTC (permalink / raw)
  To: krzk; +Cc: linux-kernel, zhangheng

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: zhangheng <zhangheng@kylinos.cn>
---
 drivers/w1/slaves/w1_ds28e17.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/w1/slaves/w1_ds28e17.c b/drivers/w1/slaves/w1_ds28e17.c
index 52261b54d842..5738cbce1a37 100644
--- a/drivers/w1/slaves/w1_ds28e17.c
+++ b/drivers/w1/slaves/w1_ds28e17.c
@@ -583,7 +583,7 @@ static ssize_t speed_show(struct device *dev, struct device_attribute *attr,
 		return result;
 
 	/* Return current speed value. */
-	return sprintf(buf, "%d\n", result);
+	return sysfs_emit(buf, "%d\n", result);
 }
 
 static ssize_t speed_store(struct device *dev, struct device_attribute *attr,
@@ -633,7 +633,7 @@ static ssize_t stretch_show(struct device *dev, struct device_attribute *attr,
 	struct w1_f19_data *data = sl->family_data;
 
 	/* Return current stretch value. */
-	return sprintf(buf, "%d\n", data->stretch);
+	return sysfs_emit(buf, "%d\n", data->stretch);
 }
 
 static ssize_t stretch_store(struct device *dev, struct device_attribute *attr,
-- 
2.45.2


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

* Re: [PATCH] w1: core: use sysfs_emit() instead of sprintf()
  2024-11-23 10:23 [PATCH] w1: core: use sysfs_emit() instead of sprintf() zhangheng
@ 2024-11-23 15:55 ` Krzysztof Kozlowski
  0 siblings, 0 replies; 6+ messages in thread
From: Krzysztof Kozlowski @ 2024-11-23 15:55 UTC (permalink / raw)
  To: zhangheng; +Cc: linux-kernel

On 23/11/2024 11:23, zhangheng wrote:
> 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: zhangheng <zhangheng@kylinos.cn>


I received multiple same emails from you, which is confusing. Version
properly your patches - use b4 or git format-patch -vversion - and add
changelog under ---. Please send v2 with changelog so tools can properly
parse it.
Best regards,
Krzysztof

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

* [PATCH] w1: core: use sysfs_emit() instead of sprintf()
@ 2024-12-20 10:23 zhangheng
  2024-12-22 12:23 ` Krzysztof Kozlowski
  2024-12-22 14:47 ` Krzysztof Kozlowski
  0 siblings, 2 replies; 6+ messages in thread
From: zhangheng @ 2024-12-20 10:23 UTC (permalink / raw)
  To: krzk; +Cc: linux-kernel, zhangheng

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: zhangheng <zhangheng@kylinos.cn>
---
change for v2
	- None
 drivers/w1/slaves/w1_ds28e17.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/w1/slaves/w1_ds28e17.c b/drivers/w1/slaves/w1_ds28e17.c
index 52261b54d842..5738cbce1a37 100644
--- a/drivers/w1/slaves/w1_ds28e17.c
+++ b/drivers/w1/slaves/w1_ds28e17.c
@@ -583,7 +583,7 @@ static ssize_t speed_show(struct device *dev, struct device_attribute *attr,
 		return result;
 
 	/* Return current speed value. */
-	return sprintf(buf, "%d\n", result);
+	return sysfs_emit(buf, "%d\n", result);
 }
 
 static ssize_t speed_store(struct device *dev, struct device_attribute *attr,
@@ -633,7 +633,7 @@ static ssize_t stretch_show(struct device *dev, struct device_attribute *attr,
 	struct w1_f19_data *data = sl->family_data;
 
 	/* Return current stretch value. */
-	return sprintf(buf, "%d\n", data->stretch);
+	return sysfs_emit(buf, "%d\n", data->stretch);
 }
 
 static ssize_t stretch_store(struct device *dev, struct device_attribute *attr,
-- 
2.45.2


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

* Re: [PATCH] w1: core: use sysfs_emit() instead of sprintf()
  2024-12-20 10:23 zhangheng
@ 2024-12-22 12:23 ` Krzysztof Kozlowski
  2024-12-22 14:47 ` Krzysztof Kozlowski
  1 sibling, 0 replies; 6+ messages in thread
From: Krzysztof Kozlowski @ 2024-12-22 12:23 UTC (permalink / raw)
  To: zhangheng; +Cc: linux-kernel

On 20/12/2024 11:23, zhangheng wrote:
> 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: zhangheng <zhangheng@kylinos.cn>
> ---
> change for v2
> 	- None

`git format-patch -v2` or use b4 in the future.

No need to resend, I'll apply it.



Best regards,
Krzysztof

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

* Re: [PATCH] w1: core: use sysfs_emit() instead of sprintf()
  2024-12-20 10:23 zhangheng
  2024-12-22 12:23 ` Krzysztof Kozlowski
@ 2024-12-22 14:47 ` Krzysztof Kozlowski
  1 sibling, 0 replies; 6+ messages in thread
From: Krzysztof Kozlowski @ 2024-12-22 14:47 UTC (permalink / raw)
  To: krzk, zhangheng; +Cc: linux-kernel


On Fri, 20 Dec 2024 18:23:37 +0800, zhangheng wrote:
> 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.
> 
> 

Applied, thanks!

[1/1] w1: core: use sysfs_emit() instead of sprintf()
      https://git.kernel.org/krzk/linux-w1/c/419a40cc2bdda0eadd643de55b70f212354761a2

Best regards,
-- 
Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>


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

end of thread, other threads:[~2024-12-22 14:47 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-11-23 10:23 [PATCH] w1: core: use sysfs_emit() instead of sprintf() zhangheng
2024-11-23 15:55 ` Krzysztof Kozlowski
  -- strict thread matches above, loose matches on Subject: below --
2024-12-20 10:23 zhangheng
2024-12-22 12:23 ` Krzysztof Kozlowski
2024-12-22 14:47 ` Krzysztof Kozlowski
2024-11-23  8:04 zhangheng

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