[PATCH 1/2] ASoC: soc-compress: tidyup STREAM vs COMPRESS

Takashi Iwai tiwai at suse.de
Thu Oct 29 17:47:53 CET 2020


On Thu, 29 Oct 2020 16:33:35 +0100,
Pierre-Louis Bossart wrote:
> 
> 
> 
> 
> >>>> enum snd_compr_direction {
> >>>> 	SND_COMPRESS_PLAYBACK = SNDRV_PCM_STREAM_PLAYBACK,
> >>>> 	SND_COMPRESS_CAPTURE = SNDRV_PCM_STREAM_CAPTURE
> >>>> };
> >>>>
> >>>> Or remove this duplication completely and get rid of snd_compr_direction?
> >>>>
> >>>> I find it odd to convert two things that had no reason to be different
> >>>> in the first place.
> >>>
> >>> Yes I agree with you.
> >>> I'm not sure why this duplication was created,
> >>> but my patch tried to make it sane.
> >>> If Mark can agree, I can post snd_compr_direction remove patch.
> >>
> >> Oops, snd_compr_direction was uapi.
> >> We can't remove it, and can't use your above suggestion...
> 
> I knew I was missing something... Thanks for correcting my flawed assertion.
> 
> > Right, such uapi can't be removed.
> >
> > Essentially both compress and PCM definitions are identical, and can
> > be never different because of ABI compatibility, which means it's safe
> > to mix both variants in the code.  If you're unsure, we may add
> > BUILD_BUG_ON() to check the coincidence of both values.
> 
> 
> In case we add this BUILD_BUG_ON(), can we keep the code as is then,
> there's no need to convert values?

Unless any strong type is used, it should be fine as is.
BUILD_BUG_ON() would catch if the value is changed inconsistently.


thanks,

Takashi


More information about the Alsa-devel mailing list