[alsa-devel] [PATCH 4/5] ASoC: dapm: Consolidate input and output path handling

Mark Brown broonie at kernel.org
Tue Aug 4 18:00:19 CEST 2015


On Sun, Aug 02, 2015 at 12:18:26PM +0200, Lars-Peter Clausen wrote:
> On 07/29/2015 03:14 PM, Mark Brown wrote:

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

It's the unsafe version that's in the header though?  I can tell why
they're separate, I'd just rather keep them together even so - drivers
shouldn't really be iterating over widgets at all.

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

It does save me wondering if we've missed any other array elements which
was my first thought here.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: Digital signature
URL: <http://mailman.alsa-project.org/pipermail/alsa-devel/attachments/20150804/553d6180/attachment.sig>


More information about the Alsa-devel mailing list