Alsa-Devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Takashi Iwai <tiwai@suse.de>
To: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Cc: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>,
	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
Subject: Re: [PATCH 06/18] ASoC: SOF: Intel: hda-mlink: add structures to parse ALT links
Date: Thu, 30 Mar 2023 20:07:32 +0200	[thread overview]
Message-ID: <87355mkt97.wl-tiwai@suse.de> (raw)
In-Reply-To: <146f6100-9f99-f463-603c-332c5b9d9eef@linux.intel.com>

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

  reply	other threads:[~2023-03-30 18:09 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-27 11:29 [PATCH 00/18] ASoC: SOF: Intel: hda-mlink: HDaudio multi-link extension update Peter Ujfalusi
2023-03-27 11:29 ` [PATCH 01/18] Documentation: sound: add description of Intel HDaudio multi-links Peter Ujfalusi
2023-03-27 11:29 ` [PATCH 02/18] ALSA: hda: add HDaudio Extended link definitions Peter Ujfalusi
2023-03-27 11:29 ` [PATCH 03/18] ASoC: SOF: Intel: hda-mlink: improve hda_bus_ml_free() helper Peter Ujfalusi
2023-03-27 11:29 ` [PATCH 04/18] ASoC: SOF: Intel: hda-mlink: add return value for hda_bus_ml_get_capabilities() Peter Ujfalusi
2023-03-27 11:29 ` [PATCH 05/18] ASoC: SOF: Intel: hda-mlink: move to a dedicated module Peter Ujfalusi
2023-03-27 11:29 ` [PATCH 06/18] ASoC: SOF: Intel: hda-mlink: add structures to parse ALT links Peter Ujfalusi
2023-03-30 15:51   ` Takashi Iwai
2023-03-30 16:09     ` Pierre-Louis Bossart
2023-03-30 18:07       ` Takashi Iwai [this message]
2023-03-31  3:05         ` Pierre-Louis Bossart
2023-03-27 11:29 ` [PATCH 07/18] ASoC: SOF: Intel: hda-mlink: special-case HDaudio regular links Peter Ujfalusi
2023-03-27 11:29 ` [PATCH 08/18] ASoC: SOF: Intel: hda-mlink: introduce helpers for 'extended links' PM Peter Ujfalusi
2023-03-28 10:34   ` Amadeusz Sławiński
2023-03-28 13:24     ` Pierre-Louis Bossart
2023-03-30 11:42       ` Amadeusz Sławiński
2023-03-30 15:54   ` Takashi Iwai
2023-03-30 16:22     ` Pierre-Louis Bossart
2023-03-27 11:29 ` [PATCH 09/18] ASoC: SOF: Intel: hda-mlink: add convenience helpers for SoundWire PM Peter Ujfalusi
2023-03-27 11:29 ` [PATCH 10/18] ASoC: SOF: Intel: hda-mlink: add helper to return sublink count Peter Ujfalusi
2023-03-27 11:29 ` [PATCH 11/18] ASoC: SOF: Intel: hda-mlink: add helpers to enable/check interrupts Peter Ujfalusi
2023-03-27 11:29 ` [PATCH 12/18] ASoC: SOF: Intel: hda-mlink: add helpers to set link SYNC frequency Peter Ujfalusi
2023-03-27 11:29 ` [PATCH 13/18] ASoC: SOF: Intel: hda-mlink: add helpers for sync_arm/sync_go Peter Ujfalusi
2023-03-27 11:29 ` [PATCH 14/18] ASoC: SOF: Intel: hda-mlink: add helper to check cmdsync Peter Ujfalusi
2023-03-27 11:29 ` [PATCH 15/18] ASoC: SOF: Intel: hda-mlink: program SoundWire LSDIID registers Peter Ujfalusi
2023-03-27 11:29 ` [PATCH 16/18] ASoC: SOF: Intel: hda-mlink: add helpers to retrieve DMIC/SSP hlink Peter Ujfalusi
2023-03-27 11:29 ` [PATCH 17/18] ASoC: SOF: Intel: hda-mlink: add helper to offload link ownership Peter Ujfalusi
2023-03-27 11:29 ` [PATCH 18/18] ASoC: SOF: Intel: hda-mlink: add helper to retrieve eml_lock Peter Ujfalusi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87355mkt97.wl-tiwai@suse.de \
    --to=tiwai@suse.de \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=kai.vehmanen@linux.intel.com \
    --cc=lgirdwood@gmail.com \
    --cc=peter.ujfalusi@linux.intel.com \
    --cc=pierre-louis.bossart@linux.intel.com \
    --cc=rander.wang@intel.com \
    --cc=ranjani.sridharan@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox