diff options
author | Heiner Kallweit <hkallweit1@gmail.com> | 2016-03-17 15:39:13 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@osg.samsung.com> | 2016-05-07 09:34:17 -0400 |
commit | 5f61ff86116cf637ae926f44c1857716ec89e9fb (patch) | |
tree | fc8c46bb2e65c6d998e876dbdeccd55db132a324 | |
parent | 18693843870bfc3ebd682874c1171398f4c8a002 (diff) |
[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: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
-rw-r--r-- | include/media/rc-core.h | 18 |
1 files changed, 4 insertions, 14 deletions
diff --git a/include/media/rc-core.h b/include/media/rc-core.h index 0f77b3dffb37..b6586a91129c 100644 --- a/include/media/rc-core.h +++ b/include/media/rc-core.h | |||
@@ -215,12 +215,9 @@ enum raw_event_type { | |||
215 | struct ir_raw_event { | 215 | struct ir_raw_event { |
216 | union { | 216 | union { |
217 | u32 duration; | 217 | u32 duration; |
218 | 218 | u32 carrier; | |
219 | struct { | ||
220 | u32 carrier; | ||
221 | u8 duty_cycle; | ||
222 | }; | ||
223 | }; | 219 | }; |
220 | u8 duty_cycle; | ||
224 | 221 | ||
225 | unsigned pulse:1; | 222 | unsigned pulse:1; |
226 | unsigned reset:1; | 223 | unsigned reset:1; |
@@ -228,13 +225,7 @@ struct ir_raw_event { | |||
228 | unsigned carrier_report:1; | 225 | unsigned carrier_report:1; |
229 | }; | 226 | }; |
230 | 227 | ||
231 | #define DEFINE_IR_RAW_EVENT(event) \ | 228 | #define DEFINE_IR_RAW_EVENT(event) struct ir_raw_event event = {} |
232 | struct ir_raw_event event = { \ | ||
233 | { .duration = 0 } , \ | ||
234 | .pulse = 0, \ | ||
235 | .reset = 0, \ | ||
236 | .timeout = 0, \ | ||
237 | .carrier_report = 0 } | ||
238 | 229 | ||
239 | static inline void init_ir_raw_event(struct ir_raw_event *ev) | 230 | static inline void init_ir_raw_event(struct ir_raw_event *ev) |
240 | { | 231 | { |
@@ -256,8 +247,7 @@ void ir_raw_event_set_idle(struct rc_dev *dev, bool idle); | |||
256 | 247 | ||
257 | static inline void ir_raw_event_reset(struct rc_dev *dev) | 248 | static inline void ir_raw_event_reset(struct rc_dev *dev) |
258 | { | 249 | { |
259 | DEFINE_IR_RAW_EVENT(ev); | 250 | struct ir_raw_event ev = { .reset = true }; |
260 | ev.reset = true; | ||
261 | 251 | ||
262 | ir_raw_event_store(dev, &ev); | 252 | ir_raw_event_store(dev, &ev); |
263 | ir_raw_event_handle(dev); | 253 | ir_raw_event_handle(dev); |