I am trying to communicate asynchronously between a kernel driver and a user-space program (I know there are lots of questions here that ask for similar information, but I c
The blocking poll is from the user side. User code can simply tell the kernel which attributes it's interested in, then block in a poll()
until one of them has changed.
The sysfs_notify()
is a kernel-side call that releases the user-space poll()
. After you adjust your kernel attribute value, just call sysfs_notify()
to allow any user-space applications to respond to their outstanding poll()
.
Think of the poll()
as "subscribing" to notices of a change in an attribute of interest, and sysfs_notify()
as "publishing" the change to any subscribers.