changed = snd_mask_refine(m, constrs_mask(constrs, k));
if (changed < 0)
return changed;
-
- trace_hw_mask_param(substream, k, 0, &old_mask, m);
+ if (changed == 0)
+ continue;
/* Set corresponding flag so that the caller gets it. */
- if (changed)
- params->cmask |= 1 << k;
+ trace_hw_mask_param(substream, k, 0, &old_mask, m);
+ params->cmask |= 1 << k;
}
return 0;
changed = snd_interval_refine(i, constrs_interval(constrs, k));
if (changed < 0)
return changed;
-
- trace_hw_interval_param(substream, k, 0, &old_interval, i);
+ if (changed == 0)
+ continue;
/* Set corresponding flag so that the caller gets it. */
- if (changed)
- params->cmask |= 1 << k;
+ trace_hw_interval_param(substream, k, 0, &old_interval, i);
+ params->cmask |= 1 << k;
}
return 0;
if (changed < 0)
return changed;
- if (hw_is_mask(r->var)) {
- trace_hw_mask_param(substream, r->var, k + 1,
- &old_mask, hw_param_mask(params, r->var));
- }
- if (hw_is_interval(r->var)) {
- trace_hw_interval_param(substream, r->var, k + 1,
- &old_interval, hw_param_interval(params, r->var));
- }
-
- rstamps[k] = stamp;
-
/*
- * When the parameters is changed, notify it to the caller
+ * When the parameter is changed, notify it to the caller
* by corresponding returned bit, then preparing for next
* iteration.
*/
if (changed && r->var >= 0) {
+ if (hw_is_mask(r->var)) {
+ trace_hw_mask_param(substream, r->var,
+ k + 1, &old_mask,
+ hw_param_mask(params, r->var));
+ }
+ if (hw_is_interval(r->var)) {
+ trace_hw_interval_param(substream, r->var,
+ k + 1, &old_interval,
+ hw_param_interval(params, r->var));
+ }
+
params->cmask |= (1 << r->var);
vstamps[r->var] = stamp;
again = true;
}
- stamp++;
+ rstamps[k] = stamp++;
}
/* Iterate to evaluate all rules till no parameters are changed. */
const int *v;
struct snd_mask old_mask;
struct snd_interval old_interval;
- int err;
+ int changed;
for (v = vars; *v != -1; v++) {
/* Keep old parameter to trace. */
old_interval = *hw_param_interval(params, *v);
}
if (*v != SNDRV_PCM_HW_PARAM_BUFFER_SIZE)
- err = snd_pcm_hw_param_first(pcm, params, *v, NULL);
+ changed = snd_pcm_hw_param_first(pcm, params, *v, NULL);
else
- err = snd_pcm_hw_param_last(pcm, params, *v, NULL);
- if (snd_BUG_ON(err < 0))
- return err;
+ changed = snd_pcm_hw_param_last(pcm, params, *v, NULL);
+ if (snd_BUG_ON(changed < 0))
+ return changed;
+ if (changed == 0)
+ continue;
- /* Trace the parameter. */
+ /* Trace the changed parameter. */
if (hw_is_mask(*v)) {
trace_hw_mask_param(pcm, *v, 0, &old_mask,
hw_param_mask(params, *v));