netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] s390/qeth: convert sysfs snprintf to sysfs_emit
@ 2022-12-27 11:03 Xuezhi Zhang
  0 siblings, 0 replies; 5+ messages in thread
From: Xuezhi Zhang @ 2022-12-27 11:03 UTC (permalink / raw)
  To: zhangxuezhi1, wintera, gor, agordeev, borntraeger, svens
  Cc: linux-s390, netdev, linux-kernel

From: Xuezhi Zhang <zhangxuezhi1@coolpad.com>

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

Signed-off-by: Xuezhi Zhang <zhangxuezhi1@coolpad.com>
---
 drivers/s390/net/qeth_core_sys.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/s390/net/qeth_core_sys.c b/drivers/s390/net/qeth_core_sys.c
index 406be169173c..d1adc4b83193 100644
--- a/drivers/s390/net/qeth_core_sys.c
+++ b/drivers/s390/net/qeth_core_sys.c
@@ -410,13 +410,13 @@ static ssize_t qeth_dev_isolation_show(struct device *dev,
 
 	switch (card->options.isolation) {
 	case ISOLATION_MODE_NONE:
-		return snprintf(buf, 6, "%s\n", ATTR_QETH_ISOLATION_NONE);
+		return sysfs_emit(buf, "%s\n", ATTR_QETH_ISOLATION_NONE);
 	case ISOLATION_MODE_FWD:
-		return snprintf(buf, 9, "%s\n", ATTR_QETH_ISOLATION_FWD);
+		return sysfs_emit(buf, "%s\n", ATTR_QETH_ISOLATION_FWD);
 	case ISOLATION_MODE_DROP:
-		return snprintf(buf, 6, "%s\n", ATTR_QETH_ISOLATION_DROP);
+		return sysfs_emit(buf, "%s\n", ATTR_QETH_ISOLATION_DROP);
 	default:
-		return snprintf(buf, 5, "%s\n", "N/A");
+		return sysfs_emit(buf, "%s\n", "N/A");
 	}
 }
 
@@ -500,9 +500,9 @@ static ssize_t qeth_hw_trap_show(struct device *dev,
 	struct qeth_card *card = dev_get_drvdata(dev);
 
 	if (card->info.hwtrap)
-		return snprintf(buf, 5, "arm\n");
+		return sysfs_emit(buf, "arm\n");
 	else
-		return snprintf(buf, 8, "disarm\n");
+		return sysfs_emit(buf, "disarm\n");
 }
 
 static ssize_t qeth_hw_trap_store(struct device *dev,
-- 
2.25.1


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

* [PATCH] s390/qeth: convert sysfs snprintf to sysfs_emit
@ 2022-12-27 11:03 Xuezhi Zhang
  2022-12-28 12:20 ` patchwork-bot+netdevbpf
  0 siblings, 1 reply; 5+ messages in thread
From: Xuezhi Zhang @ 2022-12-27 11:03 UTC (permalink / raw)
  To: zhangxuezhi1, wintera, gor, agordeev, borntraeger, svens
  Cc: linux-s390, netdev, linux-kernel

From: Xuezhi Zhang <zhangxuezhi1@coolpad.com>

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

Signed-off-by: Xuezhi Zhang <zhangxuezhi1@coolpad.com>
---
 drivers/s390/net/qeth_core_sys.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/s390/net/qeth_core_sys.c b/drivers/s390/net/qeth_core_sys.c
index 406be169173c..d1adc4b83193 100644
--- a/drivers/s390/net/qeth_core_sys.c
+++ b/drivers/s390/net/qeth_core_sys.c
@@ -410,13 +410,13 @@ static ssize_t qeth_dev_isolation_show(struct device *dev,
 
 	switch (card->options.isolation) {
 	case ISOLATION_MODE_NONE:
-		return snprintf(buf, 6, "%s\n", ATTR_QETH_ISOLATION_NONE);
+		return sysfs_emit(buf, "%s\n", ATTR_QETH_ISOLATION_NONE);
 	case ISOLATION_MODE_FWD:
-		return snprintf(buf, 9, "%s\n", ATTR_QETH_ISOLATION_FWD);
+		return sysfs_emit(buf, "%s\n", ATTR_QETH_ISOLATION_FWD);
 	case ISOLATION_MODE_DROP:
-		return snprintf(buf, 6, "%s\n", ATTR_QETH_ISOLATION_DROP);
+		return sysfs_emit(buf, "%s\n", ATTR_QETH_ISOLATION_DROP);
 	default:
-		return snprintf(buf, 5, "%s\n", "N/A");
+		return sysfs_emit(buf, "%s\n", "N/A");
 	}
 }
 
@@ -500,9 +500,9 @@ static ssize_t qeth_hw_trap_show(struct device *dev,
 	struct qeth_card *card = dev_get_drvdata(dev);
 
 	if (card->info.hwtrap)
-		return snprintf(buf, 5, "arm\n");
+		return sysfs_emit(buf, "arm\n");
 	else
-		return snprintf(buf, 8, "disarm\n");
+		return sysfs_emit(buf, "disarm\n");
 }
 
 static ssize_t qeth_hw_trap_store(struct device *dev,
-- 
2.25.1


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

* Re: [PATCH] s390/qeth: convert sysfs snprintf to sysfs_emit
  2022-12-27 11:03 Xuezhi Zhang
@ 2022-12-28 12:20 ` patchwork-bot+netdevbpf
  2023-01-05 12:02   ` Simon Horman
  0 siblings, 1 reply; 5+ messages in thread
From: patchwork-bot+netdevbpf @ 2022-12-28 12:20 UTC (permalink / raw)
  To: Xuezhi Zhang
  Cc: zhangxuezhi1, wintera, gor, agordeev, borntraeger, svens,
	linux-s390, netdev, linux-kernel

Hello:

This patch was applied to netdev/net.git (master)
by David S. Miller <davem@davemloft.net>:

On Tue, 27 Dec 2022 19:03:52 +0800 you wrote:
> From: Xuezhi Zhang <zhangxuezhi1@coolpad.com>
> 
> Follow the advice of the Documentation/filesystems/sysfs.rst
> and show() should only use sysfs_emit() or sysfs_emit_at()
> when formatting the value to be returned to user space.
> 
> Signed-off-by: Xuezhi Zhang <zhangxuezhi1@coolpad.com>
> 
> [...]

Here is the summary with links:
  - s390/qeth: convert sysfs snprintf to sysfs_emit
    https://git.kernel.org/netdev/net/c/c2052189f19b

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



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

* Re: [PATCH] s390/qeth: convert sysfs snprintf to sysfs_emit
  2022-12-28 12:20 ` patchwork-bot+netdevbpf
@ 2023-01-05 12:02   ` Simon Horman
  2023-01-05 12:17     ` Alexandra Winter
  0 siblings, 1 reply; 5+ messages in thread
From: Simon Horman @ 2023-01-05 12:02 UTC (permalink / raw)
  To: patchwork-bot+netdevbpf
  Cc: Xuezhi Zhang, zhangxuezhi1, wintera, gor, agordeev, borntraeger,
	svens, linux-s390, netdev, linux-kernel

On Wed, Dec 28, 2022 at 12:20:15PM +0000, patchwork-bot+netdevbpf@kernel.org wrote:
> Hello:
> 
> This patch was applied to netdev/net.git (master)
> by David S. Miller <davem@davemloft.net>:
> 
> On Tue, 27 Dec 2022 19:03:52 +0800 you wrote:
> > From: Xuezhi Zhang <zhangxuezhi1@coolpad.com>
> > 
> > Follow the advice of the Documentation/filesystems/sysfs.rst
> > and show() should only use sysfs_emit() or sysfs_emit_at()
> > when formatting the value to be returned to user space.
> > 
> > Signed-off-by: Xuezhi Zhang <zhangxuezhi1@coolpad.com>
> > 
> > [...]
> 
> Here is the summary with links:
>   - s390/qeth: convert sysfs snprintf to sysfs_emit
>     https://git.kernel.org/netdev/net/c/c2052189f19b

I'm a little late to the party here, but should the use of sprintf() in
show functions elsewhere in the qeth_core_sys.c also be updated?


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

* Re: [PATCH] s390/qeth: convert sysfs snprintf to sysfs_emit
  2023-01-05 12:02   ` Simon Horman
@ 2023-01-05 12:17     ` Alexandra Winter
  0 siblings, 0 replies; 5+ messages in thread
From: Alexandra Winter @ 2023-01-05 12:17 UTC (permalink / raw)
  To: Simon Horman, patchwork-bot+netdevbpf
  Cc: Xuezhi Zhang, zhangxuezhi1, gor, agordeev, borntraeger, svens,
	linux-s390, netdev, linux-kernel



On 05.01.23 13:02, Simon Horman wrote:
> On Wed, Dec 28, 2022 at 12:20:15PM +0000, patchwork-bot+netdevbpf@kernel.org wrote:
>> Hello:
>>
>> This patch was applied to netdev/net.git (master)
>> by David S. Miller <davem@davemloft.net>:
>>
>> On Tue, 27 Dec 2022 19:03:52 +0800 you wrote:
>>> From: Xuezhi Zhang <zhangxuezhi1@coolpad.com>
>>>
>>> Follow the advice of the Documentation/filesystems/sysfs.rst
>>> and show() should only use sysfs_emit() or sysfs_emit_at()
>>> when formatting the value to be returned to user space.
>>>
>>> Signed-off-by: Xuezhi Zhang <zhangxuezhi1@coolpad.com>
>>>
>>> [...]
>>
>> Here is the summary with links:
>>   - s390/qeth: convert sysfs snprintf to sysfs_emit
>>     https://git.kernel.org/netdev/net/c/c2052189f19b
> 
> I'm a little late to the party here, but should the use of sprintf() in
> show functions elsewhere in the qeth_core_sys.c also be updated?
> 

Yes, we are working on this. Several patches will come soon, that cleanup whole files.
No need to send additional small patches on this topic at the moment.

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

end of thread, other threads:[~2023-01-05 12:18 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-12-27 11:03 [PATCH] s390/qeth: convert sysfs snprintf to sysfs_emit Xuezhi Zhang
  -- strict thread matches above, loose matches on Subject: below --
2022-12-27 11:03 Xuezhi Zhang
2022-12-28 12:20 ` patchwork-bot+netdevbpf
2023-01-05 12:02   ` Simon Horman
2023-01-05 12:17     ` Alexandra Winter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).