21 Apr
2023
21 Apr
'23
1:10 p.m.
On Thu, 20 Apr 2023 13:33:23 +0200, Oswald Buddenhagen wrote:
The auto-silencer supports two modes: "thresholded" to fill up "just enough", and "top-up" to fill up "as much as possible". The two modes used rather distinct code paths, which this patch unifies. The only remaining distinction is how much we actually want to fill.
This fixes a bug in thresholded mode, where we failed to use new_hw_ptr, resulting in under-fill.
Top-up mode is now more well-behaved and much easier to understand in corner cases.
This also updates comments in the proximity of silencing-related data structures.
Signed-off-by: Oswald Buddenhagen oswald.buddenhagen@gmx.de
v2:
- removed useless boundary check
- got rid of casts by using a signed type for deltas. i did not adjust the style of the conditionals, because it's not clear whether the hangup was actually over that, or merely over the casts.
- dropped use of C99 comments where the surroundings suggest it. (in the case of the interspersed multi-line comments, that doesn't look like an improvement to me at all ...)
- swapped the `added` and `hw_avail` calculation blocks to reduce subsequent churn. it's more logical that way anyway.
Applied this one. For the second patch, let's discuss further.
thanks,
Takashi