[alsa-devel] [PATCH] ASoC: Avoid recalculating the bitmask for SOC_ENUM controls

Peter Ujfalusi peter.ujfalusi at ti.com
Fri Sep 14 14:10:56 CEST 2012


On 09/14/2012 02:57 PM, Lars-Peter Clausen wrote:
> For ENUM controls the bitmask is calculated based on the number of items.
> Currently this is done each time the control is accessed. And while the
> performance impact of this should be negligible we can easily do better. The
> roundup_pow_of_two macro performs the same calculation which is currently done
> manually, but it is also possible to use this macro with compile time constants
> and so it can be used to initialize static data. So we can use it to initialize
> the mask field of a ENUM control during its declaration.
> 
> Signed-off-by: Lars-Peter Clausen <lars at metafoo.de>
> ---
>  include/sound/soc.h        |    4 +++-
>  sound/soc/codecs/twl4030.c |    8 +++-----
>  sound/soc/soc-core.c       |   16 ++++++----------
>  sound/soc/soc-dapm.c       |   22 ++++++++--------------
>  4 files changed, 20 insertions(+), 30 deletions(-)

Looks good, for the twl4030 part:
Acked-by: Peter Ujfalusi <peter.ujfalusi at ti.com>




More information about the Alsa-devel mailing list