Received: by 2002:a05:6a10:2785:0:0:0:0 with SMTP id ia5csp3078008pxb; Tue, 12 Jan 2021 05:58:09 -0800 (PST) X-Google-Smtp-Source: ABdhPJygmdgJAat6la8+9sOzb1N9aEu7BlytfooPfXfKAnt4cKMnui88fLYYVlcLubBNbMV4DNDa X-Received: by 2002:a50:b944:: with SMTP id m62mr3481688ede.182.1610459888854; Tue, 12 Jan 2021 05:58:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610459888; cv=none; d=google.com; s=arc-20160816; b=U56x8iAj71aLFW6SQOppvvZFZQhhGphpddenpsiTYXPMzK2GsLYzn/LpZRbLacehB8 NEBggclZXos3xe296e9BJpJAZrkSRUlie8nxyDo+neEqxQp7f3IcU/W7pBmCUF43O2Rq n660UdflUgGSWI+BTIX07DwW94emTDcbyZVfxYWjhcne96kcFYnWmQOsCSPTPN7vtWgf 8CpQBhDcldGRA2CIc3pn4XQ0lCzm3QANmGdpKh6jjNUe4cnGZXrzUfv2qYgf+dqLwGMB Jb45SQ25ih2Q29OSD3t1fnQGYypA+PlCna9U4Yl9Q002Ju1F1hORtEJ7aPxKiNWbFAvQ bl9Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent:references:in-reply-to :subject:cc:to:from:message-id:date; bh=1Y9SNoSw7kb4W6wRCGnZdK8tpKkW51LuPl9bvdhocVs=; b=HlOPpfjHKIG7ngUjOZmDFcRUgDTf7VQihVkh1N6VyowMRCh7dIwEL0+mRyNHr8lpp2 N55llnqzN69uotorbUgeroye6UMBxO6TiUtaxGikbe1bcE8epqIZsc5CHt7XRTmFZ/il pesz5KiC+BrMYaJHA//qOGxCgSkgSvpRpMvRT1GmENN+b7Ix3Q7xPTnEKpReL50Szjf+ YSn7PtqQesi4IJCFM1HdjndZIcHboPXM8u/157lIhZ3XtFN3ZvNLjrVzJWEJRfew9Xg4 qsrrR45+vFS8SAbBKl+fTbpMYVqkX8mPEt4W9/vsasSA2Pqt9fdsjWRRI7pYWPuxqqlZ qyuQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id np6si1203866ejb.609.2021.01.12.05.57.45; Tue, 12 Jan 2021 05:58:08 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731375AbhALN4Q (ORCPT + 99 others); Tue, 12 Jan 2021 08:56:16 -0500 Received: from mx2.suse.de ([195.135.220.15]:54458 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730630AbhALN4O (ORCPT ); Tue, 12 Jan 2021 08:56:14 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 5B24AAC8F; Tue, 12 Jan 2021 13:55:32 +0000 (UTC) Date: Tue, 12 Jan 2021 14:55:31 +0100 Message-ID: From: Takashi Iwai To: Pierre-Louis Bossart Cc: Arnd Bergmann , Kai Vehmanen , Jaroslav Kysela , Liam Girdwood , Mark Brown , Arnd Bergmann , Takashi Iwai , Ranjani Sridharan , Daniel Baluta , ALSA Development Mailing List , "linux-kernel @ vger . kernel . org" , sound-open-firmware@alsa-project.org, YueHaibing Subject: Re: [PATCH] ASoC: SOF: Intel: avoid reverse module dependency In-Reply-To: <59a36212-2412-2dd3-62f2-69c6f65312b1@linux.intel.com> References: <20210105190808.613050-1-arnd@kernel.org> <59a36212-2412-2dd3-62f2-69c6f65312b1@linux.intel.com> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI/1.14.6 (Maruoka) FLIM/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL/10.8 Emacs/25.3 (x86_64-suse-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=US-ASCII Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 11 Jan 2021 20:54:17 +0100, Pierre-Louis Bossart wrote: > > > > On 1/5/21 1:07 PM, Arnd Bergmann wrote: > > From: Arnd Bergmann > > > > The SOF-ACPI driver is backwards from the normal Linux model, it has a > > generic driver that knows about all the specific drivers, as opposed to > > having hardware specific drivers that link against a common framework. > > > > This requires ugly Kconfig magic and leads to missed dependencies as > > seen in this link error: > > > > arm-linux-gnueabi-ld: sound/soc/sof/sof-pci-dev.o: in function `sof_acpi_probe': > > sof-pci-dev.c:(.text+0x1c): undefined reference to `snd_intel_dsp_driver_probe' > > > > Change it to use the normal probe order of starting with a specific > > device in a driver, turning the sof-acpi-dev.c driver into a library. > > Thanks Arnd for reporting all this, much appreciated. > > The initial design was that we would have one generic platform_driver > (ACPI) and one generic PCI driver that would deal with all known IDs, > with descriptors that would point ops and callbacks defined in > device-specific drivers. It's how all Intel drivers worked so far, > from HDaudio to Atom/SST and Skylake. > > It's not that ugly, but to Arnd's point we do have a lot of #if > IS_ENABLED at the top level with a larger and larger table of IDs, > along with Kconfig magic indeed to propagate constraints from > top-level to device-specific drivers. The error with DSP_CONFIG comes > from the fact that this never belonged at the top-level, or should > have been conditionally invoked, as noted by Takashi. > > That said, the initial design which dates from 2017 can be revisited > now that we start having quite a few platforms and more coming. What > Arnd suggests isn't without merits, it would indeed turn the generic > code into generic helpers, and have all the platform IDs maintained in > device-specific drivers. It's a more distributed/scalable solution, > the only minor drawback I see is that it would require multiple > instances of the 'platform_driver' and 'pci_driver' structures. > > I would also want to keep the top-level selection so that ACPI/PCI/DT > modules can be disabled in one shot, that would mean an additional > change to the Makefiles since e.g. > obj-$(CONFIG_SND_SOC_SOF_ACPI) += snd-sof-acpi.o > would need to be set somehow. > > Since this is going to be a really invasive change, and past > experience shows that mucking with Kconfigs will invariably raise a > number of broken corner cases, if there is support from > Mark/Takashi/Jaroslav on this idea, we should first test it in the SOF > tree so that we get a good test coverage and don't break too many eggs > in Mark's tree. We would also need to concurrently change our CI > scripts which are dependent on module names. I'm in favor of the way Arnd proposed. It's more straightforward and less code. If you find the number of modules or the too much cutting out being problematic, you can create a module snd-sof-intel-acpi and snd-sof-intel-pci containing the driver table entries for all Intel devices, too. In the case, you'll still need some conditional calls of intel-dsp-config there, but it's a good step for reducing the Kconfig complexity. > Also maybe in a first pass we can remove the compilation error with > IS_REACHABLE and in a second pass do more invasive surgery? Agreed, we'd like to keep less changes for 5.11 for now. thanks, Takashi