Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp226400imm; Mon, 21 May 2018 05:11:57 -0700 (PDT) X-Google-Smtp-Source: AB8JxZqJXjv2UhchaDyLvsc4F9xIJekIWNGBOnsK3RWfqnLvyRVx9/y4wuNdoOwuH5IkftEqB/VY X-Received: by 2002:a62:6402:: with SMTP id y2-v6mr19363689pfb.71.1526904717634; Mon, 21 May 2018 05:11:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526904717; cv=none; d=google.com; s=arc-20160816; b=o2kUARMCVukeo/RwjYitjTsAd/vFcUhzxNk0u4lF2c6xsZxLLoom0AfaZ23ljQbKLv /jbu4KMNKSceEh4SXLZX6ss7kbSs2tz+hYFrxmTzoW8Nx6v1/vFRSs3Ab1KPSKbTuBKG nnQyb9J4YWVUdm2c1VmtcbYt/SlkhCoARQHPef/DIb8pmLGTUlXOYvl8ILFspjP5rQsb n9ueWMd7/v9Hug+udLU3mwwKhhGJs16p3M0nkq/LmIU8BqtUWL9X1bR8pKeoKNZ3dLDZ 0HePn9NNXxRYyNvOMyXsr+fotTpEPlJ16AkRxypRZvkOr4p5/ADFu1l9MVx8rWE0kb9z pr4Q== 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=VD3qBFj18o7bZq/5GWiglhVC9f2eKUU4HHS67FGtA0k=; b=uflHSfa7F4QpXbVtffXMu9zgKU9eWCGWFNmWJ1D5rAH81V6zveGGtpW7elz1yz0vBb RXeDbFDKFBUF/uanqzdoLqOO8ON5q+98VJKOEA4ObCbsTH3hyhxNHKQ8fsTXhgS0rN75 SBw8+O0m9nU4f139t0LPe/X/JRxhIoZ6inEDSVFT6SrbBpvd/8qOgaxl0ef2dDZCyiv9 xFM+KAWCn1jEXGWgWw58Rbc43SdkJYWGCMGNaB69Q6XQ0lET0LDyYndw6uzujqlmwtmY 0lFAMbmIvInqzCiZi8Gnof75rHCul9kha43iIUXSyIv2vBZK339eROPxhnIH9YrUKieW /Hcg== 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 x12-v6si10539795pgo.272.2018.05.21.05.11.43; Mon, 21 May 2018 05:11:57 -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 S1753197AbeEUMK4 (ORCPT + 99 others); Mon, 21 May 2018 08:10:56 -0400 Received: from szxga05-in.huawei.com ([45.249.212.191]:7717 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753025AbeEUMJ1 (ORCPT ); Mon, 21 May 2018 08:09:27 -0400 Received: from DGGEMS403-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id C36C0AD993C3A; 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:02 +0800 From: Yisheng Xie To: CC: Yisheng Xie , Clemens Ladisch , Jaroslav Kysela , Takashi Iwai , Takashi Sakamoto , Subject: [PATCH 28/33] ALSA: dice use match_string() helper Date: Mon, 21 May 2018 19:58:05 +0800 Message-ID: <1526903890-35761-29-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: Takashi Sakamoto Cc: alsa-devel@alsa-project.org Signed-off-by: Yisheng Xie --- sound/firewire/dice/dice.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/sound/firewire/dice/dice.c b/sound/firewire/dice/dice.c index 96bb01b..0639074 100644 --- a/sound/firewire/dice/dice.c +++ b/sound/firewire/dice/dice.c @@ -35,19 +35,13 @@ static bool force_two_pcm_support(struct fw_unit *unit) "SAFFIRE_PRO_40_1", }; char model[32]; - unsigned int i; int err; err = fw_csr_string(unit->directory, CSR_MODEL, model, sizeof(model)); 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 check_dice_category(struct fw_unit *unit) -- 1.7.12.4