All of lore.kernel.org
 help / color / mirror / Atom feed
From: Masahiro Yamada <yamada.masahiro@socionext.com>
To: linux-clk@vger.kernel.org
Cc: Masahiro Yamada <yamada.masahiro@socionext.com>,
	Stephen Boyd <sboyd@codeaurora.org>,
	Michael Turquette <mturquette@baylibre.com>,
	linux-kernel@vger.kernel.org
Subject: [PATCH 3/5] clk: refactor of_clk_del_provider()
Date: Tue, 19 Jul 2016 18:21:36 +0900	[thread overview]
Message-ID: <1468920098-8553-4-git-send-email-yamada.masahiro@socionext.com> (raw)
In-Reply-To: <1468920098-8553-1-git-send-email-yamada.masahiro@socionext.com>

Now, it is guaranteed that a single node does not appear twice in
the list of OF clock providers.  So, of_clk_del_provider() only
needs to free the first occurrence.  This can be implemented more
simply with __of_clk_find_provider().

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
---

 drivers/clk/clk.c | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
index 7832343..60daf60 100644
--- a/drivers/clk/clk.c
+++ b/drivers/clk/clk.c
@@ -3121,13 +3121,11 @@ void of_clk_del_provider(struct device_node *np)
 	struct of_clk_provider *cp;
 
 	mutex_lock(&of_clk_mutex);
-	list_for_each_entry(cp, &of_clk_providers, link) {
-		if (cp->node == np) {
-			list_del(&cp->link);
-			of_node_put(cp->node);
-			kfree(cp);
-			break;
-		}
+	cp = __of_clk_find_provider(np);
+	if (cp) {
+		list_del(&cp->link);
+		of_node_put(cp->node);
+		kfree(cp);
 	}
 	mutex_unlock(&of_clk_mutex);
 }
-- 
1.9.1

  parent reply	other threads:[~2016-07-19  9:20 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-19  9:21 [PATCH 0/5] clk: forbit multiple adding of clock providers and fix false positive EPROBE_DEFER Masahiro Yamada
2016-07-19  9:21 ` [PATCH 1/5] clk: add a helper function __of_clk_find_provider() Masahiro Yamada
2016-07-19  9:21 ` [PATCH 2/5] clk: avoid adding clock provider multiple times for one node Masahiro Yamada
2016-07-19  9:21 ` Masahiro Yamada [this message]
2016-07-19  9:21 ` [PATCH 4/5] clk: fix false positive EPROBE_DEFER of __of_clk_get_hw_from_provider() Masahiro Yamada
2016-07-19  9:21 ` [PATCH 5/5] clk: return -EINVAL if clock provider has no .get callback Masahiro Yamada

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=1468920098-8553-4-git-send-email-yamada.masahiro@socionext.com \
    --to=yamada.masahiro@socionext.com \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mturquette@baylibre.com \
    --cc=sboyd@codeaurora.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.