Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp481690imm; Fri, 1 Jun 2018 04:35:06 -0700 (PDT) X-Google-Smtp-Source: ADUXVKLdu77CWZsmeW3BG6kdsxQE1qRXJNepsYTMjtOV215b+2kmmOhXd/w8+26gM1kgREP07QFZ X-Received: by 2002:a62:3994:: with SMTP id u20-v6mr10577796pfj.95.1527852906780; Fri, 01 Jun 2018 04:35:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527852906; cv=none; d=google.com; s=arc-20160816; b=nWsJSqWA7+2BMlwUdgpc2Sh25VvBcd9MV9k8YxLLcy3QoZco3DMUOO35PPYmf3VK9O sQ/+37NKIIGvTmLxvZSmyUZQQOKEOtfYC2lmhbYcqCsi5rC685A5b9Xtb2h+AQ9YInnk YunXE598UasIUR3i5YgWIshXwA9D402JnpYGfeTmIQXSh+/B3wP4z28WXoAyb2DJmQ6/ /O2Ha+ZohYAIPoQUnIEA45JgSJYA80ZJYY1NR/Pt11JxhnGXDF3uSOLfuBGm0yiRxO5u GNQw0/p9tyqBqnCgyzKyfrbeQFtaB8OrQnAMb/Knele0sz0UWN2PmzTsZ8yS38TN2M/B /UyA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=Ds47jv9UjMKHesQB4ISYPpb+9Z+oL1gh/C6cO8f0d+g=; b=MR1HGRNYd0LowZ+ArsNQzkylSjO66E9b/uito4GobKUz053l7HdrwFUT2zWSH7KKvz 8ODPky2grtttHshHrqKrIMPzLE64a7+BxAGtF4J4zdV/k0XTJPnt2do5fUZPpUhs6hX7 uLAA87FX9kMBjSkOv+2AnEK+UAHrvemj9ACgEUeqwZuSiequeQkwIMIFLBFYlzD+9SUM w1cI2MySZGcnEffeLKsluRxQjIVOd4y/Jue26+BwdNELHGXQr9YMwnW4K1fUaUCD47kF ektXG6vr7XDesK9+Ola1XeDLzSk1jz+clTGrgODSps9LNrTXuACcJelMpEYDemCn7p8/ uIEA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=IuzZ0Bem; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o7-v6si10049118pgn.130.2018.06.01.04.34.51; Fri, 01 Jun 2018 04:35:06 -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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=IuzZ0Bem; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751417AbeFALe0 (ORCPT + 99 others); Fri, 1 Jun 2018 07:34:26 -0400 Received: from mail-qt0-f196.google.com ([209.85.216.196]:34109 "EHLO mail-qt0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750790AbeFALeZ (ORCPT ); Fri, 1 Jun 2018 07:34:25 -0400 Received: by mail-qt0-f196.google.com with SMTP id m5-v6so31724861qti.1; Fri, 01 Jun 2018 04:34:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=Ds47jv9UjMKHesQB4ISYPpb+9Z+oL1gh/C6cO8f0d+g=; b=IuzZ0BemjHeffFbWTXsgH3XltoqNxtfxKk9uDo3rj7L47jCL0OVzl5N4SN3zqYRzu4 p/XF+4Nb5Kv2knF0qmbLBv1yFF4bil8hg3ObCHTJmXp438k5O+1mymgLHgXImzZYe87H Il2Z/MYDldAF3bmNLKgTF2Zckb/k/Ovl1oKwiUtLReuJ0k8GOT54emDIzLC0ZmBT32Mo w8QMYXly4GdPXEAsWq+47Prc3+moKhPqDtwbDVTXtB4ozXf3ooRBJTubwWw28rYIEblz b8HJNSsCcheyJ80bTPNc5T0FdwH9Q8+zRdXknpZG5hK7alTyKm7PS5Fm1ufBg9w0OFfg 8RYQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=Ds47jv9UjMKHesQB4ISYPpb+9Z+oL1gh/C6cO8f0d+g=; b=gKce+5wp7Jkg7cXHfQx8lWXp5e0U7FR6iMCHMqDXDEpmSmY5DvZDhoWM9MWRjQkhKU FWxWxI/g8tfFQWkPMTjFIjVDNcH94e1w4+wVBul+a0CnXzVN/ORKNiDtCQrILfZtq/3K tSO259xoHatpkKYV2r+eOgSOUxN5lP83t68VsmNtEPZYIpyvKw9shJSmRWj+zqAZKIei D9e3/ptK4U74nlpp8tWQdE9rN9rLeFOOXLbX/1azZIto7RH+g+EQ8TU2z/jo6MiU648d /C3JraKlH35rcSzeH8UTGvHtEiCBzYvtJZ+SnFqPm5yfP4wkEPYEpsnA970tD96dyZZX kL1w== X-Gm-Message-State: APt69E3zYAQgw7lUJtz4O4WupPx87PuZYoqAPxcQ3IYmw8LkqsPf7VWy nL3VcJO++4qSId0DLfUpPWE3GOY8BUfBQNA7CWc= X-Received: by 2002:ac8:430e:: with SMTP id z14-v6mr7661057qtm.105.1527852864215; Fri, 01 Jun 2018 04:34:24 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a0c:98f9:0:0:0:0:0 with HTTP; Fri, 1 Jun 2018 04:34:23 -0700 (PDT) In-Reply-To: <1527765086-19873-22-git-send-email-xieyisheng1@huawei.com> References: <1527765086-19873-1-git-send-email-xieyisheng1@huawei.com> <1527765086-19873-22-git-send-email-xieyisheng1@huawei.com> From: Andy Shevchenko Date: Fri, 1 Jun 2018 14:34:23 +0300 Message-ID: Subject: Re: [PATCH v2 21/21] sparc64: use match_string() helper To: Yisheng Xie Cc: Linux Kernel Mailing List , "David S. Miller" , Anthony Yznaga , Pavel Tatashin , sparclinux@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, May 31, 2018 at 2:11 PM, Yisheng Xie wrote: > match_string() returns the index of an array for a matching string, > which can be used instead of open coded variant. > @@ -512,10 +512,9 @@ static unsigned long __init mdesc_cpu_hwcap_list(void) > break; > } > } It seems previous loop also can be replaced. > - for (i = 0; i < ARRAY_SIZE(crypto_hwcaps); i++) { > - if (!strcmp(prop, crypto_hwcaps[i])) > - caps |= HWCAP_SPARC_CRYPTO; > - } > + i = match_string(crypto_hwcaps, ARRAY_SIZE(crypto_hwcaps), prop); > + if (i >= 0) > + caps |= HWCAP_SPARC_CRYPTO; > > plen = strlen(prop) + 1; > prop += plen; > -- > 1.7.12.4 > -- With Best Regards, Andy Shevchenko