From: hanyu001@208suo.com
To: jikos@kernel.org, benjamin.tissoires@redhat.com
Cc: linux-input@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Fwd: [PATCH] hid: replace snprintf in show functions with sysfs_emit
Date: Thu, 13 Jul 2023 16:23:19 +0800 [thread overview]
Message-ID: <77492ea91d843d729a0e9194f01ad367@208suo.com> (raw)
In-Reply-To: <tencent_97B2F127A27CDAB5DAB0733C81936AC6CA07@qq.com>
Fix the coccicheck warning:
WARNING: use scnprintf or sprintf.
./drivers/hid/hid-lenovo.c:786:8-16: WARNING: use scnprintf or sprintf
./drivers/hid/hid-lenovo.c:540:8-16: WARNING: use scnprintf or sprintf
./drivers/hid/hid-lenovo.c:905:8-16: WARNING: use scnprintf or sprintf
./drivers/hid/hid-lenovo.c:756:8-16: WARNING: use scnprintf or sprintf
./drivers/hid/hid-lenovo.c:816:8-16: WARNING: use scnprintf or sprintf
./drivers/hid/hid-lenovo.c:846:8-16: WARNING: use scnprintf or sprintf
./drivers/hid/hid-lenovo.c:584:8-16: WARNING: use scnprintf or sprintf
./drivers/hid/hid-lenovo.c:876:8-16: WARNING: use scnprintf or sprintf
Signed-off-by: ztt <1549089851@qq.com>
---
drivers/hid/hid-lenovo.c | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/drivers/hid/hid-lenovo.c b/drivers/hid/hid-lenovo.c
index 44763c0da444..147fcf69d235 100644
--- a/drivers/hid/hid-lenovo.c
+++ b/drivers/hid/hid-lenovo.c
@@ -537,7 +537,7 @@ static ssize_t attr_fn_lock_show(struct device *dev,
struct hid_device *hdev = to_hid_device(dev);
struct lenovo_drvdata *data = hid_get_drvdata(hdev);
- return snprintf(buf, PAGE_SIZE, "%u\n", data->fn_lock);
+ return scnprintf(buf, PAGE_SIZE, "%u\n", data->fn_lock);
}
static ssize_t attr_fn_lock_store(struct device *dev,
@@ -581,7 +581,7 @@ static ssize_t attr_sensitivity_show_cptkbd(struct
device *dev,
struct hid_device *hdev = to_hid_device(dev);
struct lenovo_drvdata *cptkbd_data = hid_get_drvdata(hdev);
- return snprintf(buf, PAGE_SIZE, "%u\n",
+ return scnprintf(buf, PAGE_SIZE, "%u\n",
cptkbd_data->sensitivity);
}
@@ -753,7 +753,7 @@ static ssize_t
attr_press_to_select_show_tpkbd(struct device *dev,
struct hid_device *hdev = to_hid_device(dev);
struct lenovo_drvdata *data_pointer = hid_get_drvdata(hdev);
- return snprintf(buf, PAGE_SIZE, "%u\n",
data_pointer->press_to_select);
+ return scnprintf(buf, PAGE_SIZE, "%u\n",
data_pointer->press_to_select);
}
static ssize_t attr_press_to_select_store_tpkbd(struct device *dev,
@@ -783,7 +783,7 @@ static ssize_t attr_dragging_show_tpkbd(struct
device *dev,
struct hid_device *hdev = to_hid_device(dev);
struct lenovo_drvdata *data_pointer = hid_get_drvdata(hdev);
- return snprintf(buf, PAGE_SIZE, "%u\n", data_pointer->dragging);
+ return scnprintf(buf, PAGE_SIZE, "%u\n", data_pointer->dragging);
}
static ssize_t attr_dragging_store_tpkbd(struct device *dev,
@@ -813,7 +813,7 @@ static ssize_t
attr_release_to_select_show_tpkbd(struct device *dev,
struct hid_device *hdev = to_hid_device(dev);
struct lenovo_drvdata *data_pointer = hid_get_drvdata(hdev);
- return snprintf(buf, PAGE_SIZE, "%u\n",
data_pointer->release_to_select);
+ return scnprintf(buf, PAGE_SIZE, "%u\n",
data_pointer->release_to_select);
}
static ssize_t attr_release_to_select_store_tpkbd(struct device *dev,
@@ -843,7 +843,7 @@ static ssize_t attr_select_right_show_tpkbd(struct
device *dev,
struct hid_device *hdev = to_hid_device(dev);
struct lenovo_drvdata *data_pointer = hid_get_drvdata(hdev);
- return snprintf(buf, PAGE_SIZE, "%u\n",
data_pointer->select_right);
+ return scnprintf(buf, PAGE_SIZE, "%u\n",
data_pointer->select_right);
}
static ssize_t attr_select_right_store_tpkbd(struct device *dev,
@@ -873,7 +873,7 @@ static ssize_t attr_sensitivity_show_tpkbd(struct
device *dev,
struct hid_device *hdev = to_hid_device(dev);
struct lenovo_drvdata *data_pointer = hid_get_drvdata(hdev);
- return snprintf(buf, PAGE_SIZE, "%u\n",
+ return scnprintf(buf, PAGE_SIZE, "%u\n",
data_pointer->sensitivity);
}
@@ -902,7 +902,7 @@ static ssize_t attr_press_speed_show_tpkbd(struct
device *dev,
struct hid_device *hdev = to_hid_device(dev);
struct lenovo_drvdata *data_pointer = hid_get_drvdata(hdev);
- return snprintf(buf, PAGE_SIZE, "%u\n",
+ return scnprintf(buf, PAGE_SIZE, "%u\n",
data_pointer->press_speed);
}
parent reply other threads:[~2023-07-13 8:32 UTC|newest]
Thread overview: expand[flat|nested] mbox.gz Atom feed
[parent not found: <tencent_97B2F127A27CDAB5DAB0733C81936AC6CA07@qq.com>]
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=77492ea91d843d729a0e9194f01ad367@208suo.com \
--to=hanyu001@208suo.com \
--cc=benjamin.tissoires@redhat.com \
--cc=jikos@kernel.org \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.