Skip to content
Commit bc1043cd authored by Lars-Peter Clausen's avatar Lars-Peter Clausen Committed by Takashi Iwai
Browse files

ALSA: Add helper function to add single value constraint



The recommended and most efficient way to constraint a configuration
parameter to a single value is to set the minimum and maximum allowed
values to the same value, i.e. calling snd_pcm_hw_constraint_minmax() with
the same value for min and max.

It is not necessarily obvious though that this is the approach that should
be taken and some drivers have come up with other ways of solving this
problem, e.g. installing a list constraint with a single item. List
constraints are dynamic constraints though and hence less efficient than
the static min-max constraint.

This patch introduces a new helper function called
snd_pcm_hw_constraint_single() which only takes a single value has the same
effect as calling snd_pcm_hw_constraint_minmax() with the same values for
min and max. But it is hopefully semantically more expressive, making it
clear that this is the preferred way of setting a single value constraint.

Signed-off-by: default avatarLars-Peter Clausen <lars@metafoo.de>
Acked-by: default avatarMark Brown <broonie@kernel.org>
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent 7379047d
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment