[alsa-devel] [PATCH 5/6] compress: add the core file
Vinod Koul
vinod.koul at linux.intel.com
Wed Nov 30 12:29:18 CET 2011
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.
--
~Vinod
More information about the Alsa-devel
mailing list