From: 王擎 <wangqing@vivo.com>
To: "Bruno Prémont" <bonbons@linux-vserver.org>
Cc: Jiri Kosina <jikos@kernel.org>,
Benjamin Tissoires <benjamin.tissoires@redhat.com>,
Stefan Achatz <erazor_de@users.sourceforge.net>,
Jonathan Cameron <jic23@kernel.org>,
Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>,
"linux-input@vger.kernel.org" <linux-input@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"linux-iio@vger.kernel.org" <linux-iio@vger.kernel.org>
Subject: 回复: [PATCH] hid: replace snprintf in show functions with sysfs_emit
Date: Fri, 15 Oct 2021 10:12:42 +0000 [thread overview]
Message-ID: <SL2PR06MB308276FBCF5F54C435E85F53BDB99@SL2PR06MB3082.apcprd06.prod.outlook.com> (raw)
In-Reply-To: <AMgA7gCyEvPU77AozESAHarT.9.1634285608120.Hmail.wangqing@vivo.com>
>> show() must not use snprintf() when formatting the value to be
>> returned to user space.
>>
>> Fix the coccicheck warnings:
>> WARNING: use scnprintf or sprintf.
>>
>> Use sysfs_emit instead of scnprintf or sprintf makes more sense.
>
>Looks good to me, but I have a few remarks:
>
>- No need to talk about "must not use" in detailled commit message.
> Mentioning introduction of the newish sysfs_emit() functions (in
> commit 2efc459d06f1630001e3984854848a5647086232 a Year ago) and thus
> switching over to those would be sufficient for code predating their
> introduction.
>
>- I'm wondering why picolcd_fb_update_rate_show() in
> drivers/hid/hid-picolcd_fb.c:446
> is not updated as well in this same patch.
> There scnprintf() calls should be replaced with sysfs_emit_at() calls
> according to the intent of this patch!
scnprintf is fine, but snprintf is WRONG used.
scnprintf() return the number of bytes printed into the buffer.
snprintf() returns the length the resulting string.
>
>- Not sure if the patch should be split into a 5-patch series with one
> patch per HID driver (each driver can be updated independently).
>
I will do this in V2.
Thanks,
Qing
>
>Acked-by: Bruno Prémont <bonbons@linux-vserver.org>
> (for picolcd code)
prev parent reply other threads:[~2021-10-15 10:12 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-15 6:48 Qing Wang
2021-10-15 8:13 ` Bruno Prémont
[not found] ` <AMgA7gCyEvPU77AozESAHarT.9.1634285608120.Hmail.wangqing@vivo.com>
2021-10-15 10:12 ` 王擎 [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=SL2PR06MB308276FBCF5F54C435E85F53BDB99@SL2PR06MB3082.apcprd06.prod.outlook.com \
--to=wangqing@vivo.com \
--cc=benjamin.tissoires@redhat.com \
--cc=bonbons@linux-vserver.org \
--cc=erazor_de@users.sourceforge.net \
--cc=jic23@kernel.org \
--cc=jikos@kernel.org \
--cc=linux-iio@vger.kernel.org \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=srinivas.pandruvada@linux.intel.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
all inboxes | Powered by JetHome®