STRUCT EVENT_DEVICE_DATA(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

🌸 struct event_device_data(9) 🌸

okay bestie, so this one lives in the Kernel API Manual β€” it's a kernel struct page, and honestly? it's giving "the whole personality of a Wilco EC device in one little bundle." Let's get into it πŸ’–


✨ NAME ✨

struct event_device_data β€” the data for a Wilco EC device that responds to ACPI. literally the whole vibe of the device, packaged up πŸŽ€


πŸ¦‹ SYNOPSIS πŸ¦‹

struct event_device_data {
    struct ec_event_queue *events;
    spinlock_t queue_lock;
    wait_queue_head_t wq;
    struct device dev;
    struct cdev cdev;
    bool exist;
    atomic_t available;
 };

no cap, that's the entire struct. every field is kind of a main character in its own right, so let's meet them πŸ’…


πŸ‘‘ Members πŸ‘‘

  • events β€” a circular queue of EC events, just sitting there waiting to be handed over to userspace. it's the little conveyor belt of event lore πŸ“
  • queue_lock β€” a spinlock that protects the queue from simultaneous reads and writes. one at a time, bestie, we do NOT do chaos here πŸ”₯
  • wq β€” a wait queue used to notify processes when events are available or when the device has been removed. it's the group-chat ping for "something changed" ✨
  • dev β€” the device associated with the cdev. they're a package deal 🫢
  • cdev β€” the char dev that userspace reads from and polls from. this is the one your program actually talks to πŸ’œ
  • exist β€” has the device not been removed? once a device has been removed, writes, reads, and new opens will all fail. so like, once it's gone, it's gone bestie 😭
  • available β€” guarantees only one client can open the file and read from the queue. exclusive access, periodt 🌈

πŸ’« Description πŸ’«

so there will be, like, one of these structs for each ACPI device registered. that's the rule, that's the law πŸ“œ

and what's actually in it? it's the queue of events that came in from ACPI and still need to be read from userspace, plus the device and the char device that userspace is using, plus a wait queue that's there to notify different threads when something has changed, plus a flag telling you whether the ACPI device has been removed. it's basically the ACPI device's entire memory and social life in one struct πŸ‘‘


🌸 SEE ALSO 🌸

kernel file ./drivers/platform/chrome/wilco_ec/event.c β€” and all of these faves:


a lil warning from me to you: if exist is false, reads, writes, and new opens will fail. no cap, don't fight it πŸ™ˆ

okay that's the page!! mwah πŸ’‹ this came from ./drivers/platform/chrome/wilco_ec/event.c, dated October 2026, and it's page struct event_device_data(9) of the Kernel API Manual. slay, go read the source, ilysm πŸ§šβ€β™€οΈπŸ’–πŸŽ€

πŸ“¦ where this page comes from