snd_power_ref_and_wait(9)
π snd_power_ref_and_wait(9) π
okay so bestie, welcome to the Kernel API Manual β we're talking about snd_power_ref_and_wait(9) today and honestly? it's giving "hold my hand until the soundcard wakes up" energy π«Ά
β¨ NAME β¨
snd_power_ref_and_wait β the function that literally sits there and waits until the card gets powered up π₯
πΈ SYNOPSIS πΈ
int snd_power_ref_and_wait (struct snd_card *card );
like, that's the whole vibe. one card, one return value, no drama π
π ARGUMENTS π
cardβ the soundcard structure, aka the main character of this whole situation π
π¦ DESCRIPTION π¦
so what it does: it takes the power_ref reference count of the given card, and then it waits until that card gets powered up to the SNDRV_CTL_POWER_D0 state. iconic behavior, no cap β
and here's the cute part β the refcount gets pulled down again while it's sleeping, all the way until power-up happens. which means this function is genuinely useful for syncing the floating control ops accesses, typically around calling control ops. iykyk π
β οΈ heads up bestie: the caller needs to pull down the refcount viasnd_power_unreflater, when this function returns0. don't forget, fr fr β that's your responsibility, not the function's π
π RETURN π
Zero if successful, or a negative error code. that's it, that's the whole treasure map πΊοΈβ¨
π SEE ALSO π
Kernel file ./sound/core/init.c β plus this whole friend group right here:
snd_device_alloc(9)snd_card_new(9)snd_devm_card_new(9)snd_card_free_on_error(9)snd_card_ref(9)snd_card_disconnect(9)snd_card_disconnect_sync(9)snd_card_free_when_closed(9)snd_card_free(9)snd_card_set_id(9)snd_card_add_dev_attr(9)snd_card_register(9)snd_component_add(9)snd_card_file_add(9)snd_card_file_remove(9)snd_power_wait(9)
and that's the page!! sourced straight from ./sound/core, dated October 2026 β mwah, go forth and sync those control ops πππ§
π¦ where this page comes from
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms