From patchwork Mon May 21 11:57:50 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xie Yisheng X-Patchwork-Id: 10414997 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 08DAC6032C for ; Mon, 21 May 2018 12:11:10 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EBB7728860 for ; Mon, 21 May 2018 12:11:09 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E088828864; Mon, 21 May 2018 12:11: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=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 6287228861 for ; Mon, 21 May 2018 12:11:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=7RJBlclt39144+gIh0xNzboUiOlg7o7TCWi06rQvuwk=; b=doM6KDFAONvp43 cVeazrG8M6NbDjwE5elO9jwpcdxWqqF2mh0NJ0/ia5TRIuLG2vh1XdRHbfz0s4bIv0QUZQKN5C1Y8 2Vm3lvBaldP5tk/xkhoxQlxwQ6jufAJeFLTPvj9oNeU6mfjq8jnp6AsFRhwfkUa65qECacNC4nqRI AcIj6MzFAsoGUNQqdOMYplTARzkhRVrGTPv134KwXgcLP8pbmY5IWmLeXFRqHIvSiRLKotlML+uE2 bzgCNCI4FlAoM5V0HNY1JeBu3hgqka/lO4oxsC7CgjVVdX5KVJR5+oy1CFZMWwrh08FqUFP+igboU 2s/T+gpxi3SxQhsT416Q==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1fKjea-0001nP-IR; Mon, 21 May 2018 12:11:04 +0000 Received: from merlin.infradead.org ([2001:8b0:10b:1231::1]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fKjd1-0008Ii-Lb; Mon, 21 May 2018 12:09:27 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=Content-Type:MIME-Version:References: In-Reply-To:Message-ID:Date:Subject:CC:To:From:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=+2CNyWMGIKWlh1BekNLxPGhLZ+b7RVE4lGugBmQzI6U=; b=nshZURxBtvXrGzX+KT0XekxZK pnRK1jNw0YHoPcsJGHLP7YJCPDuoCDjoBQtiJkU/y+BROfqYji8c/0/D4Lf7ka8QtKAaPe+LU0HZ7 5TjeDhb+eE/ZEy7DzeH31fjaxsvVFvDWVkjQLBh5LddF9yg/2HCyT7NZ6y9tMg0o3p39n64XxZaNP a1RETczBObqPtezSr5h77kAr763NQhQO8cHRxjpjy6QT9fCe0zh4RcV302FiGzqGSPeJPkwamMaH3 T2VqfDc0cnBtnG3MSo0mHS26wGaWUyi/lMGn4pLG2aDDFEV5ZUwp4HsjRaT4YDFDVmlOwc2Uro1Z8 Wb/wKi2Sg==; Received: from [45.249.212.35] (helo=huawei.com) by merlin.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fKjcy-00041u-L5; Mon, 21 May 2018 12:09:25 +0000 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: 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 X-Originating-IP: [10.175.102.37] X-CFilter-Loop: Reflected X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180521_080925_035691_CBADCE0F X-CRM114-Status: GOOD ( 11.90 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Yisheng Xie , Heiko Stuebner , Stephen Boyd , Michael Turquette , linux-rockchip@lists.infradead.org, linux-clk@vger.kernel.org, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP 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",