STRUCT UFS_CLK_GATING(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’– struct ufs_clk_gating(9) πŸ’–

okay so bestie, this is a page from the Kernel API Manual and it's literally all about struct ufs_clk_gating β€” the lil bookkeeping struct that holds all the UFS clock gating info ✨ clocks don't gate themselves, someone has to do it, and this struct is that someone's whole personality 🫢


🌸 NAME 🌸

struct ufs_clk_gating β€” UFS clock gating related info πŸ’…


πŸŽ€ SYNOPSIS πŸŽ€

like, here's the whole vibe, character for character, no cap:

struct ufs_clk_gating {
    struct delayed_work gate_work;
    struct work_struct ungate_work;
    struct workqueue_struct *clk_gating_workq;
    spinlock_t lock;
    enum clk_gating_state state;
    unsigned long delay_ms;
    bool is_suspended;
    struct device_attribute delay_attr;
    struct device_attribute enable_attr;
    bool is_enabled;
    bool is_initialized;
    int active_reqs;
 };

πŸ¦‹ Members πŸ¦‹

bestie, meet the members β€” every single one of them, we're not skipping anybody πŸ’–

  • gate_work β€” the worker that turns off clocks after some delay, and the delay is whatever delay_ms says it is. it's giving "patient icon" ⏳
  • ungate_work β€” the worker that turns clocks back on, specifically for when you're in interrupt context. rescue worker energy fr fr πŸ”₯
  • clk_gating_workq β€” the workqueue for clock gating work. it's the queue where all the gating happenings happen πŸŽ€
  • lock β€” serializes access to some struct ufs_clk_gating members. and bestie, note this: it's an outer lock relative to the host lock πŸ‘‘ (important, don't forget it)
  • state β€” the current clocks state πŸ¦‹
  • delay_ms β€” gating delay in ms. numbers, ms units, we love a specified delay ✨
  • is_suspended β€” clk gating is suspended when this is set to 1, which can be used during suspend/resume 😴
  • delay_attr β€” sysfs attribute to control delay_attr πŸ’…
  • enable_attr β€” sysfs attribute to enable/disable clock gating πŸ”˜
  • is_enabled β€” Indicates the current status of clock gating ⭐
  • is_initialized β€” Indicates whether clock gating is initialized or not 🌸
  • active_reqs β€” number of requests that are pending and should be waited for completion before gating clocks. not me gatekeeping the gate until everyone's done πŸ™ˆ

🌈 SEE ALSO 🌈

so there's this kernel file, right β€” ./include/ufs/ufshcd.h β€” and it's lowkey the main character of this whole friend group. here's everyone else in it, no cap, all of them:

struct uic_command(9), struct ufshcd_lrb(9), struct ufs_query_req(9), struct ufs_query_res(9), struct ufs_query(9), struct ufs_dev_cmd(9), struct ufs_clk_info(9), struct tx_eqtr_iter(9), struct ufshcd_tx_eq_settings(9), struct ufshcd_tx_eqtr_data(9), struct ufshcd_tx_eqtr_record(9), struct ufshcd_tx_eq_params(9), struct ufs_hba_variant_ops(9), struct ufs_clk_scaling(9), struct ufs_event_hist(9), struct ufs_stats(9), enum ufshcd_state(9), enum ufshcd_pmc_policy(9), struct ufshcd_mcq_opr_info_t(9), struct ufs_hba(9), struct ufs_hw_queue(9), ufshcd_rmwl(9), ufshcd_set_variant(9), ufshcd_get_variant(9)


bestie please note: this page lives in ./include/ufs and it's dated October 2026 ⭐ and that's the whole page, mwah πŸ’‹

✨ iykyk β€” go read your kernel headers, they're iconic, periodt πŸ‘‘πŸ’œ

πŸ“¦ where this page comes from