From: Jinjie Ruan <ruanjinjie@huawei.com>
To: <linux-input@vger.kernel.org>, Jiri Kosina <jikos@kernel.org>,
Benjamin Tissoires <benjamin.tissoires@redhat.com>
Cc: <ruanjinjie@huawei.com>
Subject: [PATCH -next] HID: hid-mf: Use list_for_each_entry() helper
Date: Wed, 30 Aug 2023 17:01:08 +0800 [thread overview]
Message-ID: <20230830090108.528257-1-ruanjinjie@huawei.com> (raw)
Convert list_for_each() to list_for_each_entry() so that the report_ptr
list_head pointer and list_entry() call are no longer needed, which
can reduce a few lines of code. No functional changed.
Signed-off-by: Jinjie Ruan <ruanjinjie@huawei.com>
---
drivers/hid/hid-mf.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/drivers/hid/hid-mf.c b/drivers/hid/hid-mf.c
index 92d7ecd41a78..2d9a500cf364 100644
--- a/drivers/hid/hid-mf.c
+++ b/drivers/hid/hid-mf.c
@@ -61,7 +61,6 @@ static int mf_init(struct hid_device *hid)
struct list_head *report_list =
&hid->report_enum[HID_OUTPUT_REPORT].report_list;
- struct list_head *report_ptr;
struct hid_report *report;
struct list_head *input_ptr = &hid->inputs;
@@ -72,9 +71,7 @@ static int mf_init(struct hid_device *hid)
int error;
/* Setup each of the four inputs */
- list_for_each(report_ptr, report_list) {
- report = list_entry(report_ptr, struct hid_report, list);
-
+ list_for_each_entry(report, report_list, list) {
if (report->maxfield < 1 || report->field[0]->report_count < 2) {
hid_err(hid, "Invalid report, this should never happen!\n");
return -ENODEV;
--
2.34.1
reply other threads:[~2023-08-30 18:47 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20230830090108.528257-1-ruanjinjie@huawei.com \
--to=ruanjinjie@huawei.com \
--cc=benjamin.tissoires@redhat.com \
--cc=jikos@kernel.org \
--cc=linux-input@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox