netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jinjie Ruan <ruanjinjie@huawei.com>
To: <netdev@vger.kernel.org>, Richard Cochran <richardcochran@gmail.com>
Cc: <ruanjinjie@huawei.com>
Subject: [PATCH -next] ptp: ptp_ines: Use list_for_each_entry() helper
Date: Wed, 30 Aug 2023 17:08:16 +0800	[thread overview]
Message-ID: <20230830090816.529438-1-ruanjinjie@huawei.com> (raw)

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 <ruanjinjie@huawei.com>
---
 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


             reply	other threads:[~2023-08-30  9:08 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-30  9:08 Jinjie Ruan [this message]
2023-08-30  9:38 ` [PATCH -next] ptp: ptp_ines: Use list_for_each_entry() helper Michal Swiatkowski
2023-08-31  1:29 ` Jakub Kicinski

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=20230830090816.529438-1-ruanjinjie@huawei.com \
    --to=ruanjinjie@huawei.com \
    --cc=netdev@vger.kernel.org \
    --cc=richardcochran@gmail.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;
as well as URLs for NNTP newsgroup(s).