Received: by 2002:a05:6358:7058:b0:131:369:b2a3 with SMTP id 24csp6607356rwp; Tue, 18 Jul 2023 03:11:38 -0700 (PDT) X-Google-Smtp-Source: APBJJlHe2xiSvUJIrq7NNJK7zkSbfggCuqdYPjPjSm1Zyw2LCiLL3IR9JqoBhtNrmnPWH0GFF1w4 X-Received: by 2002:a17:902:d3cc:b0:1b8:1e05:ed09 with SMTP id w12-20020a170902d3cc00b001b81e05ed09mr1493010plb.36.1689675098512; Tue, 18 Jul 2023 03:11:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689675098; cv=none; d=google.com; s=arc-20160816; b=AlkVwVDq9NKaFXmsyIYTpIf7PYM21N+KnGN33pntHASufARPIBQZR/LjMl/Ygn2FLs s6U5gSteD2egRu2sR0tPtpCYMUg4vat3wd8DbSdc9HIXAdJekC2LCN64JnclhndhP8Uk N97IoGWb+jimKkkWbtAkZZqoPFFmD9ZxHNtCdAWfcbm2zi2IB8jiIyGZRgEEGoTvJMQd N793fdQKonojllOKlvRfQ3NqOJvPnTvlaQZgTi/ZNiB17036LVcjxvwBqwNWibRCUJWc T0WxgM0SvwdcazczjaXqSmnx+l5KraIDn081JTbJu5e9ZEN1We7VFdYXTimjoK8/3pf1 xaFw== 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:dkim-signature:dkim-signature; bh=lwIxpcfnyfN+KZS/1z2ZFiDuJVrbeqjicTOWKPtxSG0=; fh=1/NIQCDXuSTN/p5UTl8yTdoxUe2XNha5jbtKJN986X8=; b=YzmsMv5UCE/GdjSHyEIMj1t1FxUbewnjlCi+7tBeiIyQKZKpsYqqfOVeDlSY3L+ect XnVJw4uvTeNqbcsgbLuhcM43B1nL7akyAHS89BEsfkUWVpoCkr0YHPqaxH29rCNC2+sC 56CcZ0xoMqKmUyMAfasK+Wf6RHsZeVQ4U0povPRzoSAf/p70kOo/ytzlPvluacJPnbOu RT/a6GUg0JEqKP/bVKdQENwALLFXnxc5DOkARhDF87I/18O3HA2QiGoVJps7Snvy3Nor FFMhtDIjI7NkgvKCc711tOf31QAsUD2aQAE1XT6/XIwPgTFUw7RoxMKYZaHhuRMRo1rI 0SXg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=Zog+VIVW; dkim=neutral (no key) header.i=@suse.de; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l14-20020a170902f68e00b001bb0ff2b354si1509127plg.425.2023.07.18.03.11.24; Tue, 18 Jul 2023 03:11:38 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=Zog+VIVW; dkim=neutral (no key) header.i=@suse.de; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230500AbjGRJ7V (ORCPT + 99 others); Tue, 18 Jul 2023 05:59:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52834 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230515AbjGRJ66 (ORCPT ); Tue, 18 Jul 2023 05:58:58 -0400 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DEF3BE4F for ; Tue, 18 Jul 2023 02:57:56 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 55FAE1F461; Tue, 18 Jul 2023 09:57:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1689674275; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=lwIxpcfnyfN+KZS/1z2ZFiDuJVrbeqjicTOWKPtxSG0=; b=Zog+VIVWq11HVDTBNsOYrxvvKRdCA8JWasflPIKt3qpnx6IrhjnR+9Wzfm4+3q9bn3rIQX PnTPWKf/qfPWBlOY13CX103A5wTR8IgYvKj9m1EMVqCaUPTVFQo99xH9Sn7FY5+LzoQFGK X+KETTWAWdfyQ7pIym92oHjr1YlFoHU= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1689674275; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=lwIxpcfnyfN+KZS/1z2ZFiDuJVrbeqjicTOWKPtxSG0=; b=syDuMOgOIwBZCCOsED6KHN1Zknk1kspsD4yZpBAYUa4WndhNcKfD0tQ+9fd/ymSZFV2wdO IMF7eSlodqIsMTDA== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 06E0D134B0; Tue, 18 Jul 2023 09:57:55 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id wTeiACNitmQzcwAAMHmgww (envelope-from ); Tue, 18 Jul 2023 09:57:55 +0000 Date: Tue, 18 Jul 2023 11:57:54 +0200 Message-ID: <87h6q1o82l.wl-tiwai@suse.de> From: Takashi Iwai To: Maarten Lankhorst Cc: alsa-devel@alsa-project.org, sound-open-firmware@alsa-project.org, linux-kernel@vger.kernel.org, Jaroslav Kysela , Takashi Iwai , Cezary Rojewski , Pierre-Louis Bossart , Liam Girdwood , Peter Ujfalusi , Bard Liao , Ranjani Sridharan , Kai Vehmanen , Mark Brown , Daniel Baluta Subject: Re: [PATCH 5/7] ALSA: hda/intel: Move snd_hdac_i915_init to before probe_work. In-Reply-To: <20230718084522.116952-6-maarten.lankhorst@linux.intel.com> References: <20230718084522.116952-1-maarten.lankhorst@linux.intel.com> <20230718084522.116952-6-maarten.lankhorst@linux.intel.com> User-Agent: Wanderlust/2.15.9 (Almost Unreal) Emacs/27.2 Mule/6.0 MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=US-ASCII X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 18 Jul 2023 10:45:20 +0200, Maarten Lankhorst wrote: > > Now that we can use -EPROBE_DEFER, it's no longer required to spin off > the snd_hdac_i915_init into a workqueue. > > Use the -EPROBE_DEFER mechanism instead, which must be returned in the > probe function. > > Signed-off-by: Maarten Lankhorst > --- > sound/pci/hda/hda_intel.c | 58 +++++++++++++++++++++------------------ > 1 file changed, 31 insertions(+), 27 deletions(-) > > diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c > index 5af1138e745bc..d40345a0088d8 100644 > --- a/sound/pci/hda/hda_intel.c > +++ b/sound/pci/hda/hda_intel.c > @@ -213,6 +213,7 @@ MODULE_DESCRIPTION("Intel HDA driver"); > #endif > #endif > > +static DECLARE_BITMAP(probed_devs, SNDRV_CARDS); > > /* > */ > @@ -2094,8 +2095,6 @@ static const struct hda_controller_ops pci_hda_ops = { > .position_check = azx_position_check, > }; > > -static DECLARE_BITMAP(probed_devs, SNDRV_CARDS); > - > static int azx_probe(struct pci_dev *pci, > const struct pci_device_id *pci_id) > { Any specific reason to move the definition? Otherwise let's concentrate on the needed change. > @@ -2174,7 +2173,36 @@ static int azx_probe(struct pci_dev *pci, > } > #endif /* CONFIG_SND_HDA_PATCH_LOADER */ > > -#ifndef CONFIG_SND_HDA_I915 > +#ifdef CONFIG_SND_HDA_I915 > + /* bind with i915 if needed */ > + if (chip->driver_caps & AZX_DCAPS_I915_COMPONENT) { > + err = snd_hdac_i915_init(azx_bus(chip), false); > + if (err < 0) { > + /* if the controller is bound only with HDMI/DP > + * (for HSW and BDW), we need to abort the probe; > + * for other chips, still continue probing as other > + * codecs can be on the same link. > + */ > + if (CONTROLLER_IN_GPU(pci)) { > + if (err != -EPROBE_DEFER) > + dev_err(card->dev, > + "HSW/BDW HD-audio HDMI/DP requires binding with gfx driver\n"); > + > + clear_bit(chip->dev_index, probed_devs); > + pci_set_drvdata(pci, NULL); > + snd_device_free(card, chip); > + return err; This may leak resources, I'm afraid. Here you just need to "goto out_free;" instead of manual resource releases, which eventually calls snd_card_free(), and that's all. (Though, pci_set_drvdata(pci, NULL) might be still missing; but it's not only for this change, and we'll need to address it in another patch.) thanks, Takashi