From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752289AbeEVDnK (ORCPT ); Mon, 21 May 2018 23:43:10 -0400 Received: from szxga07-in.huawei.com ([45.249.212.35]:60276 "EHLO huawei.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1751557AbeEVDnH (ORCPT ); Mon, 21 May 2018 23:43:07 -0400 Subject: Re: [PATCH 12/33] clk: bcm2835: use match_string() helper To: Andy Shevchenko References: <1526903890-35761-1-git-send-email-xieyisheng1@huawei.com> <1526903890-35761-13-git-send-email-xieyisheng1@huawei.com> CC: Linux Kernel Mailing List , "Michael Turquette" , Stephen Boyd , "Eric Anholt" , Stefan Wahren , , , linux-arm Mailing List From: Yisheng Xie Message-ID: <00acb90b-1c2c-a855-2a8f-f60a859a0f85@huawei.com> Date: Tue, 22 May 2018 11:42:55 +0800 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.1.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.177.29.40] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Andy, On 2018/5/22 5:50, Andy Shevchenko wrote: > On Mon, May 21, 2018 at 2:57 PM, Yisheng Xie wrote: >> 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: Eric Anholt >> Cc: Stefan Wahren >> Cc: linux-clk@vger.kernel.org >> Cc: linux-rpi-kernel@lists.infradead.org >> Cc: linux-arm-kernel@lists.infradead.org >> Signed-off-by: Yisheng Xie > >> - size_t i, j; >> - int ret; >> + int i, ret; > > I do not see any need to change type for i. Right, I just want to smaller the line of code, for unsinged int is also OK for i. Anyway, I can change it as your suggestion in next version. Thanks Yisheng > >> + ret = match_string(cprman_parent_names, >> + ARRAY_SIZE(cprman_parent_names), >> + parents[i]); >> + if (ret >= 0) >> + parents[i] = cprman->real_parent_names[ret]; > >