• L
    ASoC: dapm: Simplify list creation in dapm_dai_get_connected_widgets() · 1ce43acf
    Lars-Peter Clausen 提交于
    When running dapm_dai_get_connected_widgets() currently in
    is_connected_{input,output}_ep() for each widget that gets added the array
    is resized and the code also loops over all existing entries to avoid
    adding a widget multiple times.
    
    The former can be avoided by collecting the widgets in a linked list and
    only once we have all widgets allocate the array.
    
    The later can be avoided by changing when the widget is added. Currently it
    is added when walking the neighbor lists of a widget. Since a widget can be
    neighbors with multiple other widgets it could get added twice and hence
    the check is necessary. But the main body of is_connected_{input,output}_ep
    is guaranteed to be only executed at most once per widget. So adding the
    widget to the list at the beginning of the function automatically makes
    sure that each widget gets only added once. The only difference is that
    using this method the starting point itself will also end up on the list,
    but it can easily be skipped when creating the array.
    
    Overall this reduces the code size and speeds things slightly up.
    Signed-off-by: NLars-Peter Clausen <lars@metafoo.de>
    Signed-off-by: NMark Brown <broonie@kernel.org>
    1ce43acf
soc-dapm.c 104.1 KB