Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp494638imm; Thu, 31 May 2018 04:27:49 -0700 (PDT) X-Google-Smtp-Source: ADUXVKL35vGJ+h4YwQ2DzP1GSyEfrvAIK/seFiH2yvMvhMQCoFWCInGzr1qJj0gAKxhWoR62l+Wf X-Received: by 2002:a17:902:ac97:: with SMTP id h23-v6mr6613455plr.140.1527766069027; Thu, 31 May 2018 04:27:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527766068; cv=none; d=google.com; s=arc-20160816; b=plzbU6DxAxQMEPm9OIFXf5dNS3mQ7CDE2h4XpWyHLz7UXbOF1OL8xNR4N98zw0SQvh bwmjRHzKGSW9sJ4a1qN/71pXECzyr3hs/1yngfugnA7TwmNBBOCq80IuLoqL5tpWig4z Y0rdX2uvqMBGz2ZhCjjBDW/q4DlKzKd+VHsqTBuUfbyv8XX+NTTi0Ooli1h9IcsXwC/w roBI32yMZgLTOiFkcX05mDCiZewfx6zrx1PktBz/syYobdMPWjZg+BK/e67X2nqh9MwI K+SW1IJMNE+IIq1RbZfb+aI+ohuZebXErMnWIJGS+kTvkFYU+NKy+fPZIMKJneCDrc6W yFqQ== 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=NXJWsbUCEVyO5Gqw210DMrlKctVw7jebJ7xKm6SYtuE=; b=cc/KCxCfU8TlrA2VQWZEzl+H8N/9csvqUDB6cc1s6QHBYIyvlyjYmW4BitM6vA1Usi wg7iryjq4f7KfmCl8S45DBcnqLQ1Fb+XTarhbqwvd5GFYFJBH/0hM8REqSeSsaI0rkuU uO06fMtoYwVIhfLYO0FeE/gM1RL1m0wJisxBSmXi8Iia/W0iitXqcs3gdKIg5nrvyXmq bDmx7EJjO2yGU0vENVVCkkzFHQ+aCTzCV5kAY0ILmiZnBgxgm6ncF3xdI8K4lRNhGJc8 P3/P3pPdtYRsmSkgp3KmLB1wWVoaNAb+vhHU3j4c7JWvdDSYFvx9AUixk6Lq/RPOkyTJ vnHw== 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 s66-v6si38049367pfj.164.2018.05.31.04.27.34; Thu, 31 May 2018 04:27:48 -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 S1754840AbeEaLZI (ORCPT + 99 others); Thu, 31 May 2018 07:25:08 -0400 Received: from szxga05-in.huawei.com ([45.249.212.191]:8232 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1754765AbeEaLWn (ORCPT ); Thu, 31 May 2018 07:22:43 -0400 Received: from DGGEMS405-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id E3AD42D59929; Thu, 31 May 2018 19:22:29 +0800 (CST) Received: from linux-ibm.site (10.175.102.37) by DGGEMS405-HUB.china.huawei.com (10.3.19.205) with Microsoft SMTP Server id 14.3.382.0; Thu, 31 May 2018 19:22:21 +0800 From: Yisheng Xie To: CC: , Yisheng Xie , "Michael Turquette" , Stephen Boyd , Subject: [PATCH v2 09/21] clk: use match_string() helper Date: Thu, 31 May 2018 19:11:14 +0800 Message-ID: <1527765086-19873-10-git-send-email-xieyisheng1@huawei.com> X-Mailer: git-send-email 1.7.12.4 In-Reply-To: <1527765086-19873-1-git-send-email-xieyisheng1@huawei.com> References: <1527765086-19873-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 instead of open coded variant. Cc: Michael Turquette Cc: Stephen Boyd Cc: linux-clk@vger.kernel.org Signed-off-by: Yisheng Xie --- v2: - leave second parameter on the first line - per Andy drivers/clk/clk.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c index 7af555f..d01bdda 100644 --- a/drivers/clk/clk.c +++ b/drivers/clk/clk.c @@ -2171,7 +2171,6 @@ void clk_hw_reparent(struct clk_hw *hw, struct clk_hw *new_parent) bool clk_has_parent(struct clk *clk, struct clk *parent) { struct clk_core *core, *parent_core; - unsigned int i; /* NULL clocks should be nops, so return success if either is NULL. */ if (!clk || !parent) @@ -2184,11 +2183,8 @@ bool clk_has_parent(struct clk *clk, struct clk *parent) if (core->parent == parent_core) return true; - for (i = 0; i < core->num_parents; i++) - if (strcmp(core->parent_names[i], parent_core->name) == 0) - return true; - - return false; + return match_string(core->parent_names, core->num_parents, + parent_core->name) >= 0; } EXPORT_SYMBOL_GPL(clk_has_parent); -- 1.7.12.4