DORMANTno replies

[PATCH -next] HID: hid-mf: Use list_for_each_entry() helper

From: Jinjie Ruan <hidden>
Date: 2023-08-30 18:47:33
Subsystem: hid core layer, the rest · Maintainers: Jiri Kosina, Benjamin Tissoires, Linus Torvalds

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 <redacted>
---
 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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help