From mboxrd@z Thu Jan 1 00:00:00 1970 From: Pierre-Louis Bossart Subject: Re: Why open-coding in sof_hda_bus_init()? Date: Fri, 31 May 2019 15:59:17 -0500 Message-ID: <13dce83f-a092-6d9f-4676-8e3fc46bdc23@linux.intel.com> References: <1f3059d6-b271-f612-c670-e7214674892f@linux.intel.com> <68aa2fa2-41fc-3dfb-c82f-1f88be5bd867@linux.intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; Format="flowed" Content-Transfer-Encoding: 7bit Return-path: 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 2D5E1F8072E for ; Fri, 31 May 2019 22:59:20 +0200 (CEST) In-Reply-To: Content-Language: en-US List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" To: Takashi Iwai Cc: alsa-devel@alsa-project.org, Keyon Jie List-Id: alsa-devel@alsa-project.org >> we need everything that was removed in your proposal :-) >> >> - memset(bus, 0, sizeof(*bus)); >> - bus->dev = dev; >> - >> - bus->io_ops = &io_ops; >> - INIT_LIST_HEAD(&bus->stream_list); >> - >> - bus->irq = -1; >> - bus->ext_ops = ext_ops; >> - >> - /* >> - * There is only one HDA bus atm. keep the index as 0. >> - * Need to fix when there are more than one HDA bus. >> - */ >> - bus->idx = 0; >> - >> - spin_lock_init(&bus->reg_lock); >> >> This is the smallest set of initialization needed when you don't need >> hdmi/hdaudio codec support. > > I don't understand it... Why SOF core needs to initialize the content > of HD-audio bus object even if you won't use it? we do use it left and right, but we only use the 'controller/DMA' parts of that structure. we have zero use for CORB/RIRB and codec-specific stuff when I2S and DMIC are the only connections to 3rd party chips > > IOW, what's the merit of having hda-bus.c with the copy of > snd-hda-core code? As far as I see, both hda.c and hda-bus.c are > linked into the same snd-sof-intel-hda-common module. And, the former > has the direct calls of HD-audio core API (with > CONFIG_SND_SOC_SOF_HDA); i.e. snd-sof-intel-hda-common already depends > on snd-hda-core if CONFIG_SND_SOC_SOF_HDA is on, no matter how you > code hda-bus.c. I agree we could implement hda-bus in a cleaner way - but it's a very small file. A larger core repartitioning would take quite a bit of time, and in the mean time we already have to sort out all the deltas between legacy driver and hdac library. Anyways, that's it for me this week, enjoy your vacation!