From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 90CA3C433F5 for ; Thu, 7 Oct 2021 17:27:23 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 732006056B for ; Thu, 7 Oct 2021 17:27:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242130AbhJGR3P (ORCPT ); Thu, 7 Oct 2021 13:29:15 -0400 Received: from mga04.intel.com ([192.55.52.120]:60403 "EHLO mga04.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233695AbhJGR3N (ORCPT ); Thu, 7 Oct 2021 13:29:13 -0400 X-IronPort-AV: E=McAfee;i="6200,9189,10130"; a="225089216" X-IronPort-AV: E=Sophos;i="5.85,355,1624345200"; d="scan'208";a="225089216" Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Oct 2021 10:27:19 -0700 X-IronPort-AV: E=Sophos;i="5.85,355,1624345200"; d="scan'208";a="440347800" Received: from klmutolo-mobl.amr.corp.intel.com (HELO [10.212.1.203]) ([10.212.1.203]) by orsmga003-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Oct 2021 10:27:16 -0700 Subject: Re: [PATCH v2 1/3] ASoC: soc-acpi: add comp_ids field for machine driver matching To: Cezary Rojewski , Brent Lu , alsa-devel@alsa-project.org Cc: Liam Girdwood , Mark Brown , Jaroslav Kysela , Takashi Iwai , Jie Yang , Kai Vehmanen , Guennadi Liakhovetski , Yong Zhi , Vamshi Krishna Gopal , linux-kernel@vger.kernel.org, Rander Wang , Bard Liao , Malik_Hsu , Libin Yang , Hans de Goede , Charles Keepax , Paul Olaru , Curtis Malainey , Mac Chiang , Gongjun Song References: <20211007133516.1464655-1-brent.lu@intel.com> <20211007133516.1464655-2-brent.lu@intel.com> <7e6cf92f-b889-aed9-b13a-615d4d5f9b93@intel.com> From: Pierre-Louis Bossart Message-ID: <2ae5e8ef-76cb-8335-e250-64b0246175f3@linux.intel.com> Date: Thu, 7 Oct 2021 12:27:13 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Firefox/78.0 Thunderbird/78.13.0 MIME-Version: 1.0 In-Reply-To: <7e6cf92f-b889-aed9-b13a-615d4d5f9b93@intel.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org >>   struct snd_soc_acpi_mach * >>   snd_soc_acpi_find_machine(struct snd_soc_acpi_mach *machines) >>   { >>       struct snd_soc_acpi_mach *mach; >>       struct snd_soc_acpi_mach *mach_alt; >>   -    for (mach = machines; mach->id[0]; mach++) { >> -        if (acpi_dev_present(mach->id, NULL, -1)) { >> +    for (mach = machines; mach->id[0] || mach->comp_ids; mach++) { > > Such loops are hard to maintain i.e. 'comp_ids' acts here like a flex > array that follows 'id'. Removal of 'id' field and streamlining code to > only use 'comp_ids' should make this loop more intuitive. Changing all the tables adds more noise IMHO. There are 15 files and about 100 ids. This patch provides an opportunity to reduce duplication, that's good, but let's leave all the existing unique table entries alone, shall we?