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 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 smtp.lore.kernel.org (Postfix) with ESMTPS id E7B9BC6FD1D for ; Thu, 30 Mar 2023 18:09:07 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id DDA761F1; Thu, 30 Mar 2023 20:08:14 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz DDA761F1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1680199745; bh=cVw8JXoZRN+rSdxi5i2rHI8PmRS2PgvMeP5kpfl77EY=; h=Date:From:To:Subject:In-Reply-To:References:CC:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=WNZJ3gEl8HNv0krG1hZXEJZ5Crt1qvpTZa34JCRpioz0lEHqUANhHB57Y8hpwINuq 4obmwGOfSG3FnaQG8hGS9SifoyEM5fvHvOW3rF94pxJF23zWqtqfs+43Q4Ekq6gJBq MReOrHA9mIA9xgG6IItDbUpjg/TMqfEoeAoTrsqQ= Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id 73F80F80272; Thu, 30 Mar 2023 20:07:52 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 837D0F80272; Thu, 30 Mar 2023 20:07:46 +0200 (CEST) Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 5D154F8021D for ; Thu, 30 Mar 2023 20:07:36 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 5D154F8021D Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key, unprotected) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=QH3Jz27w; dkim=pass header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=1hqCOB8j 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 1A6CA1FE07; Thu, 30 Mar 2023 18:07:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1680199656; 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=Jo1Aor4tqA3fdyWQL/gwsRBsv7yVYYlpT1qru+qjKoI=; b=QH3Jz27wHu0a57A25v1yTbhy1rEIuRQl6HYE0bWfeE4YDZ9HGk2Eo7BNgJOPhkjGOHKmaR YP5PuXM2q6JKJDq4d3T3UPtOa/lw0hW3iw5danyH9VVsl9oCV8AgeRqnTavbsgH2+Xdf1j f6CJ1MXXpzQZo7B80qCL+RcVaA+gxJE= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1680199656; 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=Jo1Aor4tqA3fdyWQL/gwsRBsv7yVYYlpT1qru+qjKoI=; b=1hqCOB8jOmeGBrGEopzrO1QZ8K5fQAURlewZR9YxehFyx1/t6bYHflomIcj2iIdQE1uJqZ /P2rMrpjTDkicBCQ== 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 6B45E1348E; Thu, 30 Mar 2023 18:07:35 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id 83mgF+fPJWQcHQAAMHmgww (envelope-from ); Thu, 30 Mar 2023 18:07:35 +0000 Date: Thu, 30 Mar 2023 20:07:32 +0200 Message-ID: <87355mkt97.wl-tiwai@suse.de> From: Takashi Iwai To: Pierre-Louis Bossart Subject: Re: [PATCH 06/18] ASoC: SOF: Intel: hda-mlink: add structures to parse ALT links In-Reply-To: <146f6100-9f99-f463-603c-332c5b9d9eef@linux.intel.com> References: <20230327112931.23411-1-peter.ujfalusi@linux.intel.com> <20230327112931.23411-7-peter.ujfalusi@linux.intel.com> <87bkkakzk2.wl-tiwai@suse.de> <146f6100-9f99-f463-603c-332c5b9d9eef@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 Message-ID-Hash: SZ6E57PFVLGTSNOH67BKFQ2RTA5TCQZO X-Message-ID-Hash: SZ6E57PFVLGTSNOH67BKFQ2RTA5TCQZO X-MailFrom: tiwai@suse.de X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-alsa-devel.alsa-project.org-0; header-match-alsa-devel.alsa-project.org-1; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: Peter Ujfalusi , lgirdwood@gmail.com, broonie@kernel.org, alsa-devel@alsa-project.org, ranjani.sridharan@linux.intel.com, kai.vehmanen@linux.intel.com, rander.wang@intel.com X-Mailman-Version: 3.3.8 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: On Thu, 30 Mar 2023 18:09:36 +0200, Pierre-Louis Bossart wrote: > > > > On 3/30/23 10:51, Takashi Iwai wrote: > > On Mon, 27 Mar 2023 13:29:19 +0200, > > Peter Ujfalusi wrote: > >> > >> int hda_bus_ml_get_capabilities(struct hdac_bus *bus) > >> { > >> - if (bus->mlcap) > >> - return snd_hdac_ext_bus_get_ml_capabilities(bus); > >> + u32 link_count; > >> + int ret; > >> + int i; > >> + > >> + if (!bus->mlcap) > >> + return 0; > >> + > >> + link_count = readl(bus->mlcap + AZX_REG_ML_MLCD) + 1; > >> + > >> + dev_dbg(bus->dev, "HDAudio Multi-Link count: %d\n", link_count); > >> + > >> + for (i = 0; i < link_count; i++) { > >> + ret = hda_ml_alloc_h2link(bus, i); > >> + if (ret < 0) { > >> + hda_bus_ml_free(bus); > >> + return ret; > >> + } > >> + } > >> return 0; > > > > This makes that each call of hda_bus_ml_get_capabilities() adds the > > h2link entries blindly. If the driver calls it multiple times > > mistakenly (the function name sounds as if it's just a helper to query > > the capability bits), it'll lead to doubly entries. Maybe adding some > > check would be safer, IMO. > > Interesting comment, I didn't think of that one. > > This function is currently called in the probe and indirectly via > hda_init_caps(). I think the driver framework guarantees the probe is > only called once, doesn't it? > > we can also rename this function to make it clearer if there are any > suggestions, but the name is aligned with previous implementations of > the snd_hdac_ext stuff. Yeah, naming it as an init function would avoid the misuse. Takashi