Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp231694imm; Mon, 21 May 2018 05:17:21 -0700 (PDT) X-Google-Smtp-Source: AB8JxZqu7pZ812yDnrutuQvm+3RIPBt9WarUayk/UvXP5SXCN4PSYwhUj8z1+ZXHw/83mBsu8KuL X-Received: by 2002:a63:6742:: with SMTP id b63-v6mr15765590pgc.54.1526905041632; Mon, 21 May 2018 05:17:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526905041; cv=none; d=google.com; s=arc-20160816; b=nAxR8GjIxUbCcY+VVTvIW142Gudtd24zrlE9Ik8KYJE/M7yrYGRjvgdusyonEqw/2w tXiOtVEuGKHl7tQg7aBGc5JWmnz/U4tGo9ZvAMc7xvvwCV6bW2X9rQmXFnEReOSs70gG G/T2c4g/+lfKvXGcXngHrLh5zs7C6F2GhYyGHiy/UPIeUJDH/RJPS+SELmHqkuUrEViI n5HVdS0s90Bsc46fVn7LgPBNnz5KlHVuO8Mi56jwvST1uqD3BeQShx7nUMpx2QFuaryI cJSbG+es073ozvTDaBBmXexaQWQ3V2g1E00ETLI1ikStaHbI+AW4qVTZ8bWflEPOiQci 4f4g== 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=QQURZdXgA6ey6vjF6ko74z8UMFwjytP8OOheaN074Kk=; b=aE2JUY48WtVj4GR6dfM15yPJB0D54CMFqYz1KERpGaRg8aL43/DbeBNjMGxiW4loCT VOLpngOMwAE0/omCIKJ05C+T3qoUl0zGRoCQ2+GB541AH1fXXXb0zfBRmSWzCtpMY+If 02qrIWKP+Q9XaETVVGPO2HaNf98ThwQgFJWlwq/NiFu9k/NA6cd0857fWOMWiuznvNv5 FSYSkRWn2RbWD1qA5JiBRlnDCl/yUpDbJXiPYuTgM8U7cGO5Q5uzq3AAkpXmHa6JpwlP x143vgAqq6m7c36U5lEbtp9XPQNMOFSHEHZTmxmywew3v5zg2IxAjr37HIIAfxQfGi3+ hNmA== 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 p2-v6si6488583pgn.187.2018.05.21.05.17.06; Mon, 21 May 2018 05:17:21 -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 S1752897AbeEUMQF (ORCPT + 99 others); Mon, 21 May 2018 08:16:05 -0400 Received: from szxga07-in.huawei.com ([45.249.212.35]:38662 "EHLO huawei.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1751251AbeEUMJE (ORCPT ); Mon, 21 May 2018 08:09:04 -0400 Received: from DGGEMS403-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id E0D5DAF324144; Mon, 21 May 2018 20:09:00 +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:55 +0800 From: Yisheng Xie To: CC: Yisheng Xie , Michael Turquette , Stephen Boyd , Subject: [PATCH 14/33] clk: use match_string() helper Date: Mon, 21 May 2018 19:57:51 +0800 Message-ID: <1526903890-35761-15-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: linux-clk@vger.kernel.org Signed-off-by: Yisheng Xie --- 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..4469eca 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