Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp1067047imm; Mon, 21 May 2018 20:43:41 -0700 (PDT) X-Google-Smtp-Source: AB8JxZoAKZV5KfoKfutfYlnjhPOLcdioI3kJ5JdFssXdbGM3J+yN5u09SjFibiGoI35iUoNblg3E X-Received: by 2002:a17:902:59ce:: with SMTP id d14-v6mr23383644plj.253.1526960621589; Mon, 21 May 2018 20:43:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526960621; cv=none; d=google.com; s=arc-20160816; b=dhWFk5Eft3WYXCD4gvqLlZPqrn+/hHX9dTMWnHfYZKBqXtIPthZATSK1STIUXfBzqs y0ZGYtUObGxZWXNcgd4aQ36Bg4e/EmZGSXUPWdOEolOjsgFluvKOptb+Fv+yqQdJLfYf iORjJKSiwsHwFUs4roxXIRBcwuAEdCziONIKv5xuIVmqQnRbRzZ79ZhQecHZQqQ0nrB2 FiRBaLyUM7d/rOxN2TOnz/nSDpiVQSIBj1qLXredxu0yf+XDsWglpsUUxP0z6zSL4qNT EsgNjouiXeFJWwFzLJSV8m7oks/wNqKoSdbEIBjwi2i18gs3uXI9r76enqPP7fyw9uPp /DHQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:in-reply-to :mime-version:user-agent:date:message-id:from:cc:references:to :subject:arc-authentication-results; bh=CDHGUyfxgTMG+q9pq+DG11ET8Ph7WGbibTKEE7NIMN0=; b=WgskUcjoKw3kHJ71qmhi3UDiVZs0g6wgl5WqAGnok5AoBwWBGieiq3iz2R9MFLuhO3 tlcETw19klZ0eywDV0oD93BYufc/mxFz58IhBJWnuJzTrhefOQBV1up5yI9tncSYQWsc 6Xz3uQs6qzTgflN3TlBKQ5ZmBZSWWrsP48BXHo9zuH4cDmMduEgzY7NiBt9rZ3LZPUdU WnJvsXqkLmInl5ddJsxX1MquiuKYzJOe08/CFtjR9/iuR6pq05MIn0ClgLv5yAB3PsS8 LxiIAzMlRe7lrs7U3naYhv18QVQwSVdlqERD/UT28UjdmEpRWBt9kONFJCUckhLZjUqt 4DqQ== 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 u71-v6si12298623pgd.147.2018.05.21.20.43.25; Mon, 21 May 2018 20:43:41 -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 S1752080AbeEVDnK (ORCPT + 99 others); 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 Received: from DGGEMS405-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id 9A419E6BF9F05; Tue, 22 May 2018 11:43:04 +0800 (CST) Received: from [127.0.0.1] (10.177.29.40) by DGGEMS405-HUB.china.huawei.com (10.3.19.205) with Microsoft SMTP Server id 14.3.382.0; Tue, 22 May 2018 11:43:00 +0800 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 Precedence: bulk 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]; > >