Skip to contentSkip to conversation

cec: remove redundant struct cec_msg initializations

PATCH New Deborah Brouwer 1 participant 1 message Jun 15, 2021 Media (V4L/DVB)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 cec: remove redundant struct cec_msg initializations

It is redundant to initialize a struct cec_msg variable with an empty list if the variable is also initialized by a call to cec_msg_init. Remove these redundant initializations.

---
 utils/cec-compliance/cec-compliance.cpp   |  2 +-
 utils/cec-compliance/cec-test-adapter.cpp |  2 +-
 utils/cec-compliance/cec-test-audio.cpp   | 46 ++++++------
 utils/cec-compliance/cec-test-power.cpp   | 26 +++----
 utils/cec-compliance/cec-test.cpp         | 88 +++++++++++------------
 utils/cec-ctl/cec-ctl.cpp                 |  2 +-
 utils/cec-follower/cec-processing.cpp     |  6 +-
 7 files changed, 86 insertions(+), 86 deletions(-)
utils/cec-compliance/cec-compliance.cpp +1 -1
index 322bc772..c04904c2 100644
@@ -741,7 +741,7 @@ static int poll_remote_devs(struct node *node)
 
 static void topology_probe_device(struct node *node, unsigned i, unsigned la)
 {
-	struct cec_msg msg = { };
+	struct cec_msg msg;
 	bool unknown;
 
 	printf("\tSystem Information for device %d (%s) from device %d (%s):\n",
utils/cec-compliance/cec-test-adapter.cpp +1 -1
index df7feb21..81eb4013 100644
@@ -261,7 +261,7 @@ static int testAdapLogAddrs(struct node *node)
 
 static int testTransmit(struct node *node)
 {
-	struct cec_msg msg = { };
+	struct cec_msg msg;
 	unsigned i, la = node->log_addr[0];
 	unsigned valid_la = 15, invalid_la = 15;
 	bool tested_self = false;
utils/cec-compliance/cec-test-audio.cpp +23 -23

184 lines not on this page · raw message

utils/cec-compliance/cec-test-power.cpp +13 -13
index 8ac45fbf..b675bfc4 100644
@@ -16,7 +16,7 @@
 
 static bool get_power_status(struct node *node, unsigned me, unsigned la, __u8 &power_status)
 {
-	struct cec_msg msg = {};
+	struct cec_msg msg;
 
 	cec_msg_init(&msg, me, la);
 	cec_msg_give_device_power_status(&msg, true);
@@ -62,7 +62,7 @@ bool util_interactive_ensure_power_state(struct node *node, unsigned me, unsigne
 
 static int power_status_give(struct node *node, unsigned me, unsigned la, bool interactive)
 {
-	struct cec_msg msg = { };
+	struct cec_msg msg;
 
 	cec_msg_init(&msg, me, la);
 	cec_msg_give_device_power_status(&msg, true);
@@ -83,7 +83,7 @@ static int power_status_give(struct node *node, unsigned me, unsigned la, bool i
 
 static int power_status_report(struct node *node, unsigned me, unsigned la, bool interactive)
 {
-	struct cec_msg msg = {};
+	struct cec_msg msg;
 
 	cec_msg_init(&msg, me, la);
 	cec_msg_report_power_status(&msg, CEC_OP_POWER_STATUS_ON);
@@ -106,7 +106,7 @@ const vec_remote_subtests power_status_subtests{
 static int one_touch_play_view_on(struct node *node, unsigned me, unsigned la, bool interactive,
 				  __u8 opcode)
 {
-	struct cec_msg msg = {};
+	struct cec_msg msg;
 
 	cec_msg_init(&msg, me, la);
 	if (opcode == CEC_MSG_IMAGE_VIEW_ON)
@@ -179,7 +179,7 @@ static int one_touch_play_text_view_on_wakeup(struct node *node, unsigned me, un
 static int one_touch_play_view_on_change(struct node *node, unsigned me, unsigned la, bool interactive,
 					 __u8 opcode)
 {
-	struct cec_msg msg = {};
+	struct cec_msg msg;
 	int ret;
 
 	fail_on_test(!util_interactive_ensure_power_state(node, me, la, interactive, CEC_OP_POWER_STATUS_ON));
@@ -215,7 +215,7 @@ static int one_touch_play_text_view_on_change(struct node *node, unsigned me, un
 
 static int one_touch_play_req_active_source(struct node *node, unsigned me, unsigned la, bool interactive)
 {
-	struct cec_msg msg = {};
+	struct cec_msg msg;
 
 	cec_msg_init(&msg, me, la);
 	cec_msg_active_source(&msg, node->phys_addr);
@@ -318,7 +318,7 @@ static int standby_resume_standby(struct node *node, unsigned me, unsigned la, b
 	if (!node->remote[la].has_power_status)
 		return NOTAPPLICABLE;
 
-	struct cec_msg msg = {};
+	struct cec_msg msg;
 	unsigned unresponsive_time = 0;
 
 	fail_on_test(!util_interactive_ensure_power_state(node, me, la, interactive, CEC_OP_POWER_STATUS_ON));
@@ -355,7 +355,7 @@ static int standby_resume_standby_toggle(struct node *node, unsigned me, unsigne
 	if (!node->remote[la].in_standby)
 		return NOTAPPLICABLE;
 
-	struct cec_msg msg = {};
+	struct cec_msg msg;
 	unsigned unresponsive_time = 0;
 	__u8 new_status;
 
@@ -403,7 +403,7 @@ static int standby_resume_active_source_nowake(struct node *node, unsigned me, u
 	if (!node->remote[la].in_standby)
 		return NOTAPPLICABLE;
 
-	struct cec_msg msg = {};
+	struct cec_msg msg;
 	unsigned unresponsive_time = 0;
 	__u8 new_status;
 
@@ -435,7 +435,7 @@ static int standby_resume_active_source_nowake(struct node *node, unsigned me, u
 
 static int wakeup_rc(struct node *node, unsigned me, unsigned la)
 {
-	struct cec_msg msg = {};
+	struct cec_msg msg;
 	struct cec_op_ui_command rc_press = {};
 
 	/* Todo: A release should be sent after this */
@@ -450,7 +450,7 @@ static int wakeup_rc(struct node *node, unsigned me, unsigned la)
 
 static int wakeup_tv(struct node *node, unsigned me, unsigned la)
 {
-	struct cec_msg msg = {};
+	struct cec_msg msg;
 
 	cec_msg_init(&msg, me, la);
 	cec_msg_image_view_on(&msg);
@@ -475,7 +475,7 @@ static int wakeup_tv(struct node *node, unsigned me, unsigned la)
 
 static int wakeup_source(struct node *node, unsigned me, unsigned la)
 {
-	struct cec_msg msg = {};
+	struct cec_msg msg;
 
 	cec_msg_init(&msg, me, la);
 	cec_msg_set_stream_path(&msg, node->remote[la].phys_addr);
@@ -545,7 +545,7 @@ static int standby_resume_wakeup_view_on(struct node *node, unsigned me, unsigne
 	fail_on_test(!poll_stable_power_status(node, me, la, CEC_OP_POWER_STATUS_ON, unresponsive_time));
 	fail_on_test(interactive && !question("Is the device in On state?"));
 
-	struct cec_msg msg = {};
+	struct cec_msg msg;
 
 	cec_msg_init(&msg, me, la);
 	cec_msg_active_source(&msg, node->phys_addr);
utils/cec-compliance/cec-test.cpp +44 -44

352 lines not on this page · raw message

utils/cec-ctl/cec-ctl.cpp +1 -1
index 44754787..4bed81a9 100644
@@ -673,7 +673,7 @@ static __u16 calc_mask(__u16 pa)
 
 static int showTopology(struct node *node)
 {
-	struct cec_msg msg = { };
+	struct cec_msg msg;
 	struct cec_log_addrs laddrs = { };
 
 	if (!(node->caps & CEC_CAP_TRANSMIT))
utils/cec-follower/cec-processing.cpp +3 -3
index 5385b335..41bb990c 100644
@@ -262,7 +262,7 @@ static void update_deck_state(struct node *node, unsigned me, __u8 deck_state_ne
 		node->state.deck_state = deck_state_new;
 
 		if (node->state.deck_report_changes) {
-			struct cec_msg msg = {};
+			struct cec_msg msg;
 
 			cec_msg_init(&msg, me, node->state.deck_report_changes_to);
 			cec_msg_deck_status(&msg, node->state.deck_state);
@@ -1095,7 +1095,7 @@ void testProcessing(struct node *node, bool wallclock)
 		if (node->cec_version >= CEC_OP_CEC_VERSION_2_0 &&
 		    last_pwr_state != pwr_state &&
 		    (time_to_stable > 2 || pwr_state < CEC_OP_POWER_STATUS_TO_ON)) {
-			struct cec_msg msg = {};
+			struct cec_msg msg;
 
 			cec_msg_init(&msg, me, CEC_LOG_ADDR_BROADCAST);
 			cec_msg_report_power_status(&msg, pwr_state);
@@ -1118,7 +1118,7 @@ void testProcessing(struct node *node, bool wallclock)
 		if (poll_la != me &&
 		    poll_la != last_poll_la && poll_la < 15 && la_info[poll_la].ts &&
 		    ts_to_ms(ts_now - la_info[poll_la].ts) > POLL_PERIOD) {
-			struct cec_msg msg = {};
+			struct cec_msg msg;
 
 			cec_msg_init(&msg, me, poll_la);
 			transmit(node, &msg);
Signature · 1 line
2.25.1