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 X-Spam-Level: X-Spam-Status: No, score=-8.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 29145C433E0 for ; Sat, 23 Jan 2021 08:09:44 +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 295A023A5B for ; Sat, 23 Jan 2021 08:09:41 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 295A023A5B Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=suse.de Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=alsa-devel-bounces@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 EF9C01AB4; Sat, 23 Jan 2021 09:08:48 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz EF9C01AB4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1611389379; bh=cFM6FXVnpAmZmbm+U1v7dulbNqT5h6aRmKfljVLcJzw=; h=Date:From:To:Subject:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=eQZpa3m3HwtTxtfVuZ/ho+jC2TN4yY6SbwzmToBmA2hHK2Mg3RICxpk40T1CT2Fpb uDFcfAmHoSTmP1QuPygsEzsjnIOfs4NkS9WTBb+Yvx9ZeJWw+hEVgTu/tYHp6BL5xM Sk77nzj7gQrubVjeaxBIrQRXgkweVXryeuwHlN+Y= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 4AD03F80255; Sat, 23 Jan 2021 09:08:48 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 09908F80257; Sat, 23 Jan 2021 09:08:46 +0100 (CET) Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id C548AF80083 for ; Sat, 23 Jan 2021 09:08:38 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz C548AF80083 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 39D8BB7CE; Sat, 23 Jan 2021 08:08:38 +0000 (UTC) Date: Sat, 23 Jan 2021 09:08:37 +0100 Message-ID: From: Takashi Iwai To: Arnd Bergmann Subject: Re: [PATCH 2/2] ASoC: SOF: SND_INTEL_DSP_CONFIG dependency In-Reply-To: References: <20210122005725.94163-1-pierre-louis.bossart@linux.intel.com> <20210122005725.94163-3-pierre-louis.bossart@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 Cc: Vinod Koul , ALSA Development Mailing List , Mark Brown , Pierre-Louis Bossart , Arnd Bergmann 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 Fri, 22 Jan 2021 19:33:27 +0100, Arnd Bergmann wrote: > > On Fri, Jan 22, 2021 at 4:38 PM Pierre-Louis Bossart > wrote: > > >> The sof-pci-dev driver fails to link when built into the kernel > > >> and CONFIG_SND_INTEL_DSP_CONFIG is set to =m: > > >> > > >> arm-linux-gnueabi-ld: sound/soc/sof/sof-pci-dev.o: in function `sof_pci_probe': > > >> sof-pci-dev.c:(.text+0x1c): undefined reference to `snd_intel_dsp_driver_probe' > > >> > > >> As a temporary fix, use IS_REACHABLE to prevent the problem from > > >> happening. A more complete solution is to move this code to > > >> Intel-specific parts, restructure the drivers and Kconfig as discussed > > >> with Arnd Bergmann and Takashi Iwai. > > >> > > >> Fixes: 82d9d54a6c0e ("ALSA: hda: add Intel DSP configuration / probe code") > > >> Reported-by: Arnd Bergmann > > >> Signed-off-by: Pierre-Louis Bossart > > > > > > This might not be good enough. The code may still refer to the > > > snd_intel_dsp_probe() symbol even if IS_REACHABLE() is false > > > (although, practically seen, gcc should optimize it out). > > > > > > You need #if IS_REACHABLE() instead of the plain if. > > > Then you don't need to change the indentation, and the patch will be > > > eventually smaller, too :) > > > > I used the if() on purpose since in the past you mentioned #if/#endif > > are ugly. There are plenty of other cases in the kernel code where if( > > IF_REACHABLE(CONFIG_XYZ)) is used... > > Dead-code-elimination in both gcc and clang is reliable for all supported > versions (there were problems in gcc-4.1 and before), and generally the > "if (IS_ENABLED())" form is nicer than the "#if IS_ENABLED()" form > because it produces better compile-time coverage. Heh, my trust to the compiler isn't that high, but other than that, it's a matter of taste. I agree that if() fits often better in general, especially when the more code is involved. But, in this particular case, the covered area is small (hence optimization doesn't matter) and we want to show it rather clearer as a temporary workaround (that shall be deleted in the next kernel). Finally, the changes needed by #ifdef are smaller. That's why I suggested #ifdef. But that's nothing but a bike shed topic, and I don't mind either way as long as the code really works in all cases. thanks, Takashi