Thread (3 messages) 3 messages, 3 authors, 2023-08-31

Re: [PATCH -next] ptp: ptp_ines: Use list_for_each_entry() helper

From: Michal Swiatkowski <hidden>
Date: 2023-08-30 09:38:44

On Wed, Aug 30, 2023 at 05:08:16PM +0800, Jinjie Ruan wrote:
quoted hunk ↗ jump to hunk
Convert list_for_each() to list_for_each_entry() so that the this
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/ptp/ptp_ines.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/drivers/ptp/ptp_ines.c b/drivers/ptp/ptp_ines.c
index ed215b458183..c74f2dbbe3a2 100644
--- a/drivers/ptp/ptp_ines.c
+++ b/drivers/ptp/ptp_ines.c
@@ -237,11 +237,9 @@ static struct ines_port *ines_find_port(struct device_node *node, u32 index)
 {
 	struct ines_port *port = NULL;
 	struct ines_clock *clock;
-	struct list_head *this;
 
 	mutex_lock(&ines_clocks_lock);
-	list_for_each(this, &ines_clocks) {
-		clock = list_entry(this, struct ines_clock, list);
+	list_for_each_entry(clock, &ines_clocks, list) {
 		if (clock->node == node) {
 			port = &clock->port[index];
 			break;
-- 
2.34.1
Nice
Reviewed-by: Michal Swiatkowski <redacted>
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help