Commit 5f61ff86 authored by Heiner Kallweit's avatar Heiner Kallweit Committed by Mauro Carvalho Chehab

[media] media: rc: reduce size of struct ir_raw_event

struct ir_raw_event currently has a size of 12 bytes on most (all?)
architectures. This can be reduced to 8 bytes whilst maintaining
full backwards compatibility.
This saves 2KB in size of struct ir_raw_event_ctrl (as element
kfifo is reduced by 512 * 4 bytes) and it allows to copy the
full struct ir_raw_event with a single 64 bit operation.

Successfully tested with the Nuvoton driver and successfully
compile-tested with the ene_ir driver (as it uses the carrier /
duty_cycle elements).
Signed-off-by: default avatarHeiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@osg.samsung.com>
parent 18693843
...@@ -215,12 +215,9 @@ enum raw_event_type { ...@@ -215,12 +215,9 @@ enum raw_event_type {
struct ir_raw_event { struct ir_raw_event {
union { union {
u32 duration; u32 duration;
u32 carrier;
struct {
u32 carrier;
u8 duty_cycle;
};
}; };
u8 duty_cycle;
unsigned pulse:1; unsigned pulse:1;
unsigned reset:1; unsigned reset:1;
...@@ -228,13 +225,7 @@ struct ir_raw_event { ...@@ -228,13 +225,7 @@ struct ir_raw_event {
unsigned carrier_report:1; unsigned carrier_report:1;
}; };
#define DEFINE_IR_RAW_EVENT(event) \ #define DEFINE_IR_RAW_EVENT(event) struct ir_raw_event event = {}
struct ir_raw_event event = { \
{ .duration = 0 } , \
.pulse = 0, \
.reset = 0, \
.timeout = 0, \
.carrier_report = 0 }
static inline void init_ir_raw_event(struct ir_raw_event *ev) static inline void init_ir_raw_event(struct ir_raw_event *ev)
{ {
...@@ -256,8 +247,7 @@ void ir_raw_event_set_idle(struct rc_dev *dev, bool idle); ...@@ -256,8 +247,7 @@ void ir_raw_event_set_idle(struct rc_dev *dev, bool idle);
static inline void ir_raw_event_reset(struct rc_dev *dev) static inline void ir_raw_event_reset(struct rc_dev *dev)
{ {
DEFINE_IR_RAW_EVENT(ev); struct ir_raw_event ev = { .reset = true };
ev.reset = true;
ir_raw_event_store(dev, &ev); ir_raw_event_store(dev, &ev);
ir_raw_event_handle(dev); ir_raw_event_handle(dev);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment