diff options
author | Heiner Kallweit <hkallweit1@gmail.com> | 2016-08-02 08:44:07 +0300 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@s-opensource.com> | 2017-01-30 16:46:55 +0300 |
commit | 74d47d75beb17babe5a999ae357b599caf1a1fcd (patch) | |
tree | 6896737bb88b90b2e0a1763e1f68306f04ec03ec /drivers/media/rc/rc-core-priv.h | |
parent | 0cffd6312f3fd9e51fec946eb918a988b109b520 (diff) | |
download | linux-74d47d75beb17babe5a999ae357b599caf1a1fcd.tar.xz |
[media] rc: refactor raw handler kthread
I think we can get rid of the spinlock protecting the kthread from being
interrupted by a wakeup in certain parts.
Even with the current implementation of the kthread the only lost wakeup
scenario could happen if the wakeup occurs between the kfifo_len check
and setting the state to TASK_INTERRUPTIBLE.
In the changed version we could lose a wakeup if it occurs between
processing the fifo content and setting the state to TASK_INTERRUPTIBLE.
This scenario is covered by an additional check for available events in
the fifo and setting the state to TASK_RUNNING in this case.
In addition the changed version flushes the kfifo before ending
when the kthread is stopped.
With this patch we gain:
- Get rid of the spinlock
- Simplify code
- Don't grep / release the mutex for each individual event but just once
for the complete fifo content. This reduces overhead if a driver e.g.
triggers processing after writing the content of a hw fifo to the kfifo.
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Diffstat (limited to 'drivers/media/rc/rc-core-priv.h')
-rw-r--r-- | drivers/media/rc/rc-core-priv.h | 2 |
1 files changed, 0 insertions, 2 deletions
diff --git a/drivers/media/rc/rc-core-priv.h b/drivers/media/rc/rc-core-priv.h index 585d5e52118d..577128ad0ae5 100644 --- a/drivers/media/rc/rc-core-priv.h +++ b/drivers/media/rc/rc-core-priv.h @@ -20,7 +20,6 @@ #define MAX_IR_EVENT_SIZE 512 #include <linux/slab.h> -#include <linux/spinlock.h> #include <media/rc-core.h> struct ir_raw_handler { @@ -37,7 +36,6 @@ struct ir_raw_handler { struct ir_raw_event_ctrl { struct list_head list; /* to keep track of raw clients */ struct task_struct *thread; - spinlock_t lock; /* fifo for the pulse/space durations */ DECLARE_KFIFO(kfifo, struct ir_raw_event, MAX_IR_EVENT_SIZE); ktime_t last_event; /* when last event occurred */ |