Re: [PATCH v33 04/18] ALSA: pcm: notify drivers after linked prepare completes

From: Takashi Iwai

Date: Wed Dec 02 2026 - 07:08:22 EST


On Fri, 13 Nov 2026 10:21:28 +0100,
Joonho Lee via B4 Relay wrote:
>
> From: Joonho Lee <mynameisjune111@xxxxxxxxx>
>
> A linked prepare can finish one member before another member's driver
> prepare or reset fails. Drivers that admit transfers after their own
> prepare callback can then accept an ACK while the group action is still
> incomplete.
>
> Add an optional prepare_complete callback. After all sleeping prepare
> and reset actions have succeeded, take the group and member PCM locks,
> publish every PREPARED state, and notify opted-in drivers before
> releasing those locks. Keep the buffer locks and access gates held
> throughout the operation. A concurrent DROP observes the group before or
> after this commit point.
>
> On a driver error, notify only the attempted prefix, including the
> failing member. On any revoked prepare, opted-in members in the affected
> prefix or group return to SETUP. Preserve DISCONNECTED members and keep
> SUSPENDED members suspended, but set both saved suspended-state fields
> to SETUP so a later prepare can recover. Leave unreached members
> untouched after a driver error. Preflight failures have no completion
> callback. A successful driver action canceled by a terminal state
> returns -ESTRPIPE or -EBADFD, respectively. A driver error keeps its
> original return value. DISCONNECTED takes precedence when a linked group
> contains both terminal states.
>
> Do not generate a stop-timer event while closing prepare admission.
> Ordinary legacy drivers keep their existing successful preparation and
> pointer rebasing. The new callback runs with the group and member locks
> held and must neither sleep nor acquire another PCM stream lock.
>
> Assisted-by: LLM
> Signed-off-by: Joonho Lee <mynameisjune111@xxxxxxxxx>

Hmm, this can't be applied any longer, and I doubt whether we really
need such a complex mechanism.

If an application opens two streams and manipulate manually without
linking, the same problem can be seen, no?

I'd really like to avoid adding more complexity there.


thanks,

Takashi