Alsa-Devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Takashi Iwai <tiwai@suse.de>
To: Vinod Koul <vinod.koul@intel.com>
Cc: liam.r.girdwood@linux.intel.com, patches.audio@intel.com,
	alsa-devel@alsa-project.org, broonie@kernel.org,
	Jeeja KP <jeeja.kp@intel.com>
Subject: Re: [PATCH v8 2/3] ALSA: hdac_ext: add hdac extended controller
Date: Wed, 10 Jun 2015 20:41:08 +0200	[thread overview]
Message-ID: <s5hr3pj8kzf.wl-tiwai@suse.de> (raw)
In-Reply-To: <1433941562-5778-3-git-send-email-vinod.koul@intel.com>

At Wed, 10 Jun 2015 18:36:01 +0530,
Vinod Koul wrote:
> 
> +/**
> + * snd_hdac_ext_bus_get_link_index - get link based on codec name
> + * @ebus: HD-audio extended core bus
> + * @codec_name: codec name
> + */
> +struct hdac_ext_link *snd_hdac_ext_bus_get_link(struct hdac_ext_bus *ebus,
> +						 const char *codec_name)
> +{
> +	int i;
> +	struct hdac_ext_link *hlink = NULL;
> +	char name[32];
> +
> +	list_for_each_entry(hlink, &ebus->hlink_list, list) {
> +		for (i = 0; i < HDA_MAX_CODECS; i++) {
> +			snprintf(name, sizeof(name), "codec#%03x", hlink->codec[i]);
> +			if (!strncmp(name, codec_name, strlen(codec_name)))
> +				return hlink;

Is this name supposed to be identical with the string the patch 1
sets?  If so, this looks incompatible.

Also, it'd be easier to parse the string only once like:

	int bus_idx, addr;

	if (sscanf(codec_name, "ehdaudio%dD%d", &bus_idx, &addr) != 2)
		return NULL;
	if (ebus->index != bus_idx)
		return NULL;
	list_for_each_entry(hlink, &ebus->hlink_list, list)
		if (hlink->lsdiid && (0x1 << addr))
			return hlink;

	return NULL;
		

Takashi

  reply	other threads:[~2015-06-10 18:41 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-10 13:05 [PATCH v8 0/3] HDA: add extended HDA Vinod Koul
2015-06-10 13:06 ` [PATCH v8 1/3] ALSA: hdac_ext: add extended HDA bus Vinod Koul
2015-06-10 13:06 ` [PATCH v8 2/3] ALSA: hdac_ext: add hdac extended controller Vinod Koul
2015-06-10 18:41   ` Takashi Iwai [this message]
2015-06-11  3:43     ` Vinod Koul
2015-06-11  4:18       ` Vinod Koul
2015-06-10 13:06 ` [PATCH v8 3/3] ALSA: hdac_ext: add extended stream capabilities Vinod Koul

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=s5hr3pj8kzf.wl-tiwai@suse.de \
    --to=tiwai@suse.de \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=jeeja.kp@intel.com \
    --cc=liam.r.girdwood@linux.intel.com \
    --cc=patches.audio@intel.com \
    --cc=vinod.koul@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