From: Damien Le Moal <damien.lemoal@opensource.wdc.com>
To: yexingchen116@gmail.com, axboe@kernel.dk
Cc: kch@nvidia.com, johannes.thumshirn@wdc.com, bvanassche@acm.org,
ming.lei@redhat.com, vincent.fu@samsung.com,
shinichiro.kawasaki@wdc.com, linux-block@vger.kernel.org,
linux-kernel@vger.kernel.org,
ye xingchen <ye.xingchen@zte.com.cn>
Subject: Re: [PATCH linux-next] null_blk: use sysfs_emit() to instead of scnprintf()
Date: Fri, 21 Oct 2022 18:44:40 +0900 [thread overview]
Message-ID: <e62600da-4a1c-f797-8fdb-2938ca58f25e@opensource.wdc.com> (raw)
In-Reply-To: <20221021085446.414696-1-ye.xingchen@zte.com.cn>
On 10/21/22 17:54, yexingchen116@gmail.com wrote:
> From: ye xingchen <ye.xingchen@zte.com.cn>
>
> Replace the open-code with sysfs_emit() to simplify the code.
>
> Signed-off-by: ye xingchen <ye.xingchen@zte.com.cn>
Reviewed-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
> ---
> drivers/block/null_blk/main.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/block/null_blk/main.c b/drivers/block/null_blk/main.c
> index 1f154f92f4c2..5317ef2ba227 100644
> --- a/drivers/block/null_blk/main.c
> +++ b/drivers/block/null_blk/main.c
> @@ -255,18 +255,18 @@ static inline struct nullb_device *to_nullb_device(struct config_item *item)
>
> static inline ssize_t nullb_device_uint_attr_show(unsigned int val, char *page)
> {
> - return snprintf(page, PAGE_SIZE, "%u\n", val);
> + return sysfs_emit(page, "%u\n", val);
> }
>
> static inline ssize_t nullb_device_ulong_attr_show(unsigned long val,
> char *page)
> {
> - return snprintf(page, PAGE_SIZE, "%lu\n", val);
> + return sysfs_emit(page, "%lu\n", val);
> }
>
> static inline ssize_t nullb_device_bool_attr_show(bool val, char *page)
> {
> - return snprintf(page, PAGE_SIZE, "%u\n", val);
> + return sysfs_emit(page, "%u\n", val);
> }
>
> static ssize_t nullb_device_uint_attr_store(unsigned int *val,
--
Damien Le Moal
Western Digital Research
prev parent reply other threads:[~2022-10-21 9:45 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-21 8:54 [PATCH linux-next] null_blk: use sysfs_emit() to instead of scnprintf() yexingchen116
2022-10-21 9:44 ` Damien Le Moal [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=e62600da-4a1c-f797-8fdb-2938ca58f25e@opensource.wdc.com \
--to=damien.lemoal@opensource.wdc.com \
--cc=axboe@kernel.dk \
--cc=bvanassche@acm.org \
--cc=johannes.thumshirn@wdc.com \
--cc=kch@nvidia.com \
--cc=linux-block@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=ming.lei@redhat.com \
--cc=shinichiro.kawasaki@wdc.com \
--cc=vincent.fu@samsung.com \
--cc=ye.xingchen@zte.com.cn \
--cc=yexingchen116@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).