All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mark Brown <broonie@kernel.org>
To: Lars-Peter Clausen <lars@metafoo.de>
Cc: alsa-devel@alsa-project.org, patches@opensource.wolfsonmicro.com,
	Liam Girdwood <lgirdwood@gmail.com>
Subject: Re: [PATCH 4/5] ASoC: dapm: Consolidate input and output path handling
Date: Wed, 29 Jul 2015 14:14:39 +0100	[thread overview]
Message-ID: <20150729131439.GF20130@sirena.org.uk> (raw)
In-Reply-To: <1437930302-2789-4-git-send-email-lars@metafoo.de>


[-- Attachment #1.1: Type: text/plain, Size: 2888 bytes --]

On Sun, Jul 26, 2015 at 07:05:01PM +0200, Lars-Peter Clausen wrote:

> Testing on ARM shows that the combined code size of the specialized
> functions is about 50% larger than the generlized function in relative
> numbers. But in absolute numbers its less than 200 bytes, which is still
> quite small. On the other hand the generalized function increases the
> execution time of dapm_power_one_widget() by 30%. Given that this function
> is one of the most often called functions of the DAPM framework the
> tradeoff seems to be worth it.

This reads like you mean to say that it's worth it to combine things in
spite of the 30% speed hit...  you're not clear which tradeoff you mean.

> To avoid this still keep two versions of these functions around, one for
> input and one for output. But have a generic implementation of the
> algorithm which gets inlined by those two versions and then let the
> compiler take care of optimizing it into specialized versions.

...which the compiler presumably actually manages to do.

> --- a/include/sound/soc-dapm.h
> +++ b/include/sound/soc-dapm.h

> +/**
> + * snd_soc_dapm_widget_for_each_sink_path - Iterates over all paths in the
> + *   specified direction of a widget
> + * @w: The widget
> + * @dir: Whether to iterate over the paths where the specified widget is the
> + *       incoming or outgoing widgets
> + * @p: The path iterator variable
> + */
> +#define snd_soc_dapm_widget_for_each_path(w, dir, p) \
> +	list_for_each_entry(p, &w->edges[dir], list_node[dir])

This is a macro not a static inline?  The other macros that use this are
macros but that's more outdated code than anything I think, might be
worth fixing that while we're at it.

>  #define DAPM_UPDATE_STAT(widget, val) widget->dapm->card->dapm_stats.val++;
>  
> +#define dapm_widget_for_each_path_safe(w, dir, p, next_p) \
> +	list_for_each_entry_safe(p, next_p, &w->edges[dir], list_node[dir])

It's a bit odd not to have this in the header next to the unsafe
version.

> +#define SND_SOC_DAPM_DIR_REVERSE(x) ((x == SND_SOC_DAPM_DIR_IN) ? \
> +	SND_SOC_DAPM_DIR_OUT : SND_SOC_DAPM_DIR_IN)
> +
> +#define dapm_for_each_direction(dir) \
> +	for ((dir) = SND_SOC_DAPM_DIR_IN; (dir) <= SND_SOC_DAPM_DIR_OUT; \
> +		(dir)++)

Eew.

>  	list_for_each_entry(w, &card->widgets, list) {
> -		w->inputs = -1;
> -		w->outputs = -1;
> +		w->endpoints[SND_SOC_DAPM_DIR_IN] = -1;
> +		w->endpoints[SND_SOC_DAPM_DIR_OUT] = -1;

Loop over the endpoints array in some of the users like this perhaps?

> +	dapm_for_each_direction(dir) {
> +		rdir = SND_SOC_DAPM_DIR_REVERSE(dir);
> +		snd_soc_dapm_widget_for_each_path(w, dir, p) {
> +			if (p->connected && !p->connected(w, p->node[rdir]))
> +				continue;

Looks like dapm_for_each_direction should be
snd_soc_dapm_for_each_direction - the above looks wrong.

[-- Attachment #1.2: Digital signature --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

[-- Attachment #2: Type: text/plain, Size: 0 bytes --]



  reply	other threads:[~2015-07-29 13:14 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-26 17:04 [PATCH 1/5] ASoC: dapm: Drop always true checks Lars-Peter Clausen
2015-07-26 17:04 ` [PATCH 2/5] ASoC: dapm: Simplify list creation in dapm_dai_get_connected_widgets() Lars-Peter Clausen
2015-07-29 14:13   ` Applied "ASoC: dapm: Simplify list creation in dapm_dai_get_connected_widgets()" to the asoc tree Mark Brown
2015-07-26 17:05 ` [PATCH 3/5] ASoC: dapm: Add widget path iterators Lars-Peter Clausen
2015-07-29 14:13   ` Applied "ASoC: dapm: Add widget path iterators" to the asoc tree Mark Brown
2015-07-26 17:05 ` [PATCH 4/5] ASoC: dapm: Consolidate input and output path handling Lars-Peter Clausen
2015-07-29 13:14   ` Mark Brown [this message]
2015-08-02 10:18     ` Lars-Peter Clausen
2015-08-04 16:00       ` Mark Brown
2015-07-26 17:05 ` [PATCH 5/5] ASoC: dapm: Consolidate path trace events Lars-Peter Clausen
2015-08-14  0:00   ` Applied "ASoC: dapm: Consolidate path trace events" to the asoc tree Mark Brown
2015-07-29 14:13 ` Applied "ASoC: dapm: Drop always true checks" " Mark Brown

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150729131439.GF20130@sirena.org.uk \
    --to=broonie@kernel.org \
    --cc=alsa-devel@alsa-project.org \
    --cc=lars@metafoo.de \
    --cc=lgirdwood@gmail.com \
    --cc=patches@opensource.wolfsonmicro.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.