From: yexingchen116@gmail.com
To: axboe@kernel.dk
Cc: kch@nvidia.com, damien.lemoal@opensource.wdc.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: [PATCH linux-next] null_blk: use sysfs_emit() to instead of scnprintf()
Date: Fri, 21 Oct 2022 08:54:46 +0000 [thread overview]
Message-ID: <20221021085446.414696-1-ye.xingchen@zte.com.cn> (raw)
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>
---
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,
--
2.25.1
next reply other threads:[~2022-10-21 8:55 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-21 8:54 yexingchen116 [this message]
2022-10-21 9:44 ` Damien Le Moal
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=20221021085446.414696-1-ye.xingchen@zte.com.cn \
--to=yexingchen116@gmail.com \
--cc=axboe@kernel.dk \
--cc=bvanassche@acm.org \
--cc=damien.lemoal@opensource.wdc.com \
--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 \
/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
all inboxes | Powered by JetHome®