Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp225549imm; Mon, 21 May 2018 05:11:06 -0700 (PDT) X-Google-Smtp-Source: AB8JxZqq0tQRU8ly9iw+A/zHi31HLEOjAZprNtRgy1gI9l/jnOoIEvq/eeCeMwe9Ggaf9iNqFHbb X-Received: by 2002:a62:da17:: with SMTP id c23-v6mr19925267pfh.128.1526904666467; Mon, 21 May 2018 05:11:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526904666; cv=none; d=google.com; s=arc-20160816; b=yiw+1U2AFadZD/Q4l3g//uIQ0u2OXPyNWggt9ymQtYEa9GHuu5S1QSK0yWwhlpG2xu nBVeVgkYb1Q6dRGCvRaOjLWBfNOVFByeUCrQkKjPK44dzAVz9H/pcSCOV/AwgrNQffe2 7CV8aRj3QupSvIMjD/V+xxEdn5gWUKxBSPBlsiJBZxF81/5qkWtwIQjO1UMXqF3kW1nx xVpQsIdn0KjK157fE2rMHo3dIO6cTpRzVq6yueolQf6LHCbHe+17dYQllF7qkadFq0ZV Y9npdvqD8aBiHZbl5JduhItn6mDOm8PMmHPQqZPqJsehmVb2e4xFzRSPhJcURiFb8uLT +pYg== 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=ol4sTtDzDAyZv+qsI9eLOhwuLlZz41KEsbeZjXIjt8s=; b=K+Goi+EAk/rqXbN0enNRFrxY1TSLcmQmDTp40xjhOLixpZIGwXEJSTURjgrAFKxqxF 7IVqn3F1jUVBD7y4pViOVQjshsp1r9I/YG92AtyU/Cb0g10eGtYfFshlGEUdisa5y7bH /g08EQA10bM7XELqSLC/G8Y/5aU9gJCz5J+SpJGA0GPk8R5FgDEft4YRJcMLK/SA8AN7 2b59oV/2saiCxiXLheZxcAG0IwcKv5RlBDaY9zOW1rGoiLI0pkqKXN+jGuffzgy9JzjD clPqg1MHPwkx/sS9q14yxEHkNWMdaYJilstyRqCzU8nmF/xGOSpVtPCOXNQj1w9BXPD5 P0ig== 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 k17-v6si13964339pfj.310.2018.05.21.05.10.51; Mon, 21 May 2018 05:11: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; 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 S1753120AbeEUMJj (ORCPT + 99 others); Mon, 21 May 2018 08:09:39 -0400 Received: from szxga05-in.huawei.com ([45.249.212.191]:7723 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753002AbeEUMJZ (ORCPT ); Mon, 21 May 2018 08:09:25 -0400 Received: from DGGEMS403-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id 8A6AD90D8B19; Mon, 21 May 2018 20:09:11 +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:09:03 +0800 From: Yisheng Xie To: CC: Yisheng Xie , Clemens Ladisch , Jaroslav Kysela , Takashi Iwai , Subject: [PATCH 29/33] ALSA: oxfw: use match_string() helper Date: Mon, 21 May 2018 19:58:06 +0800 Message-ID: <1526903890-35761-30-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: Clemens Ladisch Cc: Jaroslav Kysela Cc: Takashi Iwai Cc: alsa-devel@alsa-project.org Signed-off-by: Yisheng Xie --- sound/firewire/oxfw/oxfw.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/sound/firewire/oxfw/oxfw.c b/sound/firewire/oxfw/oxfw.c index 413ab63..1e5b2c8 100644 --- a/sound/firewire/oxfw/oxfw.c +++ b/sound/firewire/oxfw/oxfw.c @@ -49,7 +49,6 @@ static bool detect_loud_models(struct fw_unit *unit) "Tapco LINK.firewire 4x6", "U.420"}; char model[32]; - unsigned int i; int err; err = fw_csr_string(unit->directory, CSR_MODEL, @@ -57,12 +56,7 @@ static bool detect_loud_models(struct fw_unit *unit) if (err < 0) return false; - for (i = 0; i < ARRAY_SIZE(models); i++) { - if (strcmp(models[i], model) == 0) - break; - } - - return (i < ARRAY_SIZE(models)); + return match_string(models, ARRAY_SIZE(models), model) >= 0; } static int name_card(struct snd_oxfw *oxfw) -- 1.7.12.4