* [PATCH] memstick/mspro_block: use sysfs_emit() to instead of scnprintf()
@ 2022-12-01 11:50 ye.xingchen
2022-12-07 10:35 ` Ulf Hansson
0 siblings, 1 reply; 2+ messages in thread
From: ye.xingchen @ 2022-12-01 11:50 UTC (permalink / raw)
To: ulf.hansson; +Cc: maximlevitsky, oakad, axboe, hare, linux-mmc, 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/memstick/core/mspro_block.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/memstick/core/mspro_block.c b/drivers/memstick/core/mspro_block.c
index 61cf75d4a01e..ae3a5dc00344 100644
--- a/drivers/memstick/core/mspro_block.c
+++ b/drivers/memstick/core/mspro_block.c
@@ -356,7 +356,7 @@ static ssize_t mspro_block_attr_show_modelname(struct device *dev,
struct mspro_sys_attr,
dev_attr);
- return scnprintf(buffer, PAGE_SIZE, "%s", (char *)s_attr->data);
+ return sysfs_emit(buffer, "%s\n", (char *)s_attr->data);
}
static ssize_t mspro_block_attr_show_mbr(struct device *dev,
--
2.25.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] memstick/mspro_block: use sysfs_emit() to instead of scnprintf()
2022-12-01 11:50 [PATCH] memstick/mspro_block: use sysfs_emit() to instead of scnprintf() ye.xingchen
@ 2022-12-07 10:35 ` Ulf Hansson
0 siblings, 0 replies; 2+ messages in thread
From: Ulf Hansson @ 2022-12-07 10:35 UTC (permalink / raw)
To: ye.xingchen; +Cc: maximlevitsky, oakad, axboe, hare, linux-mmc, linux-kernel
On Thu, 1 Dec 2022 at 12:50, <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.
There are plenty of other conversions that can be done using
sysfs_emit_at() in drivers/memstick/core/mspro_block.c. Would you mind
doing that too, as part of the $subject patch?
Kind regards
Uffe
>
> Signed-off-by: ye xingchen <ye.xingchen@zte.com.cn>
> ---
> drivers/memstick/core/mspro_block.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/memstick/core/mspro_block.c b/drivers/memstick/core/mspro_block.c
> index 61cf75d4a01e..ae3a5dc00344 100644
> --- a/drivers/memstick/core/mspro_block.c
> +++ b/drivers/memstick/core/mspro_block.c
> @@ -356,7 +356,7 @@ static ssize_t mspro_block_attr_show_modelname(struct device *dev,
> struct mspro_sys_attr,
> dev_attr);
>
> - return scnprintf(buffer, PAGE_SIZE, "%s", (char *)s_attr->data);
> + return sysfs_emit(buffer, "%s\n", (char *)s_attr->data);
> }
>
> static ssize_t mspro_block_attr_show_mbr(struct device *dev,
> --
> 2.25.1
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-12-07 10:37 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-01 11:50 [PATCH] memstick/mspro_block: use sysfs_emit() to instead of scnprintf() ye.xingchen
2022-12-07 10:35 ` Ulf Hansson
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).