diff options
author | Heiner Kallweit <hkallweit1@gmail.com> | 2015-11-27 20:02:38 -0200 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@osg.samsung.com> | 2016-01-25 12:38:09 -0200 |
commit | 464254e5dbd60124936d47be6679a23b42840b51 (patch) | |
tree | 174bde1958c3a549ab9c4fd34187cee2d2762141 /drivers/media/rc/rc-core-priv.h | |
parent | 33cb54015f5eebceb360443498430bdfab79778c (diff) | |
download | op-kernel-dev-464254e5dbd60124936d47be6679a23b42840b51.zip op-kernel-dev-464254e5dbd60124936d47be6679a23b42840b51.tar.gz |
[media] media: rc: raw: improve FIFO handling
The FIFO is used for ir_raw_event records, however for some historic
reason the FIFO is used on a per byte basis. IMHO this adds unneeded
complexity. Therefore set up the FIFO for ir_raw_event records.
This also allows to define the FIFO statically as part of
ir_raw_event_ctrl instead of having to allocate the FIFO dynamically.
In addition:
- When writing into the FIFO and it's full return ENOSPC instead of
ENOMEM thus making it easier to tell between "FIFO full" and
"Dynamic memory allocation failed" when the error is propagated to
a higher level.
Also add an error message.
- When reading from the FIFO check whether it's empty.
This is not strictly needed here but kfifo_out is annotated
"must check" anyway.
Successfully tested it with the nuvoton-cir driver.
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Diffstat (limited to 'drivers/media/rc/rc-core-priv.h')
-rw-r--r-- | drivers/media/rc/rc-core-priv.h | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/drivers/media/rc/rc-core-priv.h b/drivers/media/rc/rc-core-priv.h index 7359f3d..585d5e5 100644 --- a/drivers/media/rc/rc-core-priv.h +++ b/drivers/media/rc/rc-core-priv.h @@ -16,6 +16,9 @@ #ifndef _RC_CORE_PRIV #define _RC_CORE_PRIV +/* Define the max number of pulse/space transitions to buffer */ +#define MAX_IR_EVENT_SIZE 512 + #include <linux/slab.h> #include <linux/spinlock.h> #include <media/rc-core.h> @@ -35,7 +38,8 @@ struct ir_raw_event_ctrl { struct list_head list; /* to keep track of raw clients */ struct task_struct *thread; spinlock_t lock; - struct kfifo_rec_ptr_1 kfifo; /* fifo for the pulse/space durations */ + /* 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 */ enum raw_event_type last_type; /* last event type */ struct rc_dev *dev; /* pointer to the parent rc_dev */ |