All of lore.kernel.org
 help / color / mirror / Atom feed
From: Lars-Peter Clausen <lars@metafoo.de>
To: Mark Brown <broonie@kernel.org>
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: Sun, 02 Aug 2015 12:18:26 +0200	[thread overview]
Message-ID: <55BDEE72.2050401@metafoo.de> (raw)
In-Reply-To: <20150729131439.GF20130@sirena.org.uk>


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

On 07/29/2015 03:14 PM, Mark Brown wrote:
[...]
>> +/**
>> + * 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.

Sorry, I don't quite understand what you mean.
snd_soc_dapm_widget_for_each_path() is a iterator so it can't be a function.

> 
>>  #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.
> 

You'd only need the unsafe variant if the paths are modified while being
traversed. I'd rather not encourage drivers to do this by hand. So this
macro is internal to the DAPM core.

>> +#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?

It's not really worth it if you only have a single line inside the loop.
Doesn't make the code shorter nor more legible.




[-- Attachment #1.2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

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



  reply	other threads:[~2015-08-02 10:18 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
2015-08-02 10:18     ` Lars-Peter Clausen [this message]
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=55BDEE72.2050401@metafoo.de \
    --to=lars@metafoo.de \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --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.