From patchwork Tue Jul 19 09:21:36 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 72280 Delivered-To: patch@linaro.org Received: by 10.140.29.52 with SMTP id a49csp570090qga; Tue, 19 Jul 2016 02:20:37 -0700 (PDT) X-Received: by 10.66.74.133 with SMTP id t5mr10869131pav.114.1468920032758; Tue, 19 Jul 2016 02:20:32 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x76si8510825pfd.200.2016.07.19.02.20.32; Tue, 19 Jul 2016 02:20:32 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@nifty.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753349AbcGSJUZ (ORCPT + 29 others); Tue, 19 Jul 2016 05:20:25 -0400 Received: from conuserg-09.nifty.com ([210.131.2.76]:51260 "EHLO conuserg-09.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753099AbcGSJUR (ORCPT ); Tue, 19 Jul 2016 05:20:17 -0400 Received: from beagle.diag.org (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-09.nifty.com with ESMTP id u6J9JqMg000550; Tue, 19 Jul 2016 18:19:54 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-09.nifty.com u6J9JqMg000550 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1468919995; bh=jpH3TXWUChiWYHe/YAH9/+pbz5Mjvdc2AtJf8GCgKpU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=N1bBK0BCw9ws7sByuIymVVDU4JI2Xkw6WdsyeOihtpYc2hg5sra94mfRMYInPjxlC dC73X+gGciFXGtaLB3Oc5dKOx/9ZDOKNu5v07kGfdAG+bibyd+5+bxrJjjJGIgJgIh BqgA/UuYfOxcjQetuUUVXkh1Z0Bah/Rf7RcjgsvuX7ZQUeuhqdJdyfpEHc88looB/f L6eKTYBTJa/V9h9kRm8loD52N/V0o+lPvd/rnBDjjRCWXHhTIFyeaaNJrh5VLUQPTd Frg7ErO05vylc6sKikbhiPec/y3jllaZdpfnrzR0au0zrfkaYc5OHtJhscLk2U9A+t VxUBD2+/RHdpA== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: linux-clk@vger.kernel.org Cc: Masahiro Yamada , Stephen Boyd , Michael Turquette , linux-kernel@vger.kernel.org Subject: [PATCH 3/5] clk: refactor of_clk_del_provider() Date: Tue, 19 Jul 2016 18:21:36 +0900 Message-Id: <1468920098-8553-4-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1468920098-8553-1-git-send-email-yamada.masahiro@socionext.com> References: <1468920098-8553-1-git-send-email-yamada.masahiro@socionext.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- drivers/clk/clk.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) -- 1.9.1 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); }