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? 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 24812C433EF for ; Thu, 7 Oct 2021 17:28:26 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 9DDB260E09 for ; Thu, 7 Oct 2021 17:28:24 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 9DDB260E09 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linux.intel.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=alsa-project.org Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 675E541; Thu, 7 Oct 2021 19:27:32 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 675E541 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1633627702; bh=WAdqDxe0lu8sxnpk0yModBXUWba3GS3x/WDLyHniMhc=; h=Subject:To:References:From:Date:In-Reply-To:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=Xk0/xFCc5dFt2H1ChlF4lVKlsgHTzytQTnh4i4+DafeHzb0oRHDy4zFZtLqMhGTVy Nhk+LkB2xdRrOWMEGXkr6CQcic6YOcp094c4Tam99RpdOxQlVAxszskMoCWkoqpTgw TvmDoEBN4xtKTpoDlIIdTJEIdTZYrJ5oFKlYel+o= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id D060AF800F0; Thu, 7 Oct 2021 19:27:31 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 200F8F8027D; Thu, 7 Oct 2021 19:27:30 +0200 (CEST) Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 8BE37F800F0 for ; Thu, 7 Oct 2021 19:27:21 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 8BE37F800F0 X-IronPort-AV: E=McAfee;i="6200,9189,10130"; a="312509782" X-IronPort-AV: E=Sophos;i="5.85,355,1624345200"; d="scan'208";a="312509782" Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga105.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 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 Cc: Libin Yang , Guennadi Liakhovetski , Malik_Hsu , Charles Keepax , Kai Vehmanen , Rander Wang , linux-kernel@vger.kernel.org, Jie Yang , Takashi Iwai , Liam Girdwood , Hans de Goede , Mac Chiang , Mark Brown , Bard Liao , Paul Olaru , Curtis Malainey , Gongjun Song , Vamshi Krishna Gopal , Yong Zhi X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" >>   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?