summaryrefslogtreecommitdiff
path: root/Documentation/hid
diff options
context:
space:
mode:
Diffstat (limited to 'Documentation/hid')
-rw-r--r--Documentation/hid/hid-bpf.rst12
1 files changed, 11 insertions, 1 deletions
diff --git a/Documentation/hid/hid-bpf.rst b/Documentation/hid/hid-bpf.rst
index a55f191d49a3..c205f92b7bcc 100644
--- a/Documentation/hid/hid-bpf.rst
+++ b/Documentation/hid/hid-bpf.rst
@@ -427,12 +427,22 @@ program first::
prog_fd = bpf_program__fd(hid_skel->progs.attach_prog);
err = bpf_prog_test_run_opts(prog_fd, &tattrs);
- return err;
+ if (err)
+ return err;
+
+ return args.retval; /* the fd of the created bpf_link */
}
Our userspace program can now listen to notifications on the ring buffer, and
is awaken only when the value changes.
+When the userspace program doesn't need to listen to events anymore, it can just
+close the returned fd from :c:func:`attach_filter`, which will tell the kernel to
+detach the program from the HID device.
+
+Of course, in other use cases, the userspace program can also pin the fd to the
+BPF filesystem through a call to :c:func:`bpf_obj_pin`, as with any bpf_link.
+
Controlling the device
----------------------