From: Takashi Iwai Subject: Re: [PATCH 3/5] ALSA: hdac: Add snd_hdac_get_hdac_stream() Date: Fri, 21 Aug 2015 18:35:09 +0200 Message-ID: References: <1440173181-3150-1-git-send-email-vinod.koul@intel.com> <1440173181-3150-4-git-send-email-vinod.koul@intel.com> Mime-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by alsa0.perex.cz (Postfix) with ESMTP id D8F45265A1B for ; Fri, 21 Aug 2015 18:35:10 +0200 (CEST) In-Reply-To: <1440173181-3150-4-git-send-email-vinod.koul@intel.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org To: Vinod Koul Cc: liam.r.girdwood@linux.intel.com, patches.audio@intel.com, alsa-devel@alsa-project.org, broonie@kernel.org, Jeeja KP List-Id: alsa-devel@alsa-project.org On Fri, 21 Aug 2015 18:06:19 +0200, Vinod Koul wrote: > > From: Jeeja KP > > Add a helper to find the stream using stream tag and direction. > This is useful for drivers to query stream based on stream tag and > direction, fox example while downloading FW thru DSP loader code > > Signed-off-by: Jeeja KP > Signed-off-by: Vinod Koul > --- > include/sound/hdaudio.h | 2 ++ > sound/hda/hdac_stream.c | 19 +++++++++++++++++++ > 2 files changed, 21 insertions(+) > > diff --git a/include/sound/hdaudio.h b/include/sound/hdaudio.h > index e37c3355ae8a..67f7068696b9 100644 > --- a/include/sound/hdaudio.h > +++ b/include/sound/hdaudio.h > @@ -438,6 +438,8 @@ void snd_hdac_stream_init(struct hdac_bus *bus, struct hdac_stream *azx_dev, > struct hdac_stream *snd_hdac_stream_assign(struct hdac_bus *bus, > struct snd_pcm_substream *substream); > void snd_hdac_stream_release(struct hdac_stream *azx_dev); > +struct hdac_stream *snd_hdac_get_hdac_stream(struct hdac_bus *bus, > + int dir, int stream_tag); > > int snd_hdac_stream_setup(struct hdac_stream *azx_dev); > void snd_hdac_stream_cleanup(struct hdac_stream *azx_dev); > diff --git a/sound/hda/hdac_stream.c b/sound/hda/hdac_stream.c > index 4c15d0accc9e..02aed2e85504 100644 > --- a/sound/hda/hdac_stream.c > +++ b/sound/hda/hdac_stream.c > @@ -286,6 +286,25 @@ void snd_hdac_stream_release(struct hdac_stream *azx_dev) > } > EXPORT_SYMBOL_GPL(snd_hdac_stream_release); > > +/** > + * snd_hdac_get_hdac_stream - return hdac_stream based on stream_tag and > + * direction > + * > + * @bus: HD-audio core bus > + */ Please complete the description. > +struct hdac_stream *snd_hdac_get_hdac_stream(struct hdac_bus *bus, > + int dir, int stream_tag) > +{ > + struct hdac_stream *s; > + > + list_for_each_entry(s, &bus->stream_list, list) { > + if (s->direction == dir && s->stream_tag == stream_tag) > + return s; > + } > + > + return NULL; > +} > +EXPORT_SYMBOL_GPL(snd_hdac_get_hdac_stream); > /* Put the empty line after EXPORT_SYMBOL_GPL(). thanks, Takashi