STRUCT CLOCK_EVENT_DEVICE(9)

๐Ÿ“ฆ version 7.3.1, in nixpkgs unstable

๐Ÿ’– NAME ๐Ÿ’–

okay so you opened the struct clock_event_device(9) page in the Kernel API Manual, and the NAME section is literally clock event device descriptor โ€” thatโ€™s the whole vibe, bestie ๐Ÿ’…. This struct is the descriptor for a clock event device, and weโ€™re about to go through every field like itโ€™s a group-chat roll call ๐Ÿ‘‘


โœจ SYNOPSIS โœจ

hereโ€™s the struct, copied exactly so thereโ€™s zero ambiguity, no cap:

       struct clock_event_device {
           void (*event_handler)(struct clock_event_device *);
           int (*set_next_event)(unsigned long evt, struct clock_event_device
       *);
           int (*set_next_ktime)(ktime_t expires, struct clock_event_device *);
           void (*set_next_coupled)(u64 cycles, struct clock_event_device *);
           ktime_t next_event;
           u64 max_delta_ns;
           u64 min_delta_ns;
           u32 mult;
           u32 shift;
           enum clock_event_state  state_use_accessors;
           unsigned int            features;
           enum clocksource_ids    cs_id;
           unsigned int            next_event_forced;
           unsigned long           retries;
           int (*set_state_periodic)(struct clock_event_device *);
           int (*set_state_oneshot)(struct clock_event_device *);
           int (*set_state_oneshot_stopped)(struct clock_event_device *);
           int (*set_state_shutdown)(struct clock_event_device *);
           int (*tick_resume)(struct clock_event_device *);
           void (*broadcast)(const struct cpumask *mask);
           void (*suspend)(struct clock_event_device *);
           void (*resume)(struct clock_event_device *);
           unsigned long           min_delta_ticks;
           unsigned long           max_delta_ticks;
           const char              *name;
           int rating;
           int irq;
           int bound_on;
           const struct cpumask    *cpumask;
           struct list_head        list;
           struct module           *owner;
        };

๐Ÿซถ Members ๐Ÿซถ

okay bestie, member-by-member time. this is giving documentation but make it cute ๐ŸŒธ

  • event_handler โ€” the framework assigns this one, and the low level handler of the event source calls it. assigned-by-the-framework realness ๐Ÿ’–
  • set_next_event โ€” set next event function using a clocksource delta โœจ
  • set_next_ktime โ€” set next event function using a direct ktime value ๐Ÿ•ฐ๏ธ
  • set_next_coupled โ€” set next event function for clocksource coupled mode ๐Ÿ”—
  • next_event โ€” local storage for the next event in oneshot mode ๐Ÿ“ฆ
  • max_delta_ns โ€” maximum delta value in ns, highkey important ๐Ÿ”ฅ
  • min_delta_ns โ€” minimum delta value in ns, also important ๐Ÿ’…
  • mult โ€” nanosecond to cycles multiplier ๐Ÿงฎ
  • shift โ€” nanoseconds to cycles divisor, and itโ€™s a power of two, bestie โšก
  • state_use_accessors โ€” current state of the device, assigned by the core code ๐Ÿ‘‘
  • features โ€” the description is literally just โ€œfeaturesโ€, bestie. thatโ€™s the whole thing, and I respect the brevity ๐Ÿ˜ญ
  • cs_id โ€” Clocksource ID to denote the clocksource for coupled mode ๐Ÿ†”
  • next_event_forced โ€” True if the last programming was a forced event ๐Ÿ’ฅ
  • retries โ€” number of forced programming retries ๐Ÿ”
  • set_state_periodic โ€” switch state to periodic ๐ŸŒ€
  • set_state_oneshot โ€” switch state to oneshot ๐ŸŽฏ
  • set_state_oneshot_stopped โ€” switch state to oneshot_stopped ๐Ÿ›‘
  • set_state_shutdown โ€” switch state to shutdown ๐Ÿ”Œ
  • tick_resume โ€” resume clkevt device โ–ถ๏ธ
  • broadcast โ€” function to broadcast events ๐Ÿ“ฃ
  • suspend โ€” itโ€™s in the struct above, but the Members blurbs donโ€™t give it a separate description, so Iโ€™m not inventing one ๐Ÿซ 
  • resume โ€” same energy: struct field, no separate Members description, no cap ๐Ÿ’€
  • min_delta_ticks โ€” minimum delta value in ticks stored for reconfiguration ๐Ÿœ
  • max_delta_ticks โ€” maximum delta value in ticks stored for reconfiguration ๐Ÿ˜
  • name โ€” ptr to clock event name ๐Ÿท๏ธ
  • rating โ€” variable to rate clock event devices โญ
  • irq โ€” IRQ number, only for non CPU local devices ๐Ÿšจ
  • bound_on โ€” Bound on CPU ๐Ÿ“
  • cpumask โ€” cpumask to indicate for which CPUs this device works ๐Ÿง 
  • list โ€” list head for the management code ๐Ÿ“‹
  • owner โ€” module reference, gotta keep that module ref, periodt ๐Ÿซถ

๐ŸŒˆ SEE ALSO ๐ŸŒˆ

  • Kernel file ./include/linux/clockchips.h โ€” go peek, bestie ๐Ÿฆ‹

and thatโ€™s the page! ๐ŸŽ€ this one lives under ./include/linux, dated October 2026, and itโ€™s the struct clock_event_device(9) manual page โ€” mwah ๐Ÿ’‹

๐Ÿ“ฆ where this page comes from