diff options
author | Sean Young <sean@mess.org> | 2018-05-27 12:24:09 +0100 |
---|---|---|
committer | Daniel Borkmann <daniel@iogearbox.net> | 2018-05-30 12:38:40 +0200 |
commit | f4364dcfc86df7c1ca47b256eaf6b6d0cdd0d936 (patch) | |
tree | aa0d09b48734429acec8d26b703db839fcc655de /drivers/media/rc/rc-ir-raw.c | |
parent | 170a7e3ea0709eae12c8f944b9f33c54fe80c6c1 (diff) | |
download | linux-f4364dcfc86df7c1ca47b256eaf6b6d0cdd0d936.tar.gz linux-f4364dcfc86df7c1ca47b256eaf6b6d0cdd0d936.tar.bz2 linux-f4364dcfc86df7c1ca47b256eaf6b6d0cdd0d936.zip |
media: rc: introduce BPF_PROG_LIRC_MODE2
Add support for BPF_PROG_LIRC_MODE2. This type of BPF program can call
rc_keydown() to reported decoded IR scancodes, or rc_repeat() to report
that the last key should be repeated.
The bpf program can be attached to using the bpf(BPF_PROG_ATTACH) syscall;
the target_fd must be the /dev/lircN device.
Acked-by: Yonghong Song <yhs@fb.com>
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Diffstat (limited to 'drivers/media/rc/rc-ir-raw.c')
-rw-r--r-- | drivers/media/rc/rc-ir-raw.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/drivers/media/rc/rc-ir-raw.c b/drivers/media/rc/rc-ir-raw.c index 374f83105a23..7675b7ee5bc7 100644 --- a/drivers/media/rc/rc-ir-raw.c +++ b/drivers/media/rc/rc-ir-raw.c @@ -14,7 +14,7 @@ static LIST_HEAD(ir_raw_client_list); /* Used to handle IR raw handler extensions */ -static DEFINE_MUTEX(ir_raw_handler_lock); +DEFINE_MUTEX(ir_raw_handler_lock); static LIST_HEAD(ir_raw_handler_list); static atomic64_t available_protocols = ATOMIC64_INIT(0); @@ -621,9 +621,17 @@ void ir_raw_event_unregister(struct rc_dev *dev) list_for_each_entry(handler, &ir_raw_handler_list, list) if (handler->raw_unregister) handler->raw_unregister(dev); - mutex_unlock(&ir_raw_handler_lock); + + lirc_bpf_free(dev); ir_raw_event_free(dev); + + /* + * A user can be calling bpf(BPF_PROG_{QUERY|ATTACH|DETACH}), so + * ensure that the raw member is null on unlock; this is how + * "device gone" is checked. + */ + mutex_unlock(&ir_raw_handler_lock); } /* |