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: 9236565 X-Patchwork-Delegate: sboyd@codeaurora.org Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 7B0B46075D for ; Tue, 19 Jul 2016 09:21:09 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6B53A205AF for ; Tue, 19 Jul 2016 09:21:09 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6034E20072; Tue, 19 Jul 2016 09:21:09 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 01F2020072 for ; Tue, 19 Jul 2016 09:21:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752524AbcGSJUT (ORCPT ); Tue, 19 Jul 2016 05:20:19 -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-clk-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-clk@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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(-) 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); }