Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp231642imm; Mon, 21 May 2018 05:17:18 -0700 (PDT) X-Google-Smtp-Source: AB8JxZr+a93MITo5x/D7msAnvckco4vTfldz5bR6VPk0MGkX/mdAdG4YijZN6wtaVHECMXVKppeT X-Received: by 2002:a17:902:6b04:: with SMTP id o4-v6mr20341951plk.101.1526905038364; Mon, 21 May 2018 05:17:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526905038; cv=none; d=google.com; s=arc-20160816; b=k12xAex2kM8bP09tAyhvZcoSq8sZ9F9eIT0D3kocoJB7EEj1O5yKu4hesJwcLekdL1 CIhsuJml6v6LW5iSYcH+2wS6q9CX/iKPnF8OdfQSNB3X3laduMJNIdQ+iNSQnR9KdnKN Bue6GNQi8a9UWk2nRi35j3cUoGH0YKHvqPthd0H5f4p6h1w27G/+6dPeL0pP/3pLdk/K BQEYwJrgZruoClIOAVa5+lh+D38w7aMi2Dhbw4DyWzfvfHrfc59XYoldtGoIeS/OhOq3 DFVjTdh3extB704ayx7i+xXpn7oNM7SJ2CGF4l9MjQXmFZVDeJ1pYqZGiJ+KjCUukEvg ZLGg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:arc-authentication-results; bh=+2CNyWMGIKWlh1BekNLxPGhLZ+b7RVE4lGugBmQzI6U=; b=UIkYUkXuh0WUnYB1N6b+1LpMB01Ww1f3ohjimeJFfaEeuD97V51nci3AKpw0AvZcGa jG+jlP10D38DKgFAPtzAlk6diOcyDLvO7Wgv+V4WKKE8xs4Jp3QWiHRTLPf0FuKd8z0V TB9cDvc8NsDzztiL3LttSol5vXbmKR2AYOf6oCbQ+b9yQbcrhx4j60YLBr/TQn7aE/Bx lkKuIWCUyyWKP9TwUlRdjJTzpgkYsbsfRs9ksxnKoJxX10P/4kc3w8Gxf10k7bixfw1i ff5YehjFDt4IVwQXLu/sMJMGjcpHzGbINq9ki5r0D0JHkU+galYnh2/+0a9G51EnR+Jm Kmlg== ARC-Authentication-Results: i=1; mx.google.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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b67-v6si14276123pfa.71.2018.05.21.05.17.04; Mon, 21 May 2018 05:17:18 -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; 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 S1752631AbeEUMOx (ORCPT + 99 others); Mon, 21 May 2018 08:14:53 -0400 Received: from szxga07-in.huawei.com ([45.249.212.35]:38706 "EHLO huawei.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1752644AbeEUMJF (ORCPT ); Mon, 21 May 2018 08:09:05 -0400 Received: from DGGEMS403-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id 33EC6F75C7297; Mon, 21 May 2018 20:09:01 +0800 (CST) Received: from linux-ibm.site (10.175.102.37) by DGGEMS403-HUB.china.huawei.com (10.3.19.203) with Microsoft SMTP Server id 14.3.382.0; Mon, 21 May 2018 20:08:54 +0800 From: Yisheng Xie To: CC: Yisheng Xie , Michael Turquette , Stephen Boyd , Heiko Stuebner , , , Subject: [PATCH 13/33] clk: rockchip: use match_string() helper Date: Mon, 21 May 2018 19:57:50 +0800 Message-ID: <1526903890-35761-14-git-send-email-xieyisheng1@huawei.com> X-Mailer: git-send-email 1.7.12.4 In-Reply-To: <1526903890-35761-1-git-send-email-xieyisheng1@huawei.com> References: <1526903890-35761-1-git-send-email-xieyisheng1@huawei.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.175.102.37] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org match_string() returns the index of an array for a matching string, which can be used intead of open coded variant. Cc: Michael Turquette Cc: Stephen Boyd Cc: Heiko Stuebner Cc: linux-clk@vger.kernel.org Cc: linux-arm-kernel@lists.infradead.org Cc: linux-rockchip@lists.infradead.org Signed-off-by: Yisheng Xie --- drivers/clk/rockchip/clk.c | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/drivers/clk/rockchip/clk.c b/drivers/clk/rockchip/clk.c index 3cd8ad5..514032d 100644 --- a/drivers/clk/rockchip/clk.c +++ b/drivers/clk/rockchip/clk.c @@ -274,18 +274,10 @@ static struct clk *rockchip_clk_register_frac_branch( struct clk_mux *frac_mux = &frac->mux; struct clk_init_data init; struct clk *mux_clk; - int i, ret; - - frac->mux_frac_idx = -1; - for (i = 0; i < child->num_parents; i++) { - if (!strcmp(name, child->parent_names[i])) { - pr_debug("%s: found fractional parent in mux at pos %d\n", - __func__, i); - frac->mux_frac_idx = i; - break; - } - } + int ret; + frac->mux_frac_idx = match_string(child->parent_names, + child->num_parents, name); frac->mux_ops = &clk_mux_ops; frac->clk_nb.notifier_call = rockchip_clk_frac_notifier_cb; @@ -312,6 +304,8 @@ static struct clk *rockchip_clk_register_frac_branch( /* notifier on the fraction divider to catch rate changes */ if (frac->mux_frac_idx >= 0) { + pr_debug("%s: find fractional parent in mux at pos %d\n", + __func__, frac->mux_frac_idx); ret = clk_notifier_register(clk, &frac->clk_nb); if (ret) pr_err("%s: failed to register clock notifier for %s\n", -- 1.7.12.4