Skip to contentSkip to conversation

media: rc: core: simplify DEFINE_IR_RAW_EVENT

PATCH New Heiner Kallweit 1 participant 1 message Dec 30, 2015

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 media: rc: core: simplify DEFINE_IR_RAW_EVENT

DEFINE_IR_RAW_EVENT can be simplified and doesn't provide much benefit as all elements are initialized to 0. But keep it as it is used in a lot of places.
duration is the first element of the embedded union and therefore used for the initialization even if not explicitely mentioned.

---
 include/media/rc-core.h | 11 ++---------
 1 file changed, 2 insertions(+), 9 deletions(-)
include/media/rc-core.h +2 -9
index f649470..91c6633 100644
@@ -226,13 +226,7 @@ struct ir_raw_event {
 	unsigned                carrier_report:1;
 };
 
-#define DEFINE_IR_RAW_EVENT(event) \
-	struct ir_raw_event event = { \
-		{ .duration = 0 } , \
-		.pulse = 0, \
-		.reset = 0, \
-		.timeout = 0, \
-		.carrier_report = 0 }
+#define DEFINE_IR_RAW_EVENT(event) struct ir_raw_event event = {}
 
 static inline void init_ir_raw_event(struct ir_raw_event *ev)
 {
@@ -254,8 +248,7 @@ void ir_raw_event_set_idle(struct rc_dev *dev, bool idle);
 
 static inline void ir_raw_event_reset(struct rc_dev *dev)
 {
-	DEFINE_IR_RAW_EVENT(ev);
-	ev.reset = true;
+	struct ir_raw_event ev = { .reset = true };
 
 	ir_raw_event_store(dev, &ev);
 	ir_raw_event_handle(dev);
Signature · 1 line
2.6.4