pm_clk_op_lock(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… pm_clk_op_lock β€” Kernel API Manual era ✨

ok so bestie, welcome to pm_clk_op_lock(9) β€” the little function that makes sure nobody's stepping on anybody's toes while we're doing clock operations. it's giving "bouncer at the club" energy ngl πŸŽ€


✨ NAME ✨

pm_clk_op_lock β€” bestie's whole job is ensure exclusive access for performing clock operations. that's it. that's the vibe. πŸ’…


πŸ¦‹ SYNOPSIS πŸ¦‹

int pm_clk_op_lock (struct pm_subsys_data *psd , unsigned long *flags ,
       const char *fn );

look at her go 😭 three whole arguments, she's so lowkey iconic


🌸 ARGUMENTS 🌸

  • psd β€” the pm_subsys_data instance that corresponds to the PM clock entry list and the clk_op_might_sleep count being used. she's literally the main character here πŸ‘‘
  • flags β€” stored irq flags. that's the whole thing, they're just chillin' in there 🫢
  • fn β€” a string for the caller function's name. so like, who's calling. name and shame but make it cute ✨

πŸ’– DESCRIPTION πŸ’–

okay so here's the tea β˜• β€” this function is used by pm_clk_suspend and pm_clk_resume to guard against concurrent modifications to the clock entry list and the clock_op_might_sleep count. no cap, no racing, no chaos πŸ’€

and it's got two whole modes, depending on the count:

  • if clock_op_might_sleep is != 0 then only the mutex can be locked, and those functions can only be used in non atomic context. so watch out bestie, context matters 🌈
  • if clock_op_might_sleep == 0 then those functions may be used in any context, and only the spinlock can be locked. slay, free real estate ✨
🚨 and she Returns -EINVAL if called in atomic context when clock ops might sleep. literally not me finding out the hard way 😭

πŸ”₯ SEE ALSO πŸ”₯

kernel file ./drivers/base/power/clock_ops.c and honestly the whole friend group πŸ’œ

(and yes pm_clk_notify(9) is in there twice β€” she's just that iconic, we don't question the source πŸ’…)


that's the whole page bestie, iykyk πŸ§šβ€β™€οΈ

signing off from ./drivers/base/power, dated October 2026 β€” stay locked, stay safe, and may your context never be atomic at the wrong moment πŸŽ€βœ¨πŸ’œ

πŸ“¦ where this page comes from