Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp837154imm; Mon, 21 May 2018 15:28:26 -0700 (PDT) X-Google-Smtp-Source: AB8JxZpZQNjxMsV2QKPAAxHX0JIxyk/uNR2qiOQNnH1wESmmHT03GiCTUz7q8XLDTQ2nPktjLzjG X-Received: by 2002:a17:902:780a:: with SMTP id p10-v6mr22191788pll.281.1526941706678; Mon, 21 May 2018 15:28:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526941706; cv=none; d=google.com; s=arc-20160816; b=QYxDK/rE3N0f8Q47I6M4hl7efyzfDTt9ey+dAsHRjJWYlb8wXojp7AnG+/RsKikk94 dZubcRqddWjJ6wIBqNh5+yeWsF+rng6TvxnHqT/Ry5I7+QRwfWbqYic3eOaXDIh1pfjn bi2WYT/cnVZqLbjG2C9EPMLxBexZ/sV4z7klHfUzxnVmdTVrK9YhldVcBHy9rZnhYRyA WCL7ifMC7D54B4qb1QoF9RH+COqe0HPBfajho+pU2oJfvLo7utsBv5IFe/7qMcqz/5Kz 0yaZYIFGP1SFLJ9gOEj6BMId0NUQ8VaSnMzJbqJiz4he/f46TPFj8dSoIziO6TKDInTG nKDA== 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 :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:arc-authentication-results; bh=i/+5kH0YPwSB/yyFKZ8YpnO5OUhIgO3d++7yLRKGY/A=; b=QXswqsnziwaMjWyyHOUyBXYgw7HZbXWFQA5ejBaPc4ctNZeH4aO6ggdnJne2UHU4hc JdH7fNwzPU19WmBTRvPiheU2seYab2OL3tKLooUI6Ubn3317knsTbJByKh2LGeVzx8g3 3FH1+dhXAw5PbMVlXi25/WiC/3Vsa1Q8+cQBTgMaRMOmmk8rVtsmqqt+b9nI38dNHgvs zKkk3f+MiaPQYt6otU35GJfHF+BZg73tbx5Dwajm/AmEaIBhn8Z6hs+3hnman94kv/nR NwXf8VfEJjqRLc3D+BpqHOSh73cFUZXxt1oC7Qbdha6odvFnY27crcnK9jd/lwY7QVxS /b0w== 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 q80-v6si15076667pfi.109.2018.05.21.15.28.12; Mon, 21 May 2018 15:28:26 -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 S1753337AbeEUW1D (ORCPT + 99 others); Mon, 21 May 2018 18:27:03 -0400 Received: from smtp-proxy003.phy.lolipop.jp ([157.7.104.44]:56159 "EHLO smtp-proxy003.phy.lolipop.jp" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752870AbeEUW06 (ORCPT ); Mon, 21 May 2018 18:26:58 -0400 Received: from smtp-proxy003.phy.lolipop.lan (HELO smtp-proxy003.phy.lolipop.jp) (172.19.44.44) (smtp-auth username m12129643-o-takashi, mechanism plain) by smtp-proxy003.phy.lolipop.jp (qpsmtpd/0.82) with ESMTPA; Tue, 22 May 2018 07:26:56 +0900 Received: from 127.0.0.1 (127.0.0.1) by smtp-proxy003.phy.lolipop.jp (LOLIPOP-Fsecure); Tue, 22 May 2018 07:26:53 +0900 (JST) X-Virus-Status: clean(LOLIPOP-Fsecure) Subject: Re: [alsa-devel] [PATCH 29/33] ALSA: oxfw: use match_string() helper To: Yisheng Xie , linux-kernel@vger.kernel.org Cc: alsa-devel@alsa-project.org, Clemens Ladisch , Takashi Iwai References: <1526903890-35761-1-git-send-email-xieyisheng1@huawei.com> <1526903890-35761-30-git-send-email-xieyisheng1@huawei.com> From: Takashi Sakamoto Message-ID: Date: Tue, 22 May 2018 07:26:53 +0900 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0 MIME-Version: 1.0 In-Reply-To: <1526903890-35761-30-git-send-email-xieyisheng1@huawei.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, On May 21 2018 20:58, 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: 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(-) Reviewed-by: Takashi Sakamoto For my information, use_match_string() helper was firstly introduced to v4.6 kernel by a commit 56b060814e2d ('lib/string: introduce match_string() helper'). > 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) Thanks Takashi Sakamoto