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 95416C433EF for ; Tue, 19 Oct 2021 18:43:45 +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 1C25B61260 for ; Tue, 19 Oct 2021 18:43:43 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 1C25B61260 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 AB367169B; Tue, 19 Oct 2021 20:42:51 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz AB367169B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1634669021; bh=+A0zn7pZqx0malgPgXXqeH6Id2rBOfRkxN217kQqZ/Q=; h=Subject:To:References:From:Date:In-Reply-To:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=QFBK0anj+C7auMTyyMJKzzZs3bt0DPVoPqo0+lo25SIh2ay2I4Zf3xl8W3oTZUmI6 0tPdGQRv2dXJFCSG/1TjMKSb/usosNXtzzSazGBG+pGdJIJV/n86A7BTmwjNcc3Z4c F9DpetpqpHMFxywgyk9WhGP5L98rqlFh80FJNnYk= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 30BF9F8019B; Tue, 19 Oct 2021 20:42:51 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 4498CF80240; Tue, 19 Oct 2021 20:42:43 +0200 (CEST) Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) (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 ACCD6F80082 for ; Tue, 19 Oct 2021 20:42:37 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz ACCD6F80082 X-IronPort-AV: E=McAfee;i="6200,9189,10142"; a="228870662" X-IronPort-AV: E=Sophos;i="5.87,164,1631602800"; d="scan'208";a="228870662" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Oct 2021 11:42:33 -0700 X-IronPort-AV: E=Sophos;i="5.87,164,1631602800"; d="scan'208";a="483358357" Received: from kumarr1-mobl1.amr.corp.intel.com (HELO [10.212.58.240]) ([10.212.58.240]) by orsmga007-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Oct 2021 11:42:32 -0700 Subject: Re: [PATCH] ASoC: Intel: Unify HDAudio-ext bus initialization To: Cezary Rojewski , Kai Vehmanen References: <20211018192134.353931-1-cezary.rojewski@intel.com> <4bf04607-0779-fe47-61b1-1780ab1a3d20@intel.com> <25811f8f-c7bc-89c2-f616-4102293a2deb@linux.intel.com> From: Pierre-Louis Bossart Message-ID: <569f6bf6-c346-3059-fc7e-e8c46c7dc4b6@linux.intel.com> Date: Tue, 19 Oct 2021 13:42:29 -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: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Cc: hdegoede@redhat.com, alsa-devel@alsa-project.org, broonie@kernel.org, tiwai@suse.com 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" On 10/19/21 12:32 PM, Cezary Rojewski wrote: > On 2021-10-19 6:58 PM, Pierre-Louis Bossart wrote: >>>> hmm. It's not clear whether we should initialize the regular hdac_bus >>>> fields in the ext_bus_init(). For plain HDA, these are also initialized >>>> in the caller. E.g. in sound/pci/hda/hda_controller.c. >>>> >>>> So if we start cleaning up, should we go further put this in >>>> snd_hdac_bus_init()? >>>> >>>> Then another is what is the right place for settings like "sync_write = >>>> 1". While this settings applies to all current users of the extended >>>> bus, this is really hw specific setting and not really a property of >>>> the extended bus, so this feels a bit out-of-place. >>> >>> I'm rather in favor of bigger cleanups. We can definitely move further >>> in the future : ) >> >> I am not opposed to updates in this hdaudio-ext part, but I am in favor >> of less ambitious step-by-step changes. >> >> a) This is legacy code where the initial authors have moved on, and it's >> very hard to figure out what the intent was. It's quite common to have >> discussion on feature v. bug, see e.g. the discussion we had on this in >> https://github.com/thesofproject/linux/pull/3175#pullrequestreview-772674119 >> >> >> b) In addition, this code is shared between two teams with separate >> testing/CI capabilities and limited number of commercial/shipping >> devices. There is a very large risk of introducing bugs even with the >> best intentions. >> >> Before we do any changes in functionality, there are already basic steps >> that can be done, e.g. using consistent naming between variables, the >> existing code is just confusing as can be: >> >> struct hdac_stream *stream; >> struct hdac_ext_stream *stream; >> struct hdac_stream *hstream; >> struct hdac_ext_stream *hstream; >> >> I started basic cleanups here: >> https://github.com/thesofproject/linux/pull/3158, I haven't had time to >> complete this because of more important locking issues, but I intend to >> send those clarifications for the next cycle. >> >> Again before we do large changes let's think of smaller steps and how we >> are going to validate those changes. > > Agree, step-by-step is the way to go. > > Isn't this patch a 'step' though? This isn't remotely a refactor, just > gathering of common parts of ext-bus initialization. We could start with > this so legacy users are unaffected, then have snd_hdac_bus_init() > updated so snd_hdac_ext_bus_init() is devoid of 'core' fields > assignments as suggested by Kai. If it was just moving common parts, I would have no issue. My main objection is that you went one step further and started renaming stuff in rather confusing ways, e.g. -void sof_hda_bus_init(struct hdac_bus *bus, struct device *dev) +void sof_hda_bus_init(struct hda_bus *bus, struct pci_dev *pdev, - * snd_hdac_ext_bus_init - initialize a HD-audio extended bus + * snd_hda_ext_bus_init - initialize a HD-audio extended bus hda_bus is a definition from hda_codec.h, I don't see a reason why we should use this structure when the vast majority of the code uses hdac_bus. And the purpose of hdac_ext is really to deal with *controller* extensions to couple/decouple DMAs. There is no dependency on codecs at that level. Even if there was, I also don't really see why/when we should start using hda_ext v. hdac_ext, the naming convention completely escapes me. It would seem logical to me to only use hdac_ext as an extension of hdac_, no? I also don't get what this means: + snd_hda_ext_bus_init(hbus, pci, NULL, ext_ops, "sklbus"); what is 'sklbus' and what purpose are you trying to accomplish with this change?