[alsa-devel] [PATCH 5/6] compress: add the core file

Takashi Iwai tiwai at suse.de
Wed Nov 30 12:41:41 CET 2011


At Wed, 30 Nov 2011 16:59:18 +0530,
Vinod Koul wrote:
> 
> On Wed, 2011-11-30 at 12:19 +0100, Takashi Iwai wrote:
> > At Tue, 29 Nov 2011 15:15:01 -0600,
> > Pierre-Louis Bossart wrote:
> > Well, my question is much more simple.  In the patch, there are checks
> > of the stream direction in snd_compr_{fragment|frame}_elapsed()
> > functions.
> > 
> > +void snd_compr_fragment_elapsed(struct snd_compr_stream *stream)
> > +{
> > +	pr_debug("fragment elapsed called\n");
> > +	if (stream->direction !=  SNDRV_DEVICE_TYPE_COMPR_PLAYBACK)
> > +		return;
> > +	wake_up(&stream->runtime->sleep);
> > +}
> > +EXPORT_SYMBOL_GPL(snd_compr_fragment_elapsed);
> > +
> > +void snd_compr_frame_elapsed(struct snd_compr_stream *stream)
> > +{
> > +	if (stream->direction != SNDRV_DEVICE_TYPE_COMPR_CAPTURE)
> > +		return;
> > +	wake_up(&stream->runtime->sleep);
> > +}
> > +EXPORT_SYMBOL_GPL(snd_compr_frame_elapsed);
> > 
> > And I wonder why this restriction *must* be present in the API-level
> > implementation.
> > 
> > And, furthermore, I see no reason to have this individual functions.
> > Why simply not an inline function like
> > 
> > static inline void snd_compr_stream_elapsed(struct snd_compr_stream *stream)
> > {
> > 	wake_up(&stream->runtime->sleep);
> > }
> > 
> > ??  Then you can reduce two exported symbols and less stack usages.
> > 
> Thanks, I have already changed this as above based on your suggestion
> last week :)
> 
> But I have kept two different functions doing same thing for sake of
> confusion. For playback you need to call this on
> block/fragment/random_bytes but for capture it needs to be frame based.

That's what I don't understand.  Why the calls must be different?
It just wakes up.  Nothing else.  It doesn't matter whether it's based
on which.


Takashi


More information about the Alsa-devel mailing list