* [PATCH net-next] s390/qeth: use sysfs_emit() to instead of scnprintf()
@ 2022-12-05 3:52 ye.xingchen
2022-12-05 11:38 ` Alexandra Winter
0 siblings, 1 reply; 3+ messages in thread
From: ye.xingchen @ 2022-12-05 3:52 UTC (permalink / raw)
To: wintera
Cc: wenjia, hca, gor, agordeev, borntraeger, svens, linux-s390,
netdev, linux-kernel
From: ye xingchen <ye.xingchen@zte.com.cn>
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: ye xingchen <ye.xingchen@zte.com.cn>
---
drivers/s390/net/qeth_l3_sys.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/s390/net/qeth_l3_sys.c b/drivers/s390/net/qeth_l3_sys.c
index 1082380b21f8..65eea667e469 100644
--- a/drivers/s390/net/qeth_l3_sys.c
+++ b/drivers/s390/net/qeth_l3_sys.c
@@ -395,7 +395,7 @@ static ssize_t qeth_l3_dev_ipato_add_show(char *buf, struct qeth_card *card,
}
mutex_unlock(&card->ip_lock);
- return str_len ? str_len : scnprintf(buf, PAGE_SIZE, "\n");
+ return str_len ? str_len : sysfs_emit(buf, "\n");
}
static ssize_t qeth_l3_dev_ipato_add4_show(struct device *dev,
@@ -614,7 +614,7 @@ static ssize_t qeth_l3_dev_ip_add_show(struct device *dev, char *buf,
}
mutex_unlock(&card->ip_lock);
- return str_len ? str_len : scnprintf(buf, PAGE_SIZE, "\n");
+ return str_len ? str_len : sysfs_emit(buf, "\n");
}
static ssize_t qeth_l3_dev_vipa_add4_show(struct device *dev,
--
2.25.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH net-next] s390/qeth: use sysfs_emit() to instead of scnprintf()
2022-12-05 3:52 [PATCH net-next] s390/qeth: use sysfs_emit() to instead of scnprintf() ye.xingchen
@ 2022-12-05 11:38 ` Alexandra Winter
2022-12-05 11:50 ` Alexander Gordeev
0 siblings, 1 reply; 3+ messages in thread
From: Alexandra Winter @ 2022-12-05 11:38 UTC (permalink / raw)
To: ye.xingchen
Cc: wenjia, hca, gor, agordeev, borntraeger, svens, linux-s390,
netdev, linux-kernel
On 05.12.22 04:52, ye.xingchen@zte.com.cn wrote:
> From: ye xingchen <ye.xingchen@zte.com.cn>
>
> 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: ye xingchen <ye.xingchen@zte.com.cn>
> ---
> drivers/s390/net/qeth_l3_sys.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/s390/net/qeth_l3_sys.c b/drivers/s390/net/qeth_l3_sys.c
> index 1082380b21f8..65eea667e469 100644
> --- a/drivers/s390/net/qeth_l3_sys.c
> +++ b/drivers/s390/net/qeth_l3_sys.c
> @@ -395,7 +395,7 @@ static ssize_t qeth_l3_dev_ipato_add_show(char *buf, struct qeth_card *card,
> }
> mutex_unlock(&card->ip_lock);
>
> - return str_len ? str_len : scnprintf(buf, PAGE_SIZE, "\n");
> + return str_len ? str_len : sysfs_emit(buf, "\n");
> }
>
> static ssize_t qeth_l3_dev_ipato_add4_show(struct device *dev,
> @@ -614,7 +614,7 @@ static ssize_t qeth_l3_dev_ip_add_show(struct device *dev, char *buf,
> }
> mutex_unlock(&card->ip_lock);
>
> - return str_len ? str_len : scnprintf(buf, PAGE_SIZE, "\n");
> + return str_len ? str_len : sysfs_emit(buf, "\n");
> }
>
> static ssize_t qeth_l3_dev_vipa_add4_show(struct device *dev,
There are more instances of scnprintf in s390/net that can be replaced by sysfs_emit.
We are already working on that.
But thanks for improving those two.
Reviewed-by: Alexandra Winter <wintera@linux.ibm.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH net-next] s390/qeth: use sysfs_emit() to instead of scnprintf()
2022-12-05 11:38 ` Alexandra Winter
@ 2022-12-05 11:50 ` Alexander Gordeev
0 siblings, 0 replies; 3+ messages in thread
From: Alexander Gordeev @ 2022-12-05 11:50 UTC (permalink / raw)
To: Alexandra Winter
Cc: ye.xingchen, wenjia, hca, gor, borntraeger, svens, linux-s390,
netdev, linux-kernel
On Mon, Dec 05, 2022 at 12:38:59PM +0100, Alexandra Winter wrote:
>
>
> On 05.12.22 04:52, ye.xingchen@zte.com.cn wrote:
> > From: ye xingchen <ye.xingchen@zte.com.cn>
> >
> > 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: ye xingchen <ye.xingchen@zte.com.cn>
> > ---
> > drivers/s390/net/qeth_l3_sys.c | 4 ++--
> > 1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/s390/net/qeth_l3_sys.c b/drivers/s390/net/qeth_l3_sys.c
> > index 1082380b21f8..65eea667e469 100644
> > --- a/drivers/s390/net/qeth_l3_sys.c
> > +++ b/drivers/s390/net/qeth_l3_sys.c
> > @@ -395,7 +395,7 @@ static ssize_t qeth_l3_dev_ipato_add_show(char *buf, struct qeth_card *card,
> > }
> > mutex_unlock(&card->ip_lock);
> >
> > - return str_len ? str_len : scnprintf(buf, PAGE_SIZE, "\n");
> > + return str_len ? str_len : sysfs_emit(buf, "\n");
> > }
> >
> > static ssize_t qeth_l3_dev_ipato_add4_show(struct device *dev,
> > @@ -614,7 +614,7 @@ static ssize_t qeth_l3_dev_ip_add_show(struct device *dev, char *buf,
> > }
> > mutex_unlock(&card->ip_lock);
> >
> > - return str_len ? str_len : scnprintf(buf, PAGE_SIZE, "\n");
> > + return str_len ? str_len : sysfs_emit(buf, "\n");
> > }
> >
> > static ssize_t qeth_l3_dev_vipa_add4_show(struct device *dev,
> There are more instances of scnprintf in s390/net that can be replaced by sysfs_emit.
> We are already working on that.
It seems this particular fix misses scnprintf() to sysfs_emit()
conversion within same very functions just few lines above.
> But thanks for improving those two.
> Reviewed-by: Alexandra Winter <wintera@linux.ibm.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-12-05 11:50 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-12-05 3:52 [PATCH net-next] s390/qeth: use sysfs_emit() to instead of scnprintf() ye.xingchen
2022-12-05 11:38 ` Alexandra Winter
2022-12-05 11:50 ` Alexander Gordeev
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).