Skip to contentSkip to conversation

drm/dp_mst: Fix W=1 warnings

PATCH Superseded Benjamin Gaignard 6 participants 14 messages Nov 28, 2019 – Feb 3, 2020

Subsystems (2)

v3 of 6 Superseded Latest is v6 →

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 drm/dp_mst: Fix W=1 warnings

Fix the warnings that show up with W=1.
They are all about unused but set variables.
If functions returns are not used anymore make them void.

---
CC: Jani Nikula <[email protected]>

changes in version 3:
- remove the hunk that may conflict with c485e2c97dae ("drm/dp_mst: Refactor pdt setup/teardown, add more locking")

changes in version 2:
- fix indentations
- when possible change functions prototype to void

drivers/gpu/drm/drm_dp_mst_topology.c | 83 +++++++++++++----------------------

 1 file changed, 31 insertions(+), 52 deletions(-)
drivers/gpu/drm/drm_dp_mst_topology.c +31 -52
index 1437bc46368b..d5cb5688b5dd 100644
@@ -674,7 +674,6 @@ static bool drm_dp_sideband_msg_build(struct drm_dp_sideband_msg_rx *msg,
 				      u8 *replybuf, u8 replybuflen, bool hdr)
 {
 	int ret;
-	u8 crc4;
 
 	if (hdr) {
 		u8 hdrlen;
@@ -716,8 +715,6 @@ static bool drm_dp_sideband_msg_build(struct drm_dp_sideband_msg_rx *msg,
 	}
 
 	if (msg->curchunk_idx >= msg->curchunk_len) {
-		/* do CRC */
-		crc4 = drm_dp_msg_data_crc4(msg->chunk, msg->curchunk_len - 1);
 		/* copy chunk into bigger msg */
 		memcpy(&msg->msg[msg->curlen], msg->chunk, msg->curchunk_len - 1);
 		msg->curlen += msg->curchunk_len - 1;
@@ -1014,7 +1011,7 @@ static bool drm_dp_sideband_parse_req(struct drm_dp_sideband_msg_rx *raw,
 	}
 }
 
-static int build_dpcd_write(struct drm_dp_sideband_msg_tx *msg, u8 port_num, u32 offset, u8 num_bytes, u8 *bytes)
+static void build_dpcd_write(struct drm_dp_sideband_msg_tx *msg, u8 port_num, u32 offset, u8 num_bytes, u8 *bytes)
 {
 	struct drm_dp_sideband_msg_req_body req;
 
@@ -1024,17 +1021,14 @@ static int build_dpcd_write(struct drm_dp_sideband_msg_tx *msg, u8 port_num, u32
 	req.u.dpcd_write.num_bytes = num_bytes;
 	req.u.dpcd_write.bytes = bytes;
 	drm_dp_encode_sideband_req(&req, msg);
-
-	return 0;
 }
 
-static int build_link_address(struct drm_dp_sideband_msg_tx *msg)
+static void build_link_address(struct drm_dp_sideband_msg_tx *msg)
 {
 	struct drm_dp_sideband_msg_req_body req;
 
 	req.req_type = DP_LINK_ADDRESS;
 	drm_dp_encode_sideband_req(&req, msg);
-	return 0;
 }
 
 static int build_enum_path_resources(struct drm_dp_sideband_msg_tx *msg, int port_num)
@@ -1048,7 +1042,7 @@ static int build_enum_path_resources(struct drm_dp_sideband_msg_tx *msg, int por
 	return 0;
 }
 
-static int build_allocate_payload(struct drm_dp_sideband_msg_tx *msg, int port_num,
+static void build_allocate_payload(struct drm_dp_sideband_msg_tx *msg, int port_num,
 				  u8 vcpi, uint16_t pbn,
 				  u8 number_sdp_streams,
 				  u8 *sdp_stream_sink)
@@ -1064,10 +1058,9 @@ static int build_allocate_payload(struct drm_dp_sideband_msg_tx *msg, int port_n
 		   number_sdp_streams);
 	drm_dp_encode_sideband_req(&req, msg);
 	msg->path_msg = true;
-	return 0;
 }
 
-static int build_power_updown_phy(struct drm_dp_sideband_msg_tx *msg,
+static void build_power_updown_phy(struct drm_dp_sideband_msg_tx *msg,
 				  int port_num, bool power_up)
 {
 	struct drm_dp_sideband_msg_req_body req;
@@ -1080,7 +1073,6 @@ static int build_power_updown_phy(struct drm_dp_sideband_msg_tx *msg,
 	req.u.port_num.port_number = port_num;
 	drm_dp_encode_sideband_req(&req, msg);
 	msg->path_msg = true;
-	return 0;
 }
 
 static int drm_dp_mst_assign_payload_id(struct drm_dp_mst_topology_mgr *mgr,
@@ -1746,14 +1738,13 @@ static u8 drm_dp_calculate_rad(struct drm_dp_mst_port *port,
  */
 static bool drm_dp_port_setup_pdt(struct drm_dp_mst_port *port)
 {
-	int ret;
 	u8 rad[6], lct;
 	bool send_link = false;
 	switch (port->pdt) {
 	case DP_PEER_DEVICE_DP_LEGACY_CONV:
 	case DP_PEER_DEVICE_SST_SINK:
 		/* add i2c over sideband */
-		ret = drm_dp_mst_register_i2c_bus(&port->aux);
+		drm_dp_mst_register_i2c_bus(&port->aux);
 		break;
 	case DP_PEER_DEVICE_MST_BRANCHING:
 		lct = drm_dp_calculate_rad(port, rad);
@@ -1823,25 +1814,20 @@ ssize_t drm_dp_mst_dpcd_write(struct drm_dp_aux *aux,
 
 static void drm_dp_check_mstb_guid(struct drm_dp_mst_branch *mstb, u8 *guid)
 {
-	int ret;
-
 	memcpy(mstb->guid, guid, 16);
 
 	if (!drm_dp_validate_guid(mstb->mgr, mstb->guid)) {
 		if (mstb->port_parent) {
-			ret = drm_dp_send_dpcd_write(
-					mstb->mgr,
-					mstb->port_parent,
-					DP_GUID,
-					16,
-					mstb->guid);
+			drm_dp_send_dpcd_write(mstb->mgr,
+					       mstb->port_parent,
+					       DP_GUID,
+					       16,
+					       mstb->guid);
 		} else {
-
-			ret = drm_dp_dpcd_write(
-					mstb->mgr->aux,
-					DP_GUID,
-					mstb->guid,
-					16);
+			drm_dp_dpcd_write(mstb->mgr->aux,
+					  DP_GUID,
+					  mstb->guid,
+					  16);
 		}
 	}
 }
@@ -2197,7 +2183,7 @@ static bool drm_dp_validate_guid(struct drm_dp_mst_topology_mgr *mgr,
 	return false;
 }
 
-static int build_dpcd_read(struct drm_dp_sideband_msg_tx *msg, u8 port_num, u32 offset, u8 num_bytes)
+static void build_dpcd_read(struct drm_dp_sideband_msg_tx *msg, u8 port_num, u32 offset, u8 num_bytes)
 {
 	struct drm_dp_sideband_msg_req_body req;
 
@@ -2206,8 +2192,6 @@ static int build_dpcd_read(struct drm_dp_sideband_msg_tx *msg, u8 port_num, u32
 	req.u.dpcd_read.dpcd_address = offset;
 	req.u.dpcd_read.num_bytes = num_bytes;
 	drm_dp_encode_sideband_req(&req, msg);
-
-	return 0;
 }
 
 static int drm_dp_send_sideband_msg(struct drm_dp_mst_topology_mgr *mgr,
@@ -2429,14 +2413,14 @@ static void drm_dp_send_link_address(struct drm_dp_mst_topology_mgr *mgr,
 {
 	struct drm_dp_sideband_msg_tx *txmsg;
 	struct drm_dp_link_address_ack_reply *reply;
-	int i, len, ret;
+	int i, ret;
 
 	txmsg = kzalloc(sizeof(*txmsg), GFP_KERNEL);
 	if (!txmsg)
 		return;
 
 	txmsg->dst = mstb;
-	len = build_link_address(txmsg);
+	build_link_address(txmsg);
 
 	mstb->link_address_sent = true;
 	drm_dp_queue_down_tx(mgr, txmsg);
@@ -2478,7 +2462,6 @@ drm_dp_send_enum_path_resources(struct drm_dp_mst_topology_mgr *mgr,
 {
 	struct drm_dp_enum_path_resources_ack_reply *path_res;
 	struct drm_dp_sideband_msg_tx *txmsg;
-	int len;
 	int ret;
 
 	txmsg = kzalloc(sizeof(*txmsg), GFP_KERNEL);
@@ -2486,7 +2469,7 @@ drm_dp_send_enum_path_resources(struct drm_dp_mst_topology_mgr *mgr,
 		return -ENOMEM;
 
 	txmsg->dst = mstb;
-	len = build_enum_path_resources(txmsg, port->port_num);
+	build_enum_path_resources(txmsg, port->port_num);
 
 	drm_dp_queue_down_tx(mgr, txmsg);
 
@@ -2569,7 +2552,7 @@ static int drm_dp_payload_send_msg(struct drm_dp_mst_topology_mgr *mgr,
 {
 	struct drm_dp_sideband_msg_tx *txmsg;
 	struct drm_dp_mst_branch *mstb;
-	int len, ret, port_num;
+	int ret, port_num;
 	u8 sinks[DRM_DP_MAX_SDP_STREAMS];
 	int i;
 
@@ -2594,9 +2577,9 @@ static int drm_dp_payload_send_msg(struct drm_dp_mst_topology_mgr *mgr,
 		sinks[i] = i;
 
 	txmsg->dst = mstb;
-	len = build_allocate_payload(txmsg, port_num,
-				     id,
-				     pbn, port->num_sdp_streams, sinks);
+	build_allocate_payload(txmsg, port_num,
+			       id,
+			       pbn, port->num_sdp_streams, sinks);
 
 	drm_dp_queue_down_tx(mgr, txmsg);
 
@@ -2625,7 +2608,7 @@ int drm_dp_send_power_updown_phy(struct drm_dp_mst_topology_mgr *mgr,
 				 struct drm_dp_mst_port *port, bool power_up)
 {
 	struct drm_dp_sideband_msg_tx *txmsg;
-	int len, ret;
+	int ret;
 
 	port = drm_dp_mst_topology_get_port_validated(mgr, port);
 	if (!port)
@@ -2638,7 +2621,7 @@ int drm_dp_send_power_updown_phy(struct drm_dp_mst_topology_mgr *mgr,
 	}
 
 	txmsg->dst = port->parent;
-	len = build_power_updown_phy(txmsg, port->port_num, power_up);
+	build_power_updown_phy(txmsg, port->port_num, power_up);
 	drm_dp_queue_down_tx(mgr, txmsg);
 
 	ret = drm_dp_mst_wait_tx_reply(port->parent, txmsg);
@@ -2858,7 +2841,6 @@ static int drm_dp_send_dpcd_read(struct drm_dp_mst_topology_mgr *mgr,
 				 struct drm_dp_mst_port *port,
 				 int offset, int size, u8 *bytes)
 {
-	int len;
 	int ret = 0;
 	struct drm_dp_sideband_msg_tx *txmsg;
 	struct drm_dp_mst_branch *mstb;
@@ -2873,7 +2855,7 @@ static int drm_dp_send_dpcd_read(struct drm_dp_mst_topology_mgr *mgr,
 		goto fail_put;
 	}
 
-	len = build_dpcd_read(txmsg, port->port_num, offset, size);
+	build_dpcd_read(txmsg, port->port_num, offset, size);
 	txmsg->dst = port->parent;
 
 	drm_dp_queue_down_tx(mgr, txmsg);
@@ -2911,7 +2893,6 @@ static int drm_dp_send_dpcd_write(struct drm_dp_mst_topology_mgr *mgr,
 				  struct drm_dp_mst_port *port,
 				  int offset, int size, u8 *bytes)
 {
-	int len;
 	int ret;
 	struct drm_dp_sideband_msg_tx *txmsg;
 	struct drm_dp_mst_branch *mstb;
@@ -2926,7 +2907,7 @@ static int drm_dp_send_dpcd_write(struct drm_dp_mst_topology_mgr *mgr,
 		goto fail_put;
 	}
 
-	len = build_dpcd_write(txmsg, port->port_num, offset, size, bytes);
+	build_dpcd_write(txmsg, port->port_num, offset, size, bytes);
 	txmsg->dst = mstb;
 
 	drm_dp_queue_down_tx(mgr, txmsg);
@@ -3149,7 +3130,7 @@ static bool drm_dp_get_one_sb_msg(struct drm_dp_mst_topology_mgr *mgr, bool up)
 {
 	int len;
 	u8 replyblock[32];
-	int replylen, origlen, curreply;
+	int replylen, curreply;
 	int ret;
 	struct drm_dp_sideband_msg_rx *msg;
 	int basereg = up ? DP_SIDEBAND_MSG_UP_REQ_BASE : DP_SIDEBAND_MSG_DOWN_REP_BASE;
@@ -3169,7 +3150,6 @@ static bool drm_dp_get_one_sb_msg(struct drm_dp_mst_topology_mgr *mgr, bool up)
 	}
 	replylen = msg->curchunk_len + msg->curchunk_hdrlen;
 
-	origlen = replylen;
 	replylen -= len;
 	curreply = len;
 	while (replylen > 0) {
@@ -3961,17 +3941,16 @@ void drm_dp_mst_dump_topology(struct seq_file *m,
 	mutex_lock(&mgr->lock);
 	if (mgr->mst_primary) {
 		u8 buf[DP_PAYLOAD_TABLE_SIZE];
-		int ret;
 
-		ret = drm_dp_dpcd_read(mgr->aux, DP_DPCD_REV, buf, DP_RECEIVER_CAP_SIZE);
+		drm_dp_dpcd_read(mgr->aux, DP_DPCD_REV, buf, DP_RECEIVER_CAP_SIZE);
 		seq_printf(m, "dpcd: %*ph\n", DP_RECEIVER_CAP_SIZE, buf);
-		ret = drm_dp_dpcd_read(mgr->aux, DP_FAUX_CAP, buf, 2);
+		drm_dp_dpcd_read(mgr->aux, DP_FAUX_CAP, buf, 2);
 		seq_printf(m, "faux/mst: %*ph\n", 2, buf);
-		ret = drm_dp_dpcd_read(mgr->aux, DP_MSTM_CTRL, buf, 1);
+		drm_dp_dpcd_read(mgr->aux, DP_MSTM_CTRL, buf, 1);
 		seq_printf(m, "mst ctrl: %*ph\n", 1, buf);
 
 		/* dump the standard OUI branch header */
-		ret = drm_dp_dpcd_read(mgr->aux, DP_BRANCH_OUI, buf, DP_BRANCH_OUI_HEADER_SIZE);
+		drm_dp_dpcd_read(mgr->aux, DP_BRANCH_OUI, buf, DP_BRANCH_OUI_HEADER_SIZE);
 		seq_printf(m, "branch oui: %*phN devid: ", 3, buf);
 		for (i = 0x3; i < 0x8 && buf[i]; i++)
 			seq_printf(m, "%c", buf[i]);
Signature · 1 line
2.15.0
#1 lore raw
Quoted 5 lines · Benjamin Gaignard

Fix the warnings that show up with W=1.
They are all about unused but set variables.
If functions returns are not used anymore make them void.

Quoted 7 lines

---
CC: Jani Nikula <[email protected]>

changes in version 3:
- remove the hunk that may conflict with c485e2c97dae ("drm/dp_mst: Refactor pdt setup/teardown, add more locking")

I have test today this patch on drm-misc-next where the other patch is present, it apply fine and I don't have warning anymore.

Benjamin

Quoted 309 lines

changes in version 2:
- fix indentations
- when possible change functions prototype to void

drivers/gpu/drm/drm_dp_mst_topology.c | 83 +++++++++++++----------------------

 1 file changed, 31 insertions(+), 52 deletions(-)
drivers/gpu/drm/drm_dp_mst_topology.c +31 -53
index 1437bc46368b..d5cb5688b5dd 100644
@@ -674,7 +674,6 @@ static bool drm_dp_sideband_msg_build(struct drm_dp_sideband_msg_rx *msg,
                                      u8 *replybuf, u8 replybuflen, bool hdr)
 {
        int ret;
-       u8 crc4;
 
        if (hdr) {
                u8 hdrlen;
@@ -716,8 +715,6 @@ static bool drm_dp_sideband_msg_build(struct drm_dp_sideband_msg_rx *msg,
        }
 
        if (msg->curchunk_idx >= msg->curchunk_len) {
-               /* do CRC */
-               crc4 = drm_dp_msg_data_crc4(msg->chunk, msg->curchunk_len - 1);
                /* copy chunk into bigger msg */
                memcpy(&msg->msg[msg->curlen], msg->chunk, msg->curchunk_len - 1);
                msg->curlen += msg->curchunk_len - 1;
@@ -1014,7 +1011,7 @@ static bool drm_dp_sideband_parse_req(struct drm_dp_sideband_msg_rx *raw,
        }
 }
 
-static int build_dpcd_write(struct drm_dp_sideband_msg_tx *msg, u8 port_num, u32 offset, u8 num_bytes, u8 *bytes)
+static void build_dpcd_write(struct drm_dp_sideband_msg_tx *msg, u8 port_num, u32 offset, u8 num_bytes, u8 *bytes)
 {
        struct drm_dp_sideband_msg_req_body req;
 
@@ -1024,17 +1021,14 @@ static int build_dpcd_write(struct drm_dp_sideband_msg_tx *msg, u8 port_num, u32
        req.u.dpcd_write.num_bytes = num_bytes;
        req.u.dpcd_write.bytes = bytes;
        drm_dp_encode_sideband_req(&req, msg);
-
-       return 0;
 }
 
-static int build_link_address(struct drm_dp_sideband_msg_tx *msg)
+static void build_link_address(struct drm_dp_sideband_msg_tx *msg)
 {
        struct drm_dp_sideband_msg_req_body req;
 
        req.req_type = DP_LINK_ADDRESS;
        drm_dp_encode_sideband_req(&req, msg);
-       return 0;
 }
 
 static int build_enum_path_resources(struct drm_dp_sideband_msg_tx *msg, int port_num)
@@ -1048,7 +1042,7 @@ static int build_enum_path_resources(struct drm_dp_sideband_msg_tx *msg, int por
        return 0;
 }
 
-static int build_allocate_payload(struct drm_dp_sideband_msg_tx *msg, int port_num,
+static void build_allocate_payload(struct drm_dp_sideband_msg_tx *msg, int port_num,
                                  u8 vcpi, uint16_t pbn,
                                  u8 number_sdp_streams,
                                  u8 *sdp_stream_sink)
@@ -1064,10 +1058,9 @@ static int build_allocate_payload(struct drm_dp_sideband_msg_tx *msg, int port_n
                   number_sdp_streams);
        drm_dp_encode_sideband_req(&req, msg);
        msg->path_msg = true;
-       return 0;
 }
 
-static int build_power_updown_phy(struct drm_dp_sideband_msg_tx *msg,
+static void build_power_updown_phy(struct drm_dp_sideband_msg_tx *msg,
                                  int port_num, bool power_up)
 {
        struct drm_dp_sideband_msg_req_body req;
@@ -1080,7 +1073,6 @@ static int build_power_updown_phy(struct drm_dp_sideband_msg_tx *msg,
        req.u.port_num.port_number = port_num;
        drm_dp_encode_sideband_req(&req, msg);
        msg->path_msg = true;
-       return 0;
 }
 
 static int drm_dp_mst_assign_payload_id(struct drm_dp_mst_topology_mgr *mgr,
@@ -1746,14 +1738,13 @@ static u8 drm_dp_calculate_rad(struct drm_dp_mst_port *port,
  */
 static bool drm_dp_port_setup_pdt(struct drm_dp_mst_port *port)
 {
-       int ret;
        u8 rad[6], lct;
        bool send_link = false;
        switch (port->pdt) {
        case DP_PEER_DEVICE_DP_LEGACY_CONV:
        case DP_PEER_DEVICE_SST_SINK:
                /* add i2c over sideband */
-               ret = drm_dp_mst_register_i2c_bus(&port->aux);
+               drm_dp_mst_register_i2c_bus(&port->aux);
                break;
        case DP_PEER_DEVICE_MST_BRANCHING:
                lct = drm_dp_calculate_rad(port, rad);
@@ -1823,25 +1814,20 @@ ssize_t drm_dp_mst_dpcd_write(struct drm_dp_aux *aux,
 
 static void drm_dp_check_mstb_guid(struct drm_dp_mst_branch *mstb, u8 *guid)
 {
-       int ret;
-
        memcpy(mstb->guid, guid, 16);
 
        if (!drm_dp_validate_guid(mstb->mgr, mstb->guid)) {
                if (mstb->port_parent) {
-                       ret = drm_dp_send_dpcd_write(
-                                       mstb->mgr,
-                                       mstb->port_parent,
-                                       DP_GUID,
-                                       16,
-                                       mstb->guid);
+                       drm_dp_send_dpcd_write(mstb->mgr,
+                                              mstb->port_parent,
+                                              DP_GUID,
+                                              16,
+                                              mstb->guid);
                } else {
-
-                       ret = drm_dp_dpcd_write(
-                                       mstb->mgr->aux,
-                                       DP_GUID,
-                                       mstb->guid,
-                                       16);
+                       drm_dp_dpcd_write(mstb->mgr->aux,
+                                         DP_GUID,
+                                         mstb->guid,
+                                         16);
                }
        }
 }
@@ -2197,7 +2183,7 @@ static bool drm_dp_validate_guid(struct drm_dp_mst_topology_mgr *mgr,
        return false;
 }
 
-static int build_dpcd_read(struct drm_dp_sideband_msg_tx *msg, u8 port_num, u32 offset, u8 num_bytes)
+static void build_dpcd_read(struct drm_dp_sideband_msg_tx *msg, u8 port_num, u32 offset, u8 num_bytes)
 {
        struct drm_dp_sideband_msg_req_body req;
 
@@ -2206,8 +2192,6 @@ static int build_dpcd_read(struct drm_dp_sideband_msg_tx *msg, u8 port_num, u32
        req.u.dpcd_read.dpcd_address = offset;
        req.u.dpcd_read.num_bytes = num_bytes;
        drm_dp_encode_sideband_req(&req, msg);
-
-       return 0;
 }
 
 static int drm_dp_send_sideband_msg(struct drm_dp_mst_topology_mgr *mgr,
@@ -2429,14 +2413,14 @@ static void drm_dp_send_link_address(struct drm_dp_mst_topology_mgr *mgr,
 {
        struct drm_dp_sideband_msg_tx *txmsg;
        struct drm_dp_link_address_ack_reply *reply;
-       int i, len, ret;
+       int i, ret;
 
        txmsg = kzalloc(sizeof(*txmsg), GFP_KERNEL);
        if (!txmsg)
                return;
 
        txmsg->dst = mstb;
-       len = build_link_address(txmsg);
+       build_link_address(txmsg);
 
        mstb->link_address_sent = true;
        drm_dp_queue_down_tx(mgr, txmsg);
@@ -2478,7 +2462,6 @@ drm_dp_send_enum_path_resources(struct drm_dp_mst_topology_mgr *mgr,
 {
        struct drm_dp_enum_path_resources_ack_reply *path_res;
        struct drm_dp_sideband_msg_tx *txmsg;
-       int len;
        int ret;
 
        txmsg = kzalloc(sizeof(*txmsg), GFP_KERNEL);
@@ -2486,7 +2469,7 @@ drm_dp_send_enum_path_resources(struct drm_dp_mst_topology_mgr *mgr,
                return -ENOMEM;
 
        txmsg->dst = mstb;
-       len = build_enum_path_resources(txmsg, port->port_num);
+       build_enum_path_resources(txmsg, port->port_num);
 
        drm_dp_queue_down_tx(mgr, txmsg);
 
@@ -2569,7 +2552,7 @@ static int drm_dp_payload_send_msg(struct drm_dp_mst_topology_mgr *mgr,
 {
        struct drm_dp_sideband_msg_tx *txmsg;
        struct drm_dp_mst_branch *mstb;
-       int len, ret, port_num;
+       int ret, port_num;
        u8 sinks[DRM_DP_MAX_SDP_STREAMS];
        int i;
 
@@ -2594,9 +2577,9 @@ static int drm_dp_payload_send_msg(struct drm_dp_mst_topology_mgr *mgr,
                sinks[i] = i;
 
        txmsg->dst = mstb;
-       len = build_allocate_payload(txmsg, port_num,
-                                    id,
-                                    pbn, port->num_sdp_streams, sinks);
+       build_allocate_payload(txmsg, port_num,
+                              id,
+                              pbn, port->num_sdp_streams, sinks);
 
        drm_dp_queue_down_tx(mgr, txmsg);
 
@@ -2625,7 +2608,7 @@ int drm_dp_send_power_updown_phy(struct drm_dp_mst_topology_mgr *mgr,
                                 struct drm_dp_mst_port *port, bool power_up)
 {
        struct drm_dp_sideband_msg_tx *txmsg;
-       int len, ret;
+       int ret;
 
        port = drm_dp_mst_topology_get_port_validated(mgr, port);
        if (!port)
@@ -2638,7 +2621,7 @@ int drm_dp_send_power_updown_phy(struct drm_dp_mst_topology_mgr *mgr,
        }
 
        txmsg->dst = port->parent;
-       len = build_power_updown_phy(txmsg, port->port_num, power_up);
+       build_power_updown_phy(txmsg, port->port_num, power_up);
        drm_dp_queue_down_tx(mgr, txmsg);
 
        ret = drm_dp_mst_wait_tx_reply(port->parent, txmsg);
@@ -2858,7 +2841,6 @@ static int drm_dp_send_dpcd_read(struct drm_dp_mst_topology_mgr *mgr,
                                 struct drm_dp_mst_port *port,
                                 int offset, int size, u8 *bytes)
 {
-       int len;
        int ret = 0;
        struct drm_dp_sideband_msg_tx *txmsg;
        struct drm_dp_mst_branch *mstb;
@@ -2873,7 +2855,7 @@ static int drm_dp_send_dpcd_read(struct drm_dp_mst_topology_mgr *mgr,
                goto fail_put;
        }
 
-       len = build_dpcd_read(txmsg, port->port_num, offset, size);
+       build_dpcd_read(txmsg, port->port_num, offset, size);
        txmsg->dst = port->parent;
 
        drm_dp_queue_down_tx(mgr, txmsg);
@@ -2911,7 +2893,6 @@ static int drm_dp_send_dpcd_write(struct drm_dp_mst_topology_mgr *mgr,
                                  struct drm_dp_mst_port *port,
                                  int offset, int size, u8 *bytes)
 {
-       int len;
        int ret;
        struct drm_dp_sideband_msg_tx *txmsg;
        struct drm_dp_mst_branch *mstb;
@@ -2926,7 +2907,7 @@ static int drm_dp_send_dpcd_write(struct drm_dp_mst_topology_mgr *mgr,
                goto fail_put;
        }
 
-       len = build_dpcd_write(txmsg, port->port_num, offset, size, bytes);
+       build_dpcd_write(txmsg, port->port_num, offset, size, bytes);
        txmsg->dst = mstb;
 
        drm_dp_queue_down_tx(mgr, txmsg);
@@ -3149,7 +3130,7 @@ static bool drm_dp_get_one_sb_msg(struct drm_dp_mst_topology_mgr *mgr, bool up)
 {
        int len;
        u8 replyblock[32];
-       int replylen, origlen, curreply;
+       int replylen, curreply;
        int ret;
        struct drm_dp_sideband_msg_rx *msg;
        int basereg = up ? DP_SIDEBAND_MSG_UP_REQ_BASE : DP_SIDEBAND_MSG_DOWN_REP_BASE;
@@ -3169,7 +3150,6 @@ static bool drm_dp_get_one_sb_msg(struct drm_dp_mst_topology_mgr *mgr, bool up)
        }
        replylen = msg->curchunk_len + msg->curchunk_hdrlen;
 
-       origlen = replylen;
        replylen -= len;
        curreply = len;
        while (replylen > 0) {
@@ -3961,17 +3941,16 @@ void drm_dp_mst_dump_topology(struct seq_file *m,
        mutex_lock(&mgr->lock);
        if (mgr->mst_primary) {
                u8 buf[DP_PAYLOAD_TABLE_SIZE];
-               int ret;
 
-               ret = drm_dp_dpcd_read(mgr->aux, DP_DPCD_REV, buf, DP_RECEIVER_CAP_SIZE);
+               drm_dp_dpcd_read(mgr->aux, DP_DPCD_REV, buf, DP_RECEIVER_CAP_SIZE);
                seq_printf(m, "dpcd: %*ph\n", DP_RECEIVER_CAP_SIZE, buf);
-               ret = drm_dp_dpcd_read(mgr->aux, DP_FAUX_CAP, buf, 2);
+               drm_dp_dpcd_read(mgr->aux, DP_FAUX_CAP, buf, 2);
                seq_printf(m, "faux/mst: %*ph\n", 2, buf);
-               ret = drm_dp_dpcd_read(mgr->aux, DP_MSTM_CTRL, buf, 1);
+               drm_dp_dpcd_read(mgr->aux, DP_MSTM_CTRL, buf, 1);
                seq_printf(m, "mst ctrl: %*ph\n", 1, buf);
 
                /* dump the standard OUI branch header */
-               ret = drm_dp_dpcd_read(mgr->aux, DP_BRANCH_OUI, buf, DP_BRANCH_OUI_HEADER_SIZE);
+               drm_dp_dpcd_read(mgr->aux, DP_BRANCH_OUI, buf, DP_BRANCH_OUI_HEADER_SIZE);
                seq_printf(m, "branch oui: %*phN devid: ", 3, buf);
                for (i = 0x3; i < 0x8 && buf[i]; i++)
                        seq_printf(m, "%c", buf[i]);
--

2.15.0

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#2 lore raw
In reply to Benjamin Gaignard
Quoted 32 lines · Benjamin Gaignard

Fix the warnings that show up with W=1.
They are all about unused but set variables.
If functions returns are not used anymore make them void.

---
CC: Jani Nikula <[email protected]>

changes in version 3:
- remove the hunk that may conflict with c485e2c97dae ("drm/dp_mst: Refactor pdt setup/teardown, add more locking")

changes in version 2:
- fix indentations
- when possible change functions prototype to void

drivers/gpu/drm/drm_dp_mst_topology.c | 83 +++++++++++++----------------------

 1 file changed, 31 insertions(+), 52 deletions(-)
drivers/gpu/drm/drm_dp_mst_topology.c +0 -1
index 1437bc46368b..d5cb5688b5dd 100644
@@ -674,7 +674,6 @@ static bool drm_dp_sideband_msg_build(struct drm_dp_sideband_msg_rx *msg,
 				      u8 *replybuf, u8 replybuflen, bool hdr)
 {
 	int ret;
-	u8 crc4;
 
 	if (hdr) {
 		u8 hdrlen;

drivers/gpu/drm/drm_dp_mst_topology.c static bool drm_dp_sideband_msg_build(struct drm_dp_sideband_msg_rx *msg, · line 720

Quoted 5 lines
drivers/gpu/drm/drm_dp_mst_topology.c +0 -2
@@ -716,8 +715,6 @@ static bool drm_dp_sideband_msg_build(struct drm_dp_sideband_msg_rx *msg,
 	}
 
 	if (msg->curchunk_idx >= msg->curchunk_len) {
-		/* do CRC */
-		crc4 = drm_dp_msg_data_crc4(msg->chunk, msg->curchunk_len - 1);

Again, someone needs to check if crc4 should be *used* instead of thrown away. Blindly throwing stuff out is not the way to go.

BR,
Jani.

Quoted 276 lines
drivers/gpu/drm/drm_dp_mst_topology.c +31 -49
 		/* copy chunk into bigger msg */
 		memcpy(&msg->msg[msg->curlen], msg->chunk, msg->curchunk_len - 1);
 		msg->curlen += msg->curchunk_len - 1;
@@ -1014,7 +1011,7 @@ static bool drm_dp_sideband_parse_req(struct drm_dp_sideband_msg_rx *raw,
 	}
 }
 
-static int build_dpcd_write(struct drm_dp_sideband_msg_tx *msg, u8 port_num, u32 offset, u8 num_bytes, u8 *bytes)
+static void build_dpcd_write(struct drm_dp_sideband_msg_tx *msg, u8 port_num, u32 offset, u8 num_bytes, u8 *bytes)
 {
 	struct drm_dp_sideband_msg_req_body req;
 
@@ -1024,17 +1021,14 @@ static int build_dpcd_write(struct drm_dp_sideband_msg_tx *msg, u8 port_num, u32
 	req.u.dpcd_write.num_bytes = num_bytes;
 	req.u.dpcd_write.bytes = bytes;
 	drm_dp_encode_sideband_req(&req, msg);
-
-	return 0;
 }
 
-static int build_link_address(struct drm_dp_sideband_msg_tx *msg)
+static void build_link_address(struct drm_dp_sideband_msg_tx *msg)
 {
 	struct drm_dp_sideband_msg_req_body req;
 
 	req.req_type = DP_LINK_ADDRESS;
 	drm_dp_encode_sideband_req(&req, msg);
-	return 0;
 }
 
 static int build_enum_path_resources(struct drm_dp_sideband_msg_tx *msg, int port_num)
@@ -1048,7 +1042,7 @@ static int build_enum_path_resources(struct drm_dp_sideband_msg_tx *msg, int por
 	return 0;
 }
 
-static int build_allocate_payload(struct drm_dp_sideband_msg_tx *msg, int port_num,
+static void build_allocate_payload(struct drm_dp_sideband_msg_tx *msg, int port_num,
 				  u8 vcpi, uint16_t pbn,
 				  u8 number_sdp_streams,
 				  u8 *sdp_stream_sink)
@@ -1064,10 +1058,9 @@ static int build_allocate_payload(struct drm_dp_sideband_msg_tx *msg, int port_n
 		   number_sdp_streams);
 	drm_dp_encode_sideband_req(&req, msg);
 	msg->path_msg = true;
-	return 0;
 }
 
-static int build_power_updown_phy(struct drm_dp_sideband_msg_tx *msg,
+static void build_power_updown_phy(struct drm_dp_sideband_msg_tx *msg,
 				  int port_num, bool power_up)
 {
 	struct drm_dp_sideband_msg_req_body req;
@@ -1080,7 +1073,6 @@ static int build_power_updown_phy(struct drm_dp_sideband_msg_tx *msg,
 	req.u.port_num.port_number = port_num;
 	drm_dp_encode_sideband_req(&req, msg);
 	msg->path_msg = true;
-	return 0;
 }
 
 static int drm_dp_mst_assign_payload_id(struct drm_dp_mst_topology_mgr *mgr,
@@ -1746,14 +1738,13 @@ static u8 drm_dp_calculate_rad(struct drm_dp_mst_port *port,
  */
 static bool drm_dp_port_setup_pdt(struct drm_dp_mst_port *port)
 {
-	int ret;
 	u8 rad[6], lct;
 	bool send_link = false;
 	switch (port->pdt) {
 	case DP_PEER_DEVICE_DP_LEGACY_CONV:
 	case DP_PEER_DEVICE_SST_SINK:
 		/* add i2c over sideband */
-		ret = drm_dp_mst_register_i2c_bus(&port->aux);
+		drm_dp_mst_register_i2c_bus(&port->aux);
 		break;
 	case DP_PEER_DEVICE_MST_BRANCHING:
 		lct = drm_dp_calculate_rad(port, rad);
@@ -1823,25 +1814,20 @@ ssize_t drm_dp_mst_dpcd_write(struct drm_dp_aux *aux,
 
 static void drm_dp_check_mstb_guid(struct drm_dp_mst_branch *mstb, u8 *guid)
 {
-	int ret;
-
 	memcpy(mstb->guid, guid, 16);
 
 	if (!drm_dp_validate_guid(mstb->mgr, mstb->guid)) {
 		if (mstb->port_parent) {
-			ret = drm_dp_send_dpcd_write(
-					mstb->mgr,
-					mstb->port_parent,
-					DP_GUID,
-					16,
-					mstb->guid);
+			drm_dp_send_dpcd_write(mstb->mgr,
+					       mstb->port_parent,
+					       DP_GUID,
+					       16,
+					       mstb->guid);
 		} else {
-
-			ret = drm_dp_dpcd_write(
-					mstb->mgr->aux,
-					DP_GUID,
-					mstb->guid,
-					16);
+			drm_dp_dpcd_write(mstb->mgr->aux,
+					  DP_GUID,
+					  mstb->guid,
+					  16);
 		}
 	}
 }
@@ -2197,7 +2183,7 @@ static bool drm_dp_validate_guid(struct drm_dp_mst_topology_mgr *mgr,
 	return false;
 }
 
-static int build_dpcd_read(struct drm_dp_sideband_msg_tx *msg, u8 port_num, u32 offset, u8 num_bytes)
+static void build_dpcd_read(struct drm_dp_sideband_msg_tx *msg, u8 port_num, u32 offset, u8 num_bytes)
 {
 	struct drm_dp_sideband_msg_req_body req;
 
@@ -2206,8 +2192,6 @@ static int build_dpcd_read(struct drm_dp_sideband_msg_tx *msg, u8 port_num, u32
 	req.u.dpcd_read.dpcd_address = offset;
 	req.u.dpcd_read.num_bytes = num_bytes;
 	drm_dp_encode_sideband_req(&req, msg);
-
-	return 0;
 }
 
 static int drm_dp_send_sideband_msg(struct drm_dp_mst_topology_mgr *mgr,
@@ -2429,14 +2413,14 @@ static void drm_dp_send_link_address(struct drm_dp_mst_topology_mgr *mgr,
 {
 	struct drm_dp_sideband_msg_tx *txmsg;
 	struct drm_dp_link_address_ack_reply *reply;
-	int i, len, ret;
+	int i, ret;
 
 	txmsg = kzalloc(sizeof(*txmsg), GFP_KERNEL);
 	if (!txmsg)
 		return;
 
 	txmsg->dst = mstb;
-	len = build_link_address(txmsg);
+	build_link_address(txmsg);
 
 	mstb->link_address_sent = true;
 	drm_dp_queue_down_tx(mgr, txmsg);
@@ -2478,7 +2462,6 @@ drm_dp_send_enum_path_resources(struct drm_dp_mst_topology_mgr *mgr,
 {
 	struct drm_dp_enum_path_resources_ack_reply *path_res;
 	struct drm_dp_sideband_msg_tx *txmsg;
-	int len;
 	int ret;
 
 	txmsg = kzalloc(sizeof(*txmsg), GFP_KERNEL);
@@ -2486,7 +2469,7 @@ drm_dp_send_enum_path_resources(struct drm_dp_mst_topology_mgr *mgr,
 		return -ENOMEM;
 
 	txmsg->dst = mstb;
-	len = build_enum_path_resources(txmsg, port->port_num);
+	build_enum_path_resources(txmsg, port->port_num);
 
 	drm_dp_queue_down_tx(mgr, txmsg);
 
@@ -2569,7 +2552,7 @@ static int drm_dp_payload_send_msg(struct drm_dp_mst_topology_mgr *mgr,
 {
 	struct drm_dp_sideband_msg_tx *txmsg;
 	struct drm_dp_mst_branch *mstb;
-	int len, ret, port_num;
+	int ret, port_num;
 	u8 sinks[DRM_DP_MAX_SDP_STREAMS];
 	int i;
 
@@ -2594,9 +2577,9 @@ static int drm_dp_payload_send_msg(struct drm_dp_mst_topology_mgr *mgr,
 		sinks[i] = i;
 
 	txmsg->dst = mstb;
-	len = build_allocate_payload(txmsg, port_num,
-				     id,
-				     pbn, port->num_sdp_streams, sinks);
+	build_allocate_payload(txmsg, port_num,
+			       id,
+			       pbn, port->num_sdp_streams, sinks);
 
 	drm_dp_queue_down_tx(mgr, txmsg);
 
@@ -2625,7 +2608,7 @@ int drm_dp_send_power_updown_phy(struct drm_dp_mst_topology_mgr *mgr,
 				 struct drm_dp_mst_port *port, bool power_up)
 {
 	struct drm_dp_sideband_msg_tx *txmsg;
-	int len, ret;
+	int ret;
 
 	port = drm_dp_mst_topology_get_port_validated(mgr, port);
 	if (!port)
@@ -2638,7 +2621,7 @@ int drm_dp_send_power_updown_phy(struct drm_dp_mst_topology_mgr *mgr,
 	}
 
 	txmsg->dst = port->parent;
-	len = build_power_updown_phy(txmsg, port->port_num, power_up);
+	build_power_updown_phy(txmsg, port->port_num, power_up);
 	drm_dp_queue_down_tx(mgr, txmsg);
 
 	ret = drm_dp_mst_wait_tx_reply(port->parent, txmsg);
@@ -2858,7 +2841,6 @@ static int drm_dp_send_dpcd_read(struct drm_dp_mst_topology_mgr *mgr,
 				 struct drm_dp_mst_port *port,
 				 int offset, int size, u8 *bytes)
 {
-	int len;
 	int ret = 0;
 	struct drm_dp_sideband_msg_tx *txmsg;
 	struct drm_dp_mst_branch *mstb;
@@ -2873,7 +2855,7 @@ static int drm_dp_send_dpcd_read(struct drm_dp_mst_topology_mgr *mgr,
 		goto fail_put;
 	}
 
-	len = build_dpcd_read(txmsg, port->port_num, offset, size);
+	build_dpcd_read(txmsg, port->port_num, offset, size);
 	txmsg->dst = port->parent;
 
 	drm_dp_queue_down_tx(mgr, txmsg);
@@ -2911,7 +2893,6 @@ static int drm_dp_send_dpcd_write(struct drm_dp_mst_topology_mgr *mgr,
 				  struct drm_dp_mst_port *port,
 				  int offset, int size, u8 *bytes)
 {
-	int len;
 	int ret;
 	struct drm_dp_sideband_msg_tx *txmsg;
 	struct drm_dp_mst_branch *mstb;
@@ -2926,7 +2907,7 @@ static int drm_dp_send_dpcd_write(struct drm_dp_mst_topology_mgr *mgr,
 		goto fail_put;
 	}
 
-	len = build_dpcd_write(txmsg, port->port_num, offset, size, bytes);
+	build_dpcd_write(txmsg, port->port_num, offset, size, bytes);
 	txmsg->dst = mstb;
 
 	drm_dp_queue_down_tx(mgr, txmsg);
@@ -3149,7 +3130,7 @@ static bool drm_dp_get_one_sb_msg(struct drm_dp_mst_topology_mgr *mgr, bool up)
 {
 	int len;
 	u8 replyblock[32];
-	int replylen, origlen, curreply;
+	int replylen, curreply;
 	int ret;
 	struct drm_dp_sideband_msg_rx *msg;
 	int basereg = up ? DP_SIDEBAND_MSG_UP_REQ_BASE : DP_SIDEBAND_MSG_DOWN_REP_BASE;
@@ -3169,7 +3150,6 @@ static bool drm_dp_get_one_sb_msg(struct drm_dp_mst_topology_mgr *mgr, bool up)
 	}
 	replylen = msg->curchunk_len + msg->curchunk_hdrlen;
 
-	origlen = replylen;
 	replylen -= len;
 	curreply = len;
 	while (replylen > 0) {
@@ -3961,17 +3941,16 @@ void drm_dp_mst_dump_topology(struct seq_file *m,
 	mutex_lock(&mgr->lock);
 	if (mgr->mst_primary) {
 		u8 buf[DP_PAYLOAD_TABLE_SIZE];
-		int ret;
 
-		ret = drm_dp_dpcd_read(mgr->aux, DP_DPCD_REV, buf, DP_RECEIVER_CAP_SIZE);
+		drm_dp_dpcd_read(mgr->aux, DP_DPCD_REV, buf, DP_RECEIVER_CAP_SIZE);
 		seq_printf(m, "dpcd: %*ph\n", DP_RECEIVER_CAP_SIZE, buf);
-		ret = drm_dp_dpcd_read(mgr->aux, DP_FAUX_CAP, buf, 2);
+		drm_dp_dpcd_read(mgr->aux, DP_FAUX_CAP, buf, 2);
 		seq_printf(m, "faux/mst: %*ph\n", 2, buf);
-		ret = drm_dp_dpcd_read(mgr->aux, DP_MSTM_CTRL, buf, 1);
+		drm_dp_dpcd_read(mgr->aux, DP_MSTM_CTRL, buf, 1);
 		seq_printf(m, "mst ctrl: %*ph\n", 1, buf);
 
 		/* dump the standard OUI branch header */
-		ret = drm_dp_dpcd_read(mgr->aux, DP_BRANCH_OUI, buf, DP_BRANCH_OUI_HEADER_SIZE);
+		drm_dp_dpcd_read(mgr->aux, DP_BRANCH_OUI, buf, DP_BRANCH_OUI_HEADER_SIZE);
 		seq_printf(m, "branch oui: %*phN devid: ", 3, buf);
 		for (i = 0x3; i < 0x8 && buf[i]; i++)
 			seq_printf(m, "%c", buf[i]);
Signature · 1 line
Jani Nikula, Intel Open Source Graphics Center
#3 lore raw
Quoted 36 lines · Jani Nikula
Quoted 34 lines · Benjamin Gaignard

Fix the warnings that show up with W=1.
They are all about unused but set variables.
If functions returns are not used anymore make them void.

---
CC: Jani Nikula <[email protected]>

changes in version 3:
- remove the hunk that may conflict with c485e2c97dae ("drm/dp_mst: Refactor pdt setup/teardown, add more locking")

changes in version 2:
- fix indentations
- when possible change functions prototype to void

drivers/gpu/drm/drm_dp_mst_topology.c | 83 +++++++++++++----------------------

 1 file changed, 31 insertions(+), 52 deletions(-)
drivers/gpu/drm/drm_dp_mst_topology.c +0 -1
index 1437bc46368b..d5cb5688b5dd 100644
@@ -674,7 +674,6 @@ static bool drm_dp_sideband_msg_build(struct drm_dp_sideband_msg_rx *msg,
                                    u8 *replybuf, u8 replybuflen, bool hdr)
 {
      int ret;
-     u8 crc4;
 
      if (hdr) {
              u8 hdrlen;
@@ -716,8 +715,6 @@ static bool drm_dp_sideband_msg_build(struct drm_dp_sideband_msg_rx *msg,
      }
 
Quoted 6 lines

drivers/gpu/drm/drm_dp_mst_topology.c static bool drm_dp_sideband_msg_build(struct drm_dp_sideband_msg_rx *msg, · line 720

Quoted 3 lines
drivers/gpu/drm/drm_dp_mst_topology.c +0 -2
      if (msg->curchunk_idx >= msg->curchunk_len) {
-             /* do CRC */
-             crc4 = drm_dp_msg_data_crc4(msg->chunk, msg->curchunk_len - 1);

Again, someone needs to check if crc4 should be *used* instead of thrown away. Blindly throwing stuff out is not the way to go.

Hi Dave,

Your are the original writer of this code, could you tell us if we can drop crc4 ao if there is something else that I have misunderstood ?

Thanks,
Benjamin

Quoted 274 lines

BR,
Jani.

Quoted 270 lines
drivers/gpu/drm/drm_dp_mst_topology.c +30 -48
              /* copy chunk into bigger msg */
              memcpy(&msg->msg[msg->curlen], msg->chunk, msg->curchunk_len - 1);
              msg->curlen += msg->curchunk_len - 1;
@@ -1014,7 +1011,7 @@ static bool drm_dp_sideband_parse_req(struct drm_dp_sideband_msg_rx *raw,
      }
 }
 
-static int build_dpcd_write(struct drm_dp_sideband_msg_tx *msg, u8 port_num, u32 offset, u8 num_bytes, u8 *bytes)
+static void build_dpcd_write(struct drm_dp_sideband_msg_tx *msg, u8 port_num, u32 offset, u8 num_bytes, u8 *bytes)
 {
      struct drm_dp_sideband_msg_req_body req;
 
@@ -1024,17 +1021,14 @@ static int build_dpcd_write(struct drm_dp_sideband_msg_tx *msg, u8 port_num, u32
      req.u.dpcd_write.num_bytes = num_bytes;
      req.u.dpcd_write.bytes = bytes;
      drm_dp_encode_sideband_req(&req, msg);
-
-     return 0;
 }
 
-static int build_link_address(struct drm_dp_sideband_msg_tx *msg)
+static void build_link_address(struct drm_dp_sideband_msg_tx *msg)
 {
      struct drm_dp_sideband_msg_req_body req;
 
      req.req_type = DP_LINK_ADDRESS;
      drm_dp_encode_sideband_req(&req, msg);
-     return 0;
 }
 
 static int build_enum_path_resources(struct drm_dp_sideband_msg_tx *msg, int port_num)
@@ -1048,7 +1042,7 @@ static int build_enum_path_resources(struct drm_dp_sideband_msg_tx *msg, int por
      return 0;
 }
 
-static int build_allocate_payload(struct drm_dp_sideband_msg_tx *msg, int port_num,
+static void build_allocate_payload(struct drm_dp_sideband_msg_tx *msg, int port_num,
                                u8 vcpi, uint16_t pbn,
                                u8 number_sdp_streams,
                                u8 *sdp_stream_sink)
@@ -1064,10 +1058,9 @@ static int build_allocate_payload(struct drm_dp_sideband_msg_tx *msg, int port_n
                 number_sdp_streams);
      drm_dp_encode_sideband_req(&req, msg);
      msg->path_msg = true;
-     return 0;
 }
 
-static int build_power_updown_phy(struct drm_dp_sideband_msg_tx *msg,
+static void build_power_updown_phy(struct drm_dp_sideband_msg_tx *msg,
                                int port_num, bool power_up)
 {
      struct drm_dp_sideband_msg_req_body req;
@@ -1080,7 +1073,6 @@ static int build_power_updown_phy(struct drm_dp_sideband_msg_tx *msg,
      req.u.port_num.port_number = port_num;
      drm_dp_encode_sideband_req(&req, msg);
      msg->path_msg = true;
-     return 0;
 }
 
 static int drm_dp_mst_assign_payload_id(struct drm_dp_mst_topology_mgr *mgr,
@@ -1746,14 +1738,13 @@ static u8 drm_dp_calculate_rad(struct drm_dp_mst_port *port,
  */
 static bool drm_dp_port_setup_pdt(struct drm_dp_mst_port *port)
 {
-     int ret;
      u8 rad[6], lct;
      bool send_link = false;
      switch (port->pdt) {
      case DP_PEER_DEVICE_DP_LEGACY_CONV:
      case DP_PEER_DEVICE_SST_SINK:
              /* add i2c over sideband */
-             ret = drm_dp_mst_register_i2c_bus(&port->aux);
+             drm_dp_mst_register_i2c_bus(&port->aux);
              break;
      case DP_PEER_DEVICE_MST_BRANCHING:
              lct = drm_dp_calculate_rad(port, rad);
@@ -1823,25 +1814,20 @@ ssize_t drm_dp_mst_dpcd_write(struct drm_dp_aux *aux,
 
 static void drm_dp_check_mstb_guid(struct drm_dp_mst_branch *mstb, u8 *guid)
 {
-     int ret;
-
      memcpy(mstb->guid, guid, 16);
 
      if (!drm_dp_validate_guid(mstb->mgr, mstb->guid)) {
              if (mstb->port_parent) {
-                     ret = drm_dp_send_dpcd_write(
-                                     mstb->mgr,
-                                     mstb->port_parent,
-                                     DP_GUID,
-                                     16,
-                                     mstb->guid);
+                     drm_dp_send_dpcd_write(mstb->mgr,
+                                            mstb->port_parent,
+                                            DP_GUID,
+                                            16,
+                                            mstb->guid);
              } else {
-
-                     ret = drm_dp_dpcd_write(
-                                     mstb->mgr->aux,
-                                     DP_GUID,
-                                     mstb->guid,
-                                     16);
+                     drm_dp_dpcd_write(mstb->mgr->aux,
+                                       DP_GUID,
+                                       mstb->guid,
+                                       16);
              }
      }
 }
@@ -2197,7 +2183,7 @@ static bool drm_dp_validate_guid(struct drm_dp_mst_topology_mgr *mgr,
      return false;
 }
 
-static int build_dpcd_read(struct drm_dp_sideband_msg_tx *msg, u8 port_num, u32 offset, u8 num_bytes)
+static void build_dpcd_read(struct drm_dp_sideband_msg_tx *msg, u8 port_num, u32 offset, u8 num_bytes)
 {
      struct drm_dp_sideband_msg_req_body req;
 
@@ -2206,8 +2192,6 @@ static int build_dpcd_read(struct drm_dp_sideband_msg_tx *msg, u8 port_num, u32
      req.u.dpcd_read.dpcd_address = offset;
      req.u.dpcd_read.num_bytes = num_bytes;
      drm_dp_encode_sideband_req(&req, msg);
-
-     return 0;
 }
 
 static int drm_dp_send_sideband_msg(struct drm_dp_mst_topology_mgr *mgr,
@@ -2429,14 +2413,14 @@ static void drm_dp_send_link_address(struct drm_dp_mst_topology_mgr *mgr,
 {
      struct drm_dp_sideband_msg_tx *txmsg;
      struct drm_dp_link_address_ack_reply *reply;
-     int i, len, ret;
+     int i, ret;
 
      txmsg = kzalloc(sizeof(*txmsg), GFP_KERNEL);
      if (!txmsg)
              return;
 
      txmsg->dst = mstb;
-     len = build_link_address(txmsg);
+     build_link_address(txmsg);
 
      mstb->link_address_sent = true;
      drm_dp_queue_down_tx(mgr, txmsg);
@@ -2478,7 +2462,6 @@ drm_dp_send_enum_path_resources(struct drm_dp_mst_topology_mgr *mgr,
 {
      struct drm_dp_enum_path_resources_ack_reply *path_res;
      struct drm_dp_sideband_msg_tx *txmsg;
-     int len;
      int ret;
 
      txmsg = kzalloc(sizeof(*txmsg), GFP_KERNEL);
@@ -2486,7 +2469,7 @@ drm_dp_send_enum_path_resources(struct drm_dp_mst_topology_mgr *mgr,
              return -ENOMEM;
 
      txmsg->dst = mstb;
-     len = build_enum_path_resources(txmsg, port->port_num);
+     build_enum_path_resources(txmsg, port->port_num);
 
      drm_dp_queue_down_tx(mgr, txmsg);
 
@@ -2569,7 +2552,7 @@ static int drm_dp_payload_send_msg(struct drm_dp_mst_topology_mgr *mgr,
 {
      struct drm_dp_sideband_msg_tx *txmsg;
      struct drm_dp_mst_branch *mstb;
-     int len, ret, port_num;
+     int ret, port_num;
      u8 sinks[DRM_DP_MAX_SDP_STREAMS];
      int i;
 
@@ -2594,9 +2577,9 @@ static int drm_dp_payload_send_msg(struct drm_dp_mst_topology_mgr *mgr,
              sinks[i] = i;
 
      txmsg->dst = mstb;
-     len = build_allocate_payload(txmsg, port_num,
-                                  id,
-                                  pbn, port->num_sdp_streams, sinks);
+     build_allocate_payload(txmsg, port_num,
+                            id,
+                            pbn, port->num_sdp_streams, sinks);
 
      drm_dp_queue_down_tx(mgr, txmsg);
 
@@ -2625,7 +2608,7 @@ int drm_dp_send_power_updown_phy(struct drm_dp_mst_topology_mgr *mgr,
                               struct drm_dp_mst_port *port, bool power_up)
 {
      struct drm_dp_sideband_msg_tx *txmsg;
-     int len, ret;
+     int ret;
 
      port = drm_dp_mst_topology_get_port_validated(mgr, port);
      if (!port)
@@ -2638,7 +2621,7 @@ int drm_dp_send_power_updown_phy(struct drm_dp_mst_topology_mgr *mgr,
      }
 
      txmsg->dst = port->parent;
-     len = build_power_updown_phy(txmsg, port->port_num, power_up);
+     build_power_updown_phy(txmsg, port->port_num, power_up);
      drm_dp_queue_down_tx(mgr, txmsg);
 
      ret = drm_dp_mst_wait_tx_reply(port->parent, txmsg);
@@ -2858,7 +2841,6 @@ static int drm_dp_send_dpcd_read(struct drm_dp_mst_topology_mgr *mgr,
                               struct drm_dp_mst_port *port,
                               int offset, int size, u8 *bytes)
 {
-     int len;
      int ret = 0;
      struct drm_dp_sideband_msg_tx *txmsg;
      struct drm_dp_mst_branch *mstb;
@@ -2873,7 +2855,7 @@ static int drm_dp_send_dpcd_read(struct drm_dp_mst_topology_mgr *mgr,
              goto fail_put;
      }
 
-     len = build_dpcd_read(txmsg, port->port_num, offset, size);
+     build_dpcd_read(txmsg, port->port_num, offset, size);
      txmsg->dst = port->parent;
 
      drm_dp_queue_down_tx(mgr, txmsg);
@@ -2911,7 +2893,6 @@ static int drm_dp_send_dpcd_write(struct drm_dp_mst_topology_mgr *mgr,
                                struct drm_dp_mst_port *port,
                                int offset, int size, u8 *bytes)
 {
-     int len;
      int ret;
      struct drm_dp_sideband_msg_tx *txmsg;
      struct drm_dp_mst_branch *mstb;
@@ -2926,7 +2907,7 @@ static int drm_dp_send_dpcd_write(struct drm_dp_mst_topology_mgr *mgr,
              goto fail_put;
      }
 
-     len = build_dpcd_write(txmsg, port->port_num, offset, size, bytes);
+     build_dpcd_write(txmsg, port->port_num, offset, size, bytes);
      txmsg->dst = mstb;
 
      drm_dp_queue_down_tx(mgr, txmsg);
@@ -3149,7 +3130,7 @@ static bool drm_dp_get_one_sb_msg(struct drm_dp_mst_topology_mgr *mgr, bool up)
 {
      int len;
      u8 replyblock[32];
-     int replylen, origlen, curreply;
+     int replylen, curreply;
      int ret;
      struct drm_dp_sideband_msg_rx *msg;
      int basereg = up ? DP_SIDEBAND_MSG_UP_REQ_BASE : DP_SIDEBAND_MSG_DOWN_REP_BASE;
@@ -3169,7 +3150,6 @@ static bool drm_dp_get_one_sb_msg(struct drm_dp_mst_topology_mgr *mgr, bool up)
      }
      replylen = msg->curchunk_len + msg->curchunk_hdrlen;
 
-     origlen = replylen;
      replylen -= len;
      curreply = len;
      while (replylen > 0) {
@@ -3961,17 +3941,16 @@ void drm_dp_mst_dump_topology(struct seq_file *m,
      mutex_lock(&mgr->lock);
      if (mgr->mst_primary) {
              u8 buf[DP_PAYLOAD_TABLE_SIZE];
-             int ret;
 
-             ret = drm_dp_dpcd_read(mgr->aux, DP_DPCD_REV, buf, DP_RECEIVER_CAP_SIZE);
+             drm_dp_dpcd_read(mgr->aux, DP_DPCD_REV, buf, DP_RECEIVER_CAP_SIZE);
              seq_printf(m, "dpcd: %*ph\n", DP_RECEIVER_CAP_SIZE, buf);
-             ret = drm_dp_dpcd_read(mgr->aux, DP_FAUX_CAP, buf, 2);
+             drm_dp_dpcd_read(mgr->aux, DP_FAUX_CAP, buf, 2);
              seq_printf(m, "faux/mst: %*ph\n", 2, buf);
-             ret = drm_dp_dpcd_read(mgr->aux, DP_MSTM_CTRL, buf, 1);
+             drm_dp_dpcd_read(mgr->aux, DP_MSTM_CTRL, buf, 1);
              seq_printf(m, "mst ctrl: %*ph\n", 1, buf);
 
Quoted 13 lines

drivers/gpu/drm/drm_dp_mst_topology.c void drm_dp_mst_dump_topology(struct seq_file *m, · line 3956

Quoted 6 lines
drivers/gpu/drm/drm_dp_mst_topology.c +1 -1
              /* dump the standard OUI branch header */
-             ret = drm_dp_dpcd_read(mgr->aux, DP_BRANCH_OUI, buf, DP_BRANCH_OUI_HEADER_SIZE);
+             drm_dp_dpcd_read(mgr->aux, DP_BRANCH_OUI, buf, DP_BRANCH_OUI_HEADER_SIZE);
              seq_printf(m, "branch oui: %*phN devid: ", 3, buf);
              for (i = 0x3; i < 0x8 && buf[i]; i++)
                      seq_printf(m, "%c", buf[i]);

--
Jani Nikula, Intel Open Source Graphics Center
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#4 lore raw
Quoted 38 lines · Benjamin Gaignard
Quoted 36 lines · Jani Nikula
Quoted 34 lines · Benjamin Gaignard

Fix the warnings that show up with W=1.
They are all about unused but set variables.
If functions returns are not used anymore make them void.

---
CC: Jani Nikula <[email protected]>

changes in version 3:
- remove the hunk that may conflict with c485e2c97dae ("drm/dp_mst: Refactor pdt setup/teardown, add more locking")

changes in version 2:
- fix indentations
- when possible change functions prototype to void

drivers/gpu/drm/drm_dp_mst_topology.c | 83 +++++++++++++----------------------

 1 file changed, 31 insertions(+), 52 deletions(-)
drivers/gpu/drm/drm_dp_mst_topology.c +0 -1
index 1437bc46368b..d5cb5688b5dd 100644
@@ -674,7 +674,6 @@ static bool drm_dp_sideband_msg_build(struct drm_dp_sideband_msg_rx *msg,
                                    u8 *replybuf, u8 replybuflen, bool hdr)
 {
      int ret;
-     u8 crc4;
 
      if (hdr) {
              u8 hdrlen;
@@ -716,8 +715,6 @@ static bool drm_dp_sideband_msg_build(struct drm_dp_sideband_msg_rx *msg,
      }
 
Quoted 9 lines
Quoted 6 lines

drivers/gpu/drm/drm_dp_mst_topology.c static bool drm_dp_sideband_msg_build(struct drm_dp_sideband_msg_rx *msg, · line 720

Quoted 3 lines
drivers/gpu/drm/drm_dp_mst_topology.c +0 -2
      if (msg->curchunk_idx >= msg->curchunk_len) {
-             /* do CRC */
-             crc4 = drm_dp_msg_data_crc4(msg->chunk, msg->curchunk_len - 1);

Again, someone needs to check if crc4 should be *used* instead of thrown away. Blindly throwing stuff out is not the way to go.

Hi Dave,

+ Lyude who has been hacking in this code recently

Quoted 293 lines

Your are the original writer of this code, could you tell us if we can drop crc4 ao if there is something else that I have misunderstood ?

Thanks,
Benjamin

Quoted 287 lines

BR,
Jani.

Quoted 266 lines
drivers/gpu/drm/drm_dp_mst_topology.c +29 -47
              /* copy chunk into bigger msg */
              memcpy(&msg->msg[msg->curlen], msg->chunk, msg->curchunk_len - 1);
              msg->curlen += msg->curchunk_len - 1;
@@ -1014,7 +1011,7 @@ static bool drm_dp_sideband_parse_req(struct drm_dp_sideband_msg_rx *raw,
      }
 }
 
-static int build_dpcd_write(struct drm_dp_sideband_msg_tx *msg, u8 port_num, u32 offset, u8 num_bytes, u8 *bytes)
+static void build_dpcd_write(struct drm_dp_sideband_msg_tx *msg, u8 port_num, u32 offset, u8 num_bytes, u8 *bytes)
 {
      struct drm_dp_sideband_msg_req_body req;
 
@@ -1024,17 +1021,14 @@ static int build_dpcd_write(struct drm_dp_sideband_msg_tx *msg, u8 port_num, u32
      req.u.dpcd_write.num_bytes = num_bytes;
      req.u.dpcd_write.bytes = bytes;
      drm_dp_encode_sideband_req(&req, msg);
-
-     return 0;
 }
 
-static int build_link_address(struct drm_dp_sideband_msg_tx *msg)
+static void build_link_address(struct drm_dp_sideband_msg_tx *msg)
 {
      struct drm_dp_sideband_msg_req_body req;
 
      req.req_type = DP_LINK_ADDRESS;
      drm_dp_encode_sideband_req(&req, msg);
-     return 0;
 }
 
 static int build_enum_path_resources(struct drm_dp_sideband_msg_tx *msg, int port_num)
@@ -1048,7 +1042,7 @@ static int build_enum_path_resources(struct drm_dp_sideband_msg_tx *msg, int por
      return 0;
 }
 
-static int build_allocate_payload(struct drm_dp_sideband_msg_tx *msg, int port_num,
+static void build_allocate_payload(struct drm_dp_sideband_msg_tx *msg, int port_num,
                                u8 vcpi, uint16_t pbn,
                                u8 number_sdp_streams,
                                u8 *sdp_stream_sink)
@@ -1064,10 +1058,9 @@ static int build_allocate_payload(struct drm_dp_sideband_msg_tx *msg, int port_n
                 number_sdp_streams);
      drm_dp_encode_sideband_req(&req, msg);
      msg->path_msg = true;
-     return 0;
 }
 
-static int build_power_updown_phy(struct drm_dp_sideband_msg_tx *msg,
+static void build_power_updown_phy(struct drm_dp_sideband_msg_tx *msg,
                                int port_num, bool power_up)
 {
      struct drm_dp_sideband_msg_req_body req;
@@ -1080,7 +1073,6 @@ static int build_power_updown_phy(struct drm_dp_sideband_msg_tx *msg,
      req.u.port_num.port_number = port_num;
      drm_dp_encode_sideband_req(&req, msg);
      msg->path_msg = true;
-     return 0;
 }
 
 static int drm_dp_mst_assign_payload_id(struct drm_dp_mst_topology_mgr *mgr,
@@ -1746,14 +1738,13 @@ static u8 drm_dp_calculate_rad(struct drm_dp_mst_port *port,
  */
 static bool drm_dp_port_setup_pdt(struct drm_dp_mst_port *port)
 {
-     int ret;
      u8 rad[6], lct;
      bool send_link = false;
      switch (port->pdt) {
      case DP_PEER_DEVICE_DP_LEGACY_CONV:
      case DP_PEER_DEVICE_SST_SINK:
              /* add i2c over sideband */
-             ret = drm_dp_mst_register_i2c_bus(&port->aux);
+             drm_dp_mst_register_i2c_bus(&port->aux);
              break;
      case DP_PEER_DEVICE_MST_BRANCHING:
              lct = drm_dp_calculate_rad(port, rad);
@@ -1823,25 +1814,20 @@ ssize_t drm_dp_mst_dpcd_write(struct drm_dp_aux *aux,
 
 static void drm_dp_check_mstb_guid(struct drm_dp_mst_branch *mstb, u8 *guid)
 {
-     int ret;
-
      memcpy(mstb->guid, guid, 16);
 
      if (!drm_dp_validate_guid(mstb->mgr, mstb->guid)) {
              if (mstb->port_parent) {
-                     ret = drm_dp_send_dpcd_write(
-                                     mstb->mgr,
-                                     mstb->port_parent,
-                                     DP_GUID,
-                                     16,
-                                     mstb->guid);
+                     drm_dp_send_dpcd_write(mstb->mgr,
+                                            mstb->port_parent,
+                                            DP_GUID,
+                                            16,
+                                            mstb->guid);
              } else {
-
-                     ret = drm_dp_dpcd_write(
-                                     mstb->mgr->aux,
-                                     DP_GUID,
-                                     mstb->guid,
-                                     16);
+                     drm_dp_dpcd_write(mstb->mgr->aux,
+                                       DP_GUID,
+                                       mstb->guid,
+                                       16);
              }
      }
 }
@@ -2197,7 +2183,7 @@ static bool drm_dp_validate_guid(struct drm_dp_mst_topology_mgr *mgr,
      return false;
 }
 
-static int build_dpcd_read(struct drm_dp_sideband_msg_tx *msg, u8 port_num, u32 offset, u8 num_bytes)
+static void build_dpcd_read(struct drm_dp_sideband_msg_tx *msg, u8 port_num, u32 offset, u8 num_bytes)
 {
      struct drm_dp_sideband_msg_req_body req;
 
@@ -2206,8 +2192,6 @@ static int build_dpcd_read(struct drm_dp_sideband_msg_tx *msg, u8 port_num, u32
      req.u.dpcd_read.dpcd_address = offset;
      req.u.dpcd_read.num_bytes = num_bytes;
      drm_dp_encode_sideband_req(&req, msg);
-
-     return 0;
 }
 
 static int drm_dp_send_sideband_msg(struct drm_dp_mst_topology_mgr *mgr,
@@ -2429,14 +2413,14 @@ static void drm_dp_send_link_address(struct drm_dp_mst_topology_mgr *mgr,
 {
      struct drm_dp_sideband_msg_tx *txmsg;
      struct drm_dp_link_address_ack_reply *reply;
-     int i, len, ret;
+     int i, ret;
 
      txmsg = kzalloc(sizeof(*txmsg), GFP_KERNEL);
      if (!txmsg)
              return;
 
      txmsg->dst = mstb;
-     len = build_link_address(txmsg);
+     build_link_address(txmsg);
 
      mstb->link_address_sent = true;
      drm_dp_queue_down_tx(mgr, txmsg);
@@ -2478,7 +2462,6 @@ drm_dp_send_enum_path_resources(struct drm_dp_mst_topology_mgr *mgr,
 {
      struct drm_dp_enum_path_resources_ack_reply *path_res;
      struct drm_dp_sideband_msg_tx *txmsg;
-     int len;
      int ret;
 
      txmsg = kzalloc(sizeof(*txmsg), GFP_KERNEL);
@@ -2486,7 +2469,7 @@ drm_dp_send_enum_path_resources(struct drm_dp_mst_topology_mgr *mgr,
              return -ENOMEM;
 
      txmsg->dst = mstb;
-     len = build_enum_path_resources(txmsg, port->port_num);
+     build_enum_path_resources(txmsg, port->port_num);
 
      drm_dp_queue_down_tx(mgr, txmsg);
 
@@ -2569,7 +2552,7 @@ static int drm_dp_payload_send_msg(struct drm_dp_mst_topology_mgr *mgr,
 {
      struct drm_dp_sideband_msg_tx *txmsg;
      struct drm_dp_mst_branch *mstb;
-     int len, ret, port_num;
+     int ret, port_num;
      u8 sinks[DRM_DP_MAX_SDP_STREAMS];
      int i;
 
@@ -2594,9 +2577,9 @@ static int drm_dp_payload_send_msg(struct drm_dp_mst_topology_mgr *mgr,
              sinks[i] = i;
 
      txmsg->dst = mstb;
-     len = build_allocate_payload(txmsg, port_num,
-                                  id,
-                                  pbn, port->num_sdp_streams, sinks);
+     build_allocate_payload(txmsg, port_num,
+                            id,
+                            pbn, port->num_sdp_streams, sinks);
 
      drm_dp_queue_down_tx(mgr, txmsg);
 
@@ -2625,7 +2608,7 @@ int drm_dp_send_power_updown_phy(struct drm_dp_mst_topology_mgr *mgr,
                               struct drm_dp_mst_port *port, bool power_up)
 {
      struct drm_dp_sideband_msg_tx *txmsg;
-     int len, ret;
+     int ret;
 
      port = drm_dp_mst_topology_get_port_validated(mgr, port);
      if (!port)
@@ -2638,7 +2621,7 @@ int drm_dp_send_power_updown_phy(struct drm_dp_mst_topology_mgr *mgr,
      }
 
      txmsg->dst = port->parent;
-     len = build_power_updown_phy(txmsg, port->port_num, power_up);
+     build_power_updown_phy(txmsg, port->port_num, power_up);
      drm_dp_queue_down_tx(mgr, txmsg);
 
      ret = drm_dp_mst_wait_tx_reply(port->parent, txmsg);
@@ -2858,7 +2841,6 @@ static int drm_dp_send_dpcd_read(struct drm_dp_mst_topology_mgr *mgr,
                               struct drm_dp_mst_port *port,
                               int offset, int size, u8 *bytes)
 {
-     int len;
      int ret = 0;
      struct drm_dp_sideband_msg_tx *txmsg;
      struct drm_dp_mst_branch *mstb;
@@ -2873,7 +2855,7 @@ static int drm_dp_send_dpcd_read(struct drm_dp_mst_topology_mgr *mgr,
              goto fail_put;
      }
 
-     len = build_dpcd_read(txmsg, port->port_num, offset, size);
+     build_dpcd_read(txmsg, port->port_num, offset, size);
      txmsg->dst = port->parent;
 
      drm_dp_queue_down_tx(mgr, txmsg);
@@ -2911,7 +2893,6 @@ static int drm_dp_send_dpcd_write(struct drm_dp_mst_topology_mgr *mgr,
                                struct drm_dp_mst_port *port,
                                int offset, int size, u8 *bytes)
 {
-     int len;
      int ret;
      struct drm_dp_sideband_msg_tx *txmsg;
      struct drm_dp_mst_branch *mstb;
@@ -2926,7 +2907,7 @@ static int drm_dp_send_dpcd_write(struct drm_dp_mst_topology_mgr *mgr,
              goto fail_put;
      }
 
-     len = build_dpcd_write(txmsg, port->port_num, offset, size, bytes);
+     build_dpcd_write(txmsg, port->port_num, offset, size, bytes);
      txmsg->dst = mstb;
 
      drm_dp_queue_down_tx(mgr, txmsg);
@@ -3149,7 +3130,7 @@ static bool drm_dp_get_one_sb_msg(struct drm_dp_mst_topology_mgr *mgr, bool up)
 {
      int len;
      u8 replyblock[32];
-     int replylen, origlen, curreply;
+     int replylen, curreply;
      int ret;
      struct drm_dp_sideband_msg_rx *msg;
      int basereg = up ? DP_SIDEBAND_MSG_UP_REQ_BASE : DP_SIDEBAND_MSG_DOWN_REP_BASE;
@@ -3169,7 +3150,6 @@ static bool drm_dp_get_one_sb_msg(struct drm_dp_mst_topology_mgr *mgr, bool up)
      }
      replylen = msg->curchunk_len + msg->curchunk_hdrlen;
 
-     origlen = replylen;
      replylen -= len;
      curreply = len;
      while (replylen > 0) {
@@ -3961,17 +3941,16 @@ void drm_dp_mst_dump_topology(struct seq_file *m,
      mutex_lock(&mgr->lock);
      if (mgr->mst_primary) {
              u8 buf[DP_PAYLOAD_TABLE_SIZE];
-             int ret;
 
-             ret = drm_dp_dpcd_read(mgr->aux, DP_DPCD_REV, buf, DP_RECEIVER_CAP_SIZE);
+             drm_dp_dpcd_read(mgr->aux, DP_DPCD_REV, buf, DP_RECEIVER_CAP_SIZE);
              seq_printf(m, "dpcd: %*ph\n", DP_RECEIVER_CAP_SIZE, buf);
-             ret = drm_dp_dpcd_read(mgr->aux, DP_FAUX_CAP, buf, 2);
+             drm_dp_dpcd_read(mgr->aux, DP_FAUX_CAP, buf, 2);
              seq_printf(m, "faux/mst: %*ph\n", 2, buf);

drivers/gpu/drm/drm_dp_mst_topology.c void drm_dp_mst_dump_topology(struct seq_file *m, · line 3956

Quoted 10 lines
drivers/gpu/drm/drm_dp_mst_topology.c +2 -2
-             ret = drm_dp_dpcd_read(mgr->aux, DP_MSTM_CTRL, buf, 1);
+             drm_dp_dpcd_read(mgr->aux, DP_MSTM_CTRL, buf, 1);
              seq_printf(m, "mst ctrl: %*ph\n", 1, buf);
 
              /* dump the standard OUI branch header */
-             ret = drm_dp_dpcd_read(mgr->aux, DP_BRANCH_OUI, buf, DP_BRANCH_OUI_HEADER_SIZE);
+             drm_dp_dpcd_read(mgr->aux, DP_BRANCH_OUI, buf, DP_BRANCH_OUI_HEADER_SIZE);
              seq_printf(m, "branch oui: %*phN devid: ", 3, buf);
              for (i = 0x3; i < 0x8 && buf[i]; i++)
                      seq_printf(m, "%c", buf[i]);

--
Jani Nikula, Intel Open Source Graphics Center
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#5 lore raw
Quoted 48 lines · Benjamin Gaignard
Quoted 45 lines · Benjamin Gaignard
Quoted 42 lines · Jani Nikula
Quoted 32 lines · Benjamin Gaignard

Fix the warnings that show up with W=1.
They are all about unused but set variables.
If functions returns are not used anymore make them void.

---
CC: Jani Nikula <[email protected]>

changes in version 3:
- remove the hunk that may conflict with c485e2c97dae ("drm/dp_mst: Refactor pdt setup/teardown, add more locking")

changes in version 2:
- fix indentations
- when possible change functions prototype to void

drivers/gpu/drm/drm_dp_mst_topology.c | 83 +++++++++++++----------------------

 1 file changed, 31 insertions(+), 52 deletions(-)
drivers/gpu/drm/drm_dp_mst_topology.c +0 -1
index 1437bc46368b..d5cb5688b5dd 100644
@@ -674,7 +674,6 @@ static bool drm_dp_sideband_msg_build(struct drm_dp_sideband_msg_rx *msg,
                                    u8 *replybuf, u8 replybuflen, bool hdr)
 {
      int ret;
-     u8 crc4;
 
      if (hdr) {
              u8 hdrlen;

drivers/gpu/drm/drm_dp_mst_topology.c static bool drm_dp_sideband_msg_build(struct drm_dp_sideband_msg_rx *msg, · line 720

Quoted 5 lines
drivers/gpu/drm/drm_dp_mst_topology.c +0 -2
@@ -716,8 +715,6 @@ static bool drm_dp_sideband_msg_build(struct drm_dp_sideband_msg_rx *msg,
      }
 
      if (msg->curchunk_idx >= msg->curchunk_len) {
-             /* do CRC */
-             crc4 = drm_dp_msg_data_crc4(msg->chunk, msg->curchunk_len - 1);

Again, someone needs to check if crc4 should be *used* instead of thrown away. Blindly throwing stuff out is not the way to go.

Quoted 4 lines
Quoted 2 lines

Hi Dave,

+ Lyude who has been hacking in this code recently

gentle ping for the reviewers,

Thanks,
Benjamin

Quoted 281 lines
Quoted 281 lines

Your are the original writer of this code, could you tell us if we can drop crc4 ao if there is something else that I have misunderstood ?

Thanks,
Benjamin

Quoted 274 lines

BR,
Jani.

Quoted 270 lines
drivers/gpu/drm/drm_dp_mst_topology.c +30 -48
              /* copy chunk into bigger msg */
              memcpy(&msg->msg[msg->curlen], msg->chunk, msg->curchunk_len - 1);
              msg->curlen += msg->curchunk_len - 1;
@@ -1014,7 +1011,7 @@ static bool drm_dp_sideband_parse_req(struct drm_dp_sideband_msg_rx *raw,
      }
 }
 
-static int build_dpcd_write(struct drm_dp_sideband_msg_tx *msg, u8 port_num, u32 offset, u8 num_bytes, u8 *bytes)
+static void build_dpcd_write(struct drm_dp_sideband_msg_tx *msg, u8 port_num, u32 offset, u8 num_bytes, u8 *bytes)
 {
      struct drm_dp_sideband_msg_req_body req;
 
@@ -1024,17 +1021,14 @@ static int build_dpcd_write(struct drm_dp_sideband_msg_tx *msg, u8 port_num, u32
      req.u.dpcd_write.num_bytes = num_bytes;
      req.u.dpcd_write.bytes = bytes;
      drm_dp_encode_sideband_req(&req, msg);
-
-     return 0;
 }
 
-static int build_link_address(struct drm_dp_sideband_msg_tx *msg)
+static void build_link_address(struct drm_dp_sideband_msg_tx *msg)
 {
      struct drm_dp_sideband_msg_req_body req;
 
      req.req_type = DP_LINK_ADDRESS;
      drm_dp_encode_sideband_req(&req, msg);
-     return 0;
 }
 
 static int build_enum_path_resources(struct drm_dp_sideband_msg_tx *msg, int port_num)
@@ -1048,7 +1042,7 @@ static int build_enum_path_resources(struct drm_dp_sideband_msg_tx *msg, int por
      return 0;
 }
 
-static int build_allocate_payload(struct drm_dp_sideband_msg_tx *msg, int port_num,
+static void build_allocate_payload(struct drm_dp_sideband_msg_tx *msg, int port_num,
                                u8 vcpi, uint16_t pbn,
                                u8 number_sdp_streams,
                                u8 *sdp_stream_sink)
@@ -1064,10 +1058,9 @@ static int build_allocate_payload(struct drm_dp_sideband_msg_tx *msg, int port_n
                 number_sdp_streams);
      drm_dp_encode_sideband_req(&req, msg);
      msg->path_msg = true;
-     return 0;
 }
 
-static int build_power_updown_phy(struct drm_dp_sideband_msg_tx *msg,
+static void build_power_updown_phy(struct drm_dp_sideband_msg_tx *msg,
                                int port_num, bool power_up)
 {
      struct drm_dp_sideband_msg_req_body req;
@@ -1080,7 +1073,6 @@ static int build_power_updown_phy(struct drm_dp_sideband_msg_tx *msg,
      req.u.port_num.port_number = port_num;
      drm_dp_encode_sideband_req(&req, msg);
      msg->path_msg = true;
-     return 0;
 }
 
 static int drm_dp_mst_assign_payload_id(struct drm_dp_mst_topology_mgr *mgr,
@@ -1746,14 +1738,13 @@ static u8 drm_dp_calculate_rad(struct drm_dp_mst_port *port,
  */
 static bool drm_dp_port_setup_pdt(struct drm_dp_mst_port *port)
 {
-     int ret;
      u8 rad[6], lct;
      bool send_link = false;
      switch (port->pdt) {
      case DP_PEER_DEVICE_DP_LEGACY_CONV:
      case DP_PEER_DEVICE_SST_SINK:
              /* add i2c over sideband */
-             ret = drm_dp_mst_register_i2c_bus(&port->aux);
+             drm_dp_mst_register_i2c_bus(&port->aux);
              break;
      case DP_PEER_DEVICE_MST_BRANCHING:
              lct = drm_dp_calculate_rad(port, rad);
@@ -1823,25 +1814,20 @@ ssize_t drm_dp_mst_dpcd_write(struct drm_dp_aux *aux,
 
 static void drm_dp_check_mstb_guid(struct drm_dp_mst_branch *mstb, u8 *guid)
 {
-     int ret;
-
      memcpy(mstb->guid, guid, 16);
 
      if (!drm_dp_validate_guid(mstb->mgr, mstb->guid)) {
              if (mstb->port_parent) {
-                     ret = drm_dp_send_dpcd_write(
-                                     mstb->mgr,
-                                     mstb->port_parent,
-                                     DP_GUID,
-                                     16,
-                                     mstb->guid);
+                     drm_dp_send_dpcd_write(mstb->mgr,
+                                            mstb->port_parent,
+                                            DP_GUID,
+                                            16,
+                                            mstb->guid);
              } else {
-
-                     ret = drm_dp_dpcd_write(
-                                     mstb->mgr->aux,
-                                     DP_GUID,
-                                     mstb->guid,
-                                     16);
+                     drm_dp_dpcd_write(mstb->mgr->aux,
+                                       DP_GUID,
+                                       mstb->guid,
+                                       16);
              }
      }
 }
@@ -2197,7 +2183,7 @@ static bool drm_dp_validate_guid(struct drm_dp_mst_topology_mgr *mgr,
      return false;
 }
 
-static int build_dpcd_read(struct drm_dp_sideband_msg_tx *msg, u8 port_num, u32 offset, u8 num_bytes)
+static void build_dpcd_read(struct drm_dp_sideband_msg_tx *msg, u8 port_num, u32 offset, u8 num_bytes)
 {
      struct drm_dp_sideband_msg_req_body req;
 
@@ -2206,8 +2192,6 @@ static int build_dpcd_read(struct drm_dp_sideband_msg_tx *msg, u8 port_num, u32
      req.u.dpcd_read.dpcd_address = offset;
      req.u.dpcd_read.num_bytes = num_bytes;
      drm_dp_encode_sideband_req(&req, msg);
-
-     return 0;
 }
 
 static int drm_dp_send_sideband_msg(struct drm_dp_mst_topology_mgr *mgr,
@@ -2429,14 +2413,14 @@ static void drm_dp_send_link_address(struct drm_dp_mst_topology_mgr *mgr,
 {
      struct drm_dp_sideband_msg_tx *txmsg;
      struct drm_dp_link_address_ack_reply *reply;
-     int i, len, ret;
+     int i, ret;
 
      txmsg = kzalloc(sizeof(*txmsg), GFP_KERNEL);
      if (!txmsg)
              return;
 
      txmsg->dst = mstb;
-     len = build_link_address(txmsg);
+     build_link_address(txmsg);
 
      mstb->link_address_sent = true;
      drm_dp_queue_down_tx(mgr, txmsg);
@@ -2478,7 +2462,6 @@ drm_dp_send_enum_path_resources(struct drm_dp_mst_topology_mgr *mgr,
 {
      struct drm_dp_enum_path_resources_ack_reply *path_res;
      struct drm_dp_sideband_msg_tx *txmsg;
-     int len;
      int ret;
 
      txmsg = kzalloc(sizeof(*txmsg), GFP_KERNEL);
@@ -2486,7 +2469,7 @@ drm_dp_send_enum_path_resources(struct drm_dp_mst_topology_mgr *mgr,
              return -ENOMEM;
 
      txmsg->dst = mstb;
-     len = build_enum_path_resources(txmsg, port->port_num);
+     build_enum_path_resources(txmsg, port->port_num);
 
      drm_dp_queue_down_tx(mgr, txmsg);
 
@@ -2569,7 +2552,7 @@ static int drm_dp_payload_send_msg(struct drm_dp_mst_topology_mgr *mgr,
 {
      struct drm_dp_sideband_msg_tx *txmsg;
      struct drm_dp_mst_branch *mstb;
-     int len, ret, port_num;
+     int ret, port_num;
      u8 sinks[DRM_DP_MAX_SDP_STREAMS];
      int i;
 
@@ -2594,9 +2577,9 @@ static int drm_dp_payload_send_msg(struct drm_dp_mst_topology_mgr *mgr,
              sinks[i] = i;
 
      txmsg->dst = mstb;
-     len = build_allocate_payload(txmsg, port_num,
-                                  id,
-                                  pbn, port->num_sdp_streams, sinks);
+     build_allocate_payload(txmsg, port_num,
+                            id,
+                            pbn, port->num_sdp_streams, sinks);
 
      drm_dp_queue_down_tx(mgr, txmsg);
 
@@ -2625,7 +2608,7 @@ int drm_dp_send_power_updown_phy(struct drm_dp_mst_topology_mgr *mgr,
                               struct drm_dp_mst_port *port, bool power_up)
 {
      struct drm_dp_sideband_msg_tx *txmsg;
-     int len, ret;
+     int ret;
 
      port = drm_dp_mst_topology_get_port_validated(mgr, port);
      if (!port)
@@ -2638,7 +2621,7 @@ int drm_dp_send_power_updown_phy(struct drm_dp_mst_topology_mgr *mgr,
      }
 
      txmsg->dst = port->parent;
-     len = build_power_updown_phy(txmsg, port->port_num, power_up);
+     build_power_updown_phy(txmsg, port->port_num, power_up);
      drm_dp_queue_down_tx(mgr, txmsg);
 
      ret = drm_dp_mst_wait_tx_reply(port->parent, txmsg);
@@ -2858,7 +2841,6 @@ static int drm_dp_send_dpcd_read(struct drm_dp_mst_topology_mgr *mgr,
                               struct drm_dp_mst_port *port,
                               int offset, int size, u8 *bytes)
 {
-     int len;
      int ret = 0;
      struct drm_dp_sideband_msg_tx *txmsg;
      struct drm_dp_mst_branch *mstb;
@@ -2873,7 +2855,7 @@ static int drm_dp_send_dpcd_read(struct drm_dp_mst_topology_mgr *mgr,
              goto fail_put;
      }
 
-     len = build_dpcd_read(txmsg, port->port_num, offset, size);
+     build_dpcd_read(txmsg, port->port_num, offset, size);
      txmsg->dst = port->parent;
 
      drm_dp_queue_down_tx(mgr, txmsg);
@@ -2911,7 +2893,6 @@ static int drm_dp_send_dpcd_write(struct drm_dp_mst_topology_mgr *mgr,
                                struct drm_dp_mst_port *port,
                                int offset, int size, u8 *bytes)
 {
-     int len;
      int ret;
      struct drm_dp_sideband_msg_tx *txmsg;
      struct drm_dp_mst_branch *mstb;
@@ -2926,7 +2907,7 @@ static int drm_dp_send_dpcd_write(struct drm_dp_mst_topology_mgr *mgr,
              goto fail_put;
      }
 
-     len = build_dpcd_write(txmsg, port->port_num, offset, size, bytes);
+     build_dpcd_write(txmsg, port->port_num, offset, size, bytes);
      txmsg->dst = mstb;
 
      drm_dp_queue_down_tx(mgr, txmsg);
@@ -3149,7 +3130,7 @@ static bool drm_dp_get_one_sb_msg(struct drm_dp_mst_topology_mgr *mgr, bool up)
 {
      int len;
      u8 replyblock[32];
-     int replylen, origlen, curreply;
+     int replylen, curreply;
      int ret;
      struct drm_dp_sideband_msg_rx *msg;
      int basereg = up ? DP_SIDEBAND_MSG_UP_REQ_BASE : DP_SIDEBAND_MSG_DOWN_REP_BASE;
@@ -3169,7 +3150,6 @@ static bool drm_dp_get_one_sb_msg(struct drm_dp_mst_topology_mgr *mgr, bool up)
      }
      replylen = msg->curchunk_len + msg->curchunk_hdrlen;
 
-     origlen = replylen;
      replylen -= len;
      curreply = len;
      while (replylen > 0) {
@@ -3961,17 +3941,16 @@ void drm_dp_mst_dump_topology(struct seq_file *m,
      mutex_lock(&mgr->lock);
      if (mgr->mst_primary) {
              u8 buf[DP_PAYLOAD_TABLE_SIZE];
-             int ret;
 
-             ret = drm_dp_dpcd_read(mgr->aux, DP_DPCD_REV, buf, DP_RECEIVER_CAP_SIZE);
+             drm_dp_dpcd_read(mgr->aux, DP_DPCD_REV, buf, DP_RECEIVER_CAP_SIZE);
              seq_printf(m, "dpcd: %*ph\n", DP_RECEIVER_CAP_SIZE, buf);
-             ret = drm_dp_dpcd_read(mgr->aux, DP_FAUX_CAP, buf, 2);
+             drm_dp_dpcd_read(mgr->aux, DP_FAUX_CAP, buf, 2);
              seq_printf(m, "faux/mst: %*ph\n", 2, buf);
-             ret = drm_dp_dpcd_read(mgr->aux, DP_MSTM_CTRL, buf, 1);
+             drm_dp_dpcd_read(mgr->aux, DP_MSTM_CTRL, buf, 1);
              seq_printf(m, "mst ctrl: %*ph\n", 1, buf);
 
Quoted 13 lines
Quoted 7 lines
Quoted 7 lines
Quoted 6 lines
drivers/gpu/drm/drm_dp_mst_topology.c +1 -1
              /* dump the standard OUI branch header */
-             ret = drm_dp_dpcd_read(mgr->aux, DP_BRANCH_OUI, buf, DP_BRANCH_OUI_HEADER_SIZE);
+             drm_dp_dpcd_read(mgr->aux, DP_BRANCH_OUI, buf, DP_BRANCH_OUI_HEADER_SIZE);
              seq_printf(m, "branch oui: %*phN devid: ", 3, buf);
              for (i = 0x3; i < 0x8 && buf[i]; i++)
                      seq_printf(m, "%c", buf[i]);
Quoted 6 lines
Quoted 6 lines

--
Jani Nikula, Intel Open Source Graphics Center
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#6 lore raw

Hey, does this still need review?

Quoted 404 lines · Benjamin Gaignard
Quoted 50 lines · Benjamin Gaignard
Quoted 48 lines · Benjamin Gaignard

Le mer. 4 déc. 2019 à 17:47, Jani Nikula <[email protected]> a écrit :

Quoted 46 lines
Quoted 43 lines · Benjamin Gaignard

Fix the warnings that show up with W=1.
They are all about unused but set variables.
If functions returns are not used anymore make them void.

---
CC: Jani Nikula <[email protected]>

changes in version 3:
- remove the hunk that may conflict with c485e2c97dae ("drm/dp_mst: Refactor pdt setup/teardown, add more locking")

changes in version 2:
- fix indentations
- when possible change functions prototype to void

drivers/gpu/drm/drm_dp_mst_topology.c | 83 +++++++++++++----------
------------

 1 file changed, 31 insertions(+), 52 deletions(-)
drivers/gpu/drm/drm_dp_mst_topology.c +0 -1
index 1437bc46368b..d5cb5688b5dd 100644
@@ -674,7 +674,6 @@ static bool drm_dp_sideband_msg_build(struct
 drm_dp_sideband_msg_rx *msg,
                                    u8 *replybuf, u8 replybuflen,
 bool hdr)
 {
      int ret;
-     u8 crc4;
 
      if (hdr) {
              u8 hdrlen;
drivers/gpu/drm/drm_dp_mst_topology.c +0 -2
@@ -716,8 +715,6 @@ static bool drm_dp_sideband_msg_build(struct
 drm_dp_sideband_msg_rx *msg,
      }
 
      if (msg->curchunk_idx >= msg->curchunk_len) {
-             /* do CRC */
-             crc4 = drm_dp_msg_data_crc4(msg->chunk, msg-
 >curchunk_len - 1);
Quoted 8 lines
Quoted 6 lines
Quoted 3 lines

Again, someone needs to check if crc4 should be *used* instead of thrown
away. Blindly throwing stuff out is not the way to go.

Hi Dave,

+ Lyude who has been hacking in this code recently

gentle ping for the reviewers,

Thanks,
Benjamin

Quoted 339 lines
Quoted 339 lines

Your are the original writer of this code, could you tell us if we can drop crc4
ao if there is something else that I have misunderstood ?

Thanks,
Benjamin

Quoted 332 lines

BR,
Jani.

Quoted 314 lines
drivers/gpu/drm/drm_dp_mst_topology.c +0 -0
              /* copy chunk into bigger msg */
              memcpy(&msg->msg[msg->curlen], msg->chunk, msg-
Quoted 1 line

curchunk_len - 1);

              msg->curlen += msg->curchunk_len - 1;
drivers/gpu/drm/drm_dp_mst_topology.c +1 -1
@@ -1014,7 +1011,7 @@ static bool drm_dp_sideband_parse_req(struct
 drm_dp_sideband_msg_rx *raw,
      }
 }
 
-static int build_dpcd_write(struct drm_dp_sideband_msg_tx *msg, u8
 port_num, u32 offset, u8 num_bytes, u8 *bytes)
+static void build_dpcd_write(struct drm_dp_sideband_msg_tx *msg, u8
 port_num, u32 offset, u8 num_bytes, u8 *bytes)
 {
      struct drm_dp_sideband_msg_req_body req;
drivers/gpu/drm/drm_dp_mst_topology.c +0 -0
@@ -1024,17 +1021,14 @@ static int build_dpcd_write(struct

drm_dp_sideband_msg_tx *msg, u8 port_num, u32

      req.u.dpcd_write.num_bytes = num_bytes;
      req.u.dpcd_write.bytes = bytes;
      drm_dp_encode_sideband_req(&req, msg);
drivers/gpu/drm/drm_dp_mst_topology.c +1 -4
-
-     return 0;
 }
 
-static int build_link_address(struct drm_dp_sideband_msg_tx *msg)
+static void build_link_address(struct drm_dp_sideband_msg_tx *msg)
 {
      struct drm_dp_sideband_msg_req_body req;
 
      req.req_type = DP_LINK_ADDRESS;
      drm_dp_encode_sideband_req(&req, msg);
-     return 0;
 }
 
 static int build_enum_path_resources(struct drm_dp_sideband_msg_tx

*msg, int port_num)

drivers/gpu/drm/drm_dp_mst_topology.c +0 -0
@@ -1048,7 +1042,7 @@ static int build_enum_path_resources(struct

drm_dp_sideband_msg_tx *msg, int por

      return 0;

}

-static int build_allocate_payload(struct drm_dp_sideband_msg_tx *msg, int port_num,
+static void build_allocate_payload(struct drm_dp_sideband_msg_tx *msg, int port_num,

                                u8 vcpi, uint16_t pbn,
                                u8 number_sdp_streams,
                                u8 *sdp_stream_sink)
drivers/gpu/drm/drm_dp_mst_topology.c +0 -0
@@ -1064,10 +1058,9 @@ static int build_allocate_payload(struct

drm_dp_sideband_msg_tx *msg, int port_n

                 number_sdp_streams);
      drm_dp_encode_sideband_req(&req, msg);
      msg->path_msg = true;
drivers/gpu/drm/drm_dp_mst_topology.c +0 -2
-     return 0;
 }
 
-static int build_power_updown_phy(struct drm_dp_sideband_msg_tx

*msg,
+static void build_power_updown_phy(struct drm_dp_sideband_msg_tx *msg,
int port_num, bool power_up)

 {
      struct drm_dp_sideband_msg_req_body req;
drivers/gpu/drm/drm_dp_mst_topology.c +0 -1
@@ -1080,7 +1073,6 @@ static int build_power_updown_phy(struct
 drm_dp_sideband_msg_tx *msg,
      req.u.port_num.port_number = port_num;
      drm_dp_encode_sideband_req(&req, msg);
      msg->path_msg = true;
-     return 0;
 }
 

static int drm_dp_mst_assign_payload_id(struct
drm_dp_mst_topology_mgr *mgr,

drivers/gpu/drm/drm_dp_mst_topology.c +1 -2
@@ -1746,14 +1738,13 @@ static u8 drm_dp_calculate_rad(struct
 drm_dp_mst_port *port,
  */
 static bool drm_dp_port_setup_pdt(struct drm_dp_mst_port *port)
 {
-     int ret;
      u8 rad[6], lct;
      bool send_link = false;
      switch (port->pdt) {
      case DP_PEER_DEVICE_DP_LEGACY_CONV:
      case DP_PEER_DEVICE_SST_SINK:
              /* add i2c over sideband */
-             ret = drm_dp_mst_register_i2c_bus(&port->aux);
+             drm_dp_mst_register_i2c_bus(&port->aux);
              break;
      case DP_PEER_DEVICE_MST_BRANCHING:
              lct = drm_dp_calculate_rad(port, rad);
drivers/gpu/drm/drm_dp_mst_topology.c +9 -14
@@ -1823,25 +1814,20 @@ ssize_t drm_dp_mst_dpcd_write(struct
 drm_dp_aux *aux,
 
 static void drm_dp_check_mstb_guid(struct drm_dp_mst_branch *mstb,
 u8 *guid)
 {
-     int ret;
-
      memcpy(mstb->guid, guid, 16);
 
      if (!drm_dp_validate_guid(mstb->mgr, mstb->guid)) {
              if (mstb->port_parent) {
-                     ret = drm_dp_send_dpcd_write(
-                                     mstb->mgr,
-                                     mstb->port_parent,
-                                     DP_GUID,
-                                     16,
-                                     mstb->guid);
+                     drm_dp_send_dpcd_write(mstb->mgr,
+                                            mstb->port_parent,
+                                            DP_GUID,
+                                            16,
+                                            mstb->guid);
              } else {
-
-                     ret = drm_dp_dpcd_write(
-                                     mstb->mgr->aux,
-                                     DP_GUID,
-                                     mstb->guid,
-                                     16);
+                     drm_dp_dpcd_write(mstb->mgr->aux,
+                                       DP_GUID,
+                                       mstb->guid,
+                                       16);
              }
      }

}

drivers/gpu/drm/drm_dp_mst_topology.c +1 -1
@@ -2197,7 +2183,7 @@ static bool drm_dp_validate_guid(struct
 drm_dp_mst_topology_mgr *mgr,
      return false;
 }
 
-static int build_dpcd_read(struct drm_dp_sideband_msg_tx *msg, u8
 port_num, u32 offset, u8 num_bytes)
+static void build_dpcd_read(struct drm_dp_sideband_msg_tx *msg, u8
 port_num, u32 offset, u8 num_bytes)
 {
      struct drm_dp_sideband_msg_req_body req;
drivers/gpu/drm/drm_dp_mst_topology.c +0 -0
@@ -2206,8 +2192,6 @@ static int build_dpcd_read(struct

drm_dp_sideband_msg_tx *msg, u8 port_num, u32

      req.u.dpcd_read.dpcd_address = offset;
      req.u.dpcd_read.num_bytes = num_bytes;
      drm_dp_encode_sideband_req(&req, msg);
drivers/gpu/drm/drm_dp_mst_topology.c +0 -2
-
-     return 0;
 }
 
 static int drm_dp_send_sideband_msg(struct drm_dp_mst_topology_mgr

*mgr,

drivers/gpu/drm/drm_dp_mst_topology.c +2 -2
@@ -2429,14 +2413,14 @@ static void drm_dp_send_link_address(struct
 drm_dp_mst_topology_mgr *mgr,
 {
      struct drm_dp_sideband_msg_tx *txmsg;
      struct drm_dp_link_address_ack_reply *reply;
-     int i, len, ret;
+     int i, ret;
 
      txmsg = kzalloc(sizeof(*txmsg), GFP_KERNEL);
      if (!txmsg)
              return;
 
      txmsg->dst = mstb;
-     len = build_link_address(txmsg);
+     build_link_address(txmsg);
 
      mstb->link_address_sent = true;
      drm_dp_queue_down_tx(mgr, txmsg);
drivers/gpu/drm/drm_dp_mst_topology.c +0 -1
@@ -2478,7 +2462,6 @@ drm_dp_send_enum_path_resources(struct
 drm_dp_mst_topology_mgr *mgr,
 {
      struct drm_dp_enum_path_resources_ack_reply *path_res;
      struct drm_dp_sideband_msg_tx *txmsg;
-     int len;
      int ret;
 
      txmsg = kzalloc(sizeof(*txmsg), GFP_KERNEL);
drivers/gpu/drm/drm_dp_mst_topology.c +5 -5
@@ -2486,7 +2469,7 @@ drm_dp_send_enum_path_resources(struct
 drm_dp_mst_topology_mgr *mgr,
              return -ENOMEM;
 
      txmsg->dst = mstb;
-     len = build_enum_path_resources(txmsg, port->port_num);
+     build_enum_path_resources(txmsg, port->port_num);
 
      drm_dp_queue_down_tx(mgr, txmsg);
@@ -2569,7 +2552,7 @@ static int drm_dp_payload_send_msg(struct
 drm_dp_mst_topology_mgr *mgr,
 {
      struct drm_dp_sideband_msg_tx *txmsg;
      struct drm_dp_mst_branch *mstb;
-     int len, ret, port_num;
+     int ret, port_num;
      u8 sinks[DRM_DP_MAX_SDP_STREAMS];
      int i;
@@ -2594,9 +2577,9 @@ static int drm_dp_payload_send_msg(struct
 drm_dp_mst_topology_mgr *mgr,
              sinks[i] = i;
 
      txmsg->dst = mstb;
-     len = build_allocate_payload(txmsg, port_num,
-                                  id,
-                                  pbn, port->num_sdp_streams,
 sinks);
+     build_allocate_payload(txmsg, port_num,
+                            id,
+                            pbn, port->num_sdp_streams, sinks);
 
      drm_dp_queue_down_tx(mgr, txmsg);
drivers/gpu/drm/drm_dp_mst_topology.c +1 -1
@@ -2625,7 +2608,7 @@ int drm_dp_send_power_updown_phy(struct
 drm_dp_mst_topology_mgr *mgr,
                               struct drm_dp_mst_port *port, bool
 power_up)
 {
      struct drm_dp_sideband_msg_tx *txmsg;
-     int len, ret;
+     int ret;
 
      port = drm_dp_mst_topology_get_port_validated(mgr, port);
      if (!port)
drivers/gpu/drm/drm_dp_mst_topology.c +1 -1
@@ -2638,7 +2621,7 @@ int drm_dp_send_power_updown_phy(struct
 drm_dp_mst_topology_mgr *mgr,
      }
 
      txmsg->dst = port->parent;
-     len = build_power_updown_phy(txmsg, port->port_num, power_up);
+     build_power_updown_phy(txmsg, port->port_num, power_up);
      drm_dp_queue_down_tx(mgr, txmsg);
 
      ret = drm_dp_mst_wait_tx_reply(port->parent, txmsg);
drivers/gpu/drm/drm_dp_mst_topology.c +0 -1
@@ -2858,7 +2841,6 @@ static int drm_dp_send_dpcd_read(struct
 drm_dp_mst_topology_mgr *mgr,
                               struct drm_dp_mst_port *port,
                               int offset, int size, u8 *bytes)
 {
-     int len;
      int ret = 0;
      struct drm_dp_sideband_msg_tx *txmsg;
      struct drm_dp_mst_branch *mstb;
drivers/gpu/drm/drm_dp_mst_topology.c +1 -1
@@ -2873,7 +2855,7 @@ static int drm_dp_send_dpcd_read(struct
 drm_dp_mst_topology_mgr *mgr,
              goto fail_put;
      }
 
-     len = build_dpcd_read(txmsg, port->port_num, offset, size);
+     build_dpcd_read(txmsg, port->port_num, offset, size);
      txmsg->dst = port->parent;
 
      drm_dp_queue_down_tx(mgr, txmsg);
drivers/gpu/drm/drm_dp_mst_topology.c +0 -1
@@ -2911,7 +2893,6 @@ static int drm_dp_send_dpcd_write(struct
 drm_dp_mst_topology_mgr *mgr,
                                struct drm_dp_mst_port *port,
                                int offset, int size, u8 *bytes)
 {
-     int len;
      int ret;
      struct drm_dp_sideband_msg_tx *txmsg;
      struct drm_dp_mst_branch *mstb;
drivers/gpu/drm/drm_dp_mst_topology.c +1 -1
@@ -2926,7 +2907,7 @@ static int drm_dp_send_dpcd_write(struct
 drm_dp_mst_topology_mgr *mgr,
              goto fail_put;
      }
 
-     len = build_dpcd_write(txmsg, port->port_num, offset, size,
 bytes);
+     build_dpcd_write(txmsg, port->port_num, offset, size, bytes);
      txmsg->dst = mstb;
      drm_dp_queue_down_tx(mgr, txmsg);
drivers/gpu/drm/drm_dp_mst_topology.c +1 -1
@@ -3149,7 +3130,7 @@ static bool drm_dp_get_one_sb_msg(struct
 drm_dp_mst_topology_mgr *mgr, bool up)
 {
      int len;
      u8 replyblock[32];
-     int replylen, origlen, curreply;
+     int replylen, curreply;
      int ret;
      struct drm_dp_sideband_msg_rx *msg;

int basereg = up ? DP_SIDEBAND_MSG_UP_REQ_BASE :
DP_SIDEBAND_MSG_DOWN_REP_BASE;

drivers/gpu/drm/drm_dp_mst_topology.c +0 -1
@@ -3169,7 +3150,6 @@ static bool drm_dp_get_one_sb_msg(struct
 drm_dp_mst_topology_mgr *mgr, bool up)
      }
      replylen = msg->curchunk_len + msg->curchunk_hdrlen;
 
-     origlen = replylen;
      replylen -= len;
      curreply = len;
      while (replylen > 0) {
drivers/gpu/drm/drm_dp_mst_topology.c +3 -4
@@ -3961,17 +3941,16 @@ void drm_dp_mst_dump_topology(struct
 seq_file *m,
      mutex_lock(&mgr->lock);
      if (mgr->mst_primary) {
              u8 buf[DP_PAYLOAD_TABLE_SIZE];
-             int ret;
 
-             ret = drm_dp_dpcd_read(mgr->aux, DP_DPCD_REV, buf,
 DP_RECEIVER_CAP_SIZE);
+             drm_dp_dpcd_read(mgr->aux, DP_DPCD_REV, buf,
 DP_RECEIVER_CAP_SIZE);
              seq_printf(m, "dpcd: %*ph\n", DP_RECEIVER_CAP_SIZE,
 buf);
-             ret = drm_dp_dpcd_read(mgr->aux, DP_FAUX_CAP, buf, 2);
+             drm_dp_dpcd_read(mgr->aux, DP_FAUX_CAP, buf, 2);
              seq_printf(m, "faux/mst: %*ph\n", 2, buf);
-             ret = drm_dp_dpcd_read(mgr->aux, DP_MSTM_CTRL, buf,
 1);
+             drm_dp_dpcd_read(mgr->aux, DP_MSTM_CTRL, buf, 1);
              seq_printf(m, "mst ctrl: %*ph\n", 1, buf);
 
Quoted 8 lines
              /* dump the standard OUI branch header */
-             ret = drm_dp_dpcd_read(mgr->aux, DP_BRANCH_OUI, buf,
DP_BRANCH_OUI_HEADER_SIZE);
+             drm_dp_dpcd_read(mgr->aux, DP_BRANCH_OUI, buf,
DP_BRANCH_OUI_HEADER_SIZE);
              seq_printf(m, "branch oui: %*phN devid: ", 3, buf);
              for (i = 0x3; i < 0x8 && buf[i]; i++)
                      seq_printf(m, "%c", buf[i]);

--
Jani Nikula, Intel Open Source Graphics Center
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

Signature · 7 lines
Cheers,
	Lyude Paul

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#7 lore raw
Quoted 2 lines · Lyude Paul

Hey, does this still need review?

yes please.
There is a question about what we should do of crc4 variable below.

Thanks,
Benjamin

Quoted 410 lines · Benjamin Gaignard
Quoted 59 lines
Quoted 57 lines · Benjamin Gaignard
Quoted 54 lines · Benjamin Gaignard

Le mer. 4 déc. 2019 à 17:47, Jani Nikula <[email protected]> a écrit :

Quoted 41 lines
Quoted 39 lines · Benjamin Gaignard

Fix the warnings that show up with W=1.
They are all about unused but set variables.
If functions returns are not used anymore make them void.

---
CC: Jani Nikula <[email protected]>

changes in version 3:
- remove the hunk that may conflict with c485e2c97dae ("drm/dp_mst: Refactor pdt setup/teardown, add more locking")

changes in version 2:
- fix indentations
- when possible change functions prototype to void

drivers/gpu/drm/drm_dp_mst_topology.c | 83 +++++++++++++----------
------------

 1 file changed, 31 insertions(+), 52 deletions(-)
drivers/gpu/drm/drm_dp_mst_topology.c +0 -1
index 1437bc46368b..d5cb5688b5dd 100644
@@ -674,7 +674,6 @@ static bool drm_dp_sideband_msg_build(struct
 drm_dp_sideband_msg_rx *msg,
                                    u8 *replybuf, u8 replybuflen,
 bool hdr)
 {
      int ret;
-     u8 crc4;
 
      if (hdr) {
              u8 hdrlen;
drivers/gpu/drm/drm_dp_mst_topology.c +0 -0
@@ -716,8 +715,6 @@ static bool drm_dp_sideband_msg_build(struct
 drm_dp_sideband_msg_rx *msg,
      }
 
Quoted 8 lines

drivers/gpu/drm/drm_dp_mst_topology.c static bool drm_dp_sideband_msg_build(struct drm_dp_sideband_msg_rx *msg,

Quoted 4 lines
drivers/gpu/drm/drm_dp_mst_topology.c +0 -2
      if (msg->curchunk_idx >= msg->curchunk_len) {
-             /* do CRC */
-             crc4 = drm_dp_msg_data_crc4(msg->chunk, msg-
 >curchunk_len - 1);

Again, someone needs to check if crc4 should be *used* instead of thrown
away. Blindly throwing stuff out is not the way to go.

Hi Dave,

Quoted 345 lines
Quoted 1 line

+ Lyude who has been hacking in this code recently

gentle ping for the reviewers,

Thanks,
Benjamin

Quoted 339 lines
Quoted 339 lines

Your are the original writer of this code, could you tell us if we can drop crc4
ao if there is something else that I have misunderstood ?

Thanks,
Benjamin

Quoted 332 lines

BR,
Jani.

Quoted 314 lines
drivers/gpu/drm/drm_dp_mst_topology.c +0 -0
              /* copy chunk into bigger msg */
              memcpy(&msg->msg[msg->curlen], msg->chunk, msg-
Quoted 1 line

curchunk_len - 1);

              msg->curlen += msg->curchunk_len - 1;
drivers/gpu/drm/drm_dp_mst_topology.c +1 -1
@@ -1014,7 +1011,7 @@ static bool drm_dp_sideband_parse_req(struct
 drm_dp_sideband_msg_rx *raw,
      }
 }
 
-static int build_dpcd_write(struct drm_dp_sideband_msg_tx *msg, u8
 port_num, u32 offset, u8 num_bytes, u8 *bytes)
+static void build_dpcd_write(struct drm_dp_sideband_msg_tx *msg, u8
 port_num, u32 offset, u8 num_bytes, u8 *bytes)
 {
      struct drm_dp_sideband_msg_req_body req;
drivers/gpu/drm/drm_dp_mst_topology.c +0 -0
@@ -1024,17 +1021,14 @@ static int build_dpcd_write(struct

drm_dp_sideband_msg_tx *msg, u8 port_num, u32

      req.u.dpcd_write.num_bytes = num_bytes;
      req.u.dpcd_write.bytes = bytes;
      drm_dp_encode_sideband_req(&req, msg);
drivers/gpu/drm/drm_dp_mst_topology.c +1 -4
-
-     return 0;
 }
 
-static int build_link_address(struct drm_dp_sideband_msg_tx *msg)
+static void build_link_address(struct drm_dp_sideband_msg_tx *msg)
 {
      struct drm_dp_sideband_msg_req_body req;
 
      req.req_type = DP_LINK_ADDRESS;
      drm_dp_encode_sideband_req(&req, msg);
-     return 0;
 }
 
 static int build_enum_path_resources(struct drm_dp_sideband_msg_tx

*msg, int port_num)

drivers/gpu/drm/drm_dp_mst_topology.c +0 -0
@@ -1048,7 +1042,7 @@ static int build_enum_path_resources(struct

drm_dp_sideband_msg_tx *msg, int por

      return 0;

}

-static int build_allocate_payload(struct drm_dp_sideband_msg_tx *msg, int port_num,
+static void build_allocate_payload(struct drm_dp_sideband_msg_tx *msg, int port_num,

                                u8 vcpi, uint16_t pbn,
                                u8 number_sdp_streams,
                                u8 *sdp_stream_sink)
drivers/gpu/drm/drm_dp_mst_topology.c +0 -0
@@ -1064,10 +1058,9 @@ static int build_allocate_payload(struct

drm_dp_sideband_msg_tx *msg, int port_n

                 number_sdp_streams);
      drm_dp_encode_sideband_req(&req, msg);
      msg->path_msg = true;
drivers/gpu/drm/drm_dp_mst_topology.c +0 -2
-     return 0;
 }
 
-static int build_power_updown_phy(struct drm_dp_sideband_msg_tx

*msg,
+static void build_power_updown_phy(struct drm_dp_sideband_msg_tx *msg,
int port_num, bool power_up)

 {
      struct drm_dp_sideband_msg_req_body req;
drivers/gpu/drm/drm_dp_mst_topology.c +0 -1
@@ -1080,7 +1073,6 @@ static int build_power_updown_phy(struct
 drm_dp_sideband_msg_tx *msg,
      req.u.port_num.port_number = port_num;
      drm_dp_encode_sideband_req(&req, msg);
      msg->path_msg = true;
-     return 0;
 }
 

static int drm_dp_mst_assign_payload_id(struct
drm_dp_mst_topology_mgr *mgr,

drivers/gpu/drm/drm_dp_mst_topology.c +1 -2
@@ -1746,14 +1738,13 @@ static u8 drm_dp_calculate_rad(struct
 drm_dp_mst_port *port,
  */
 static bool drm_dp_port_setup_pdt(struct drm_dp_mst_port *port)
 {
-     int ret;
      u8 rad[6], lct;
      bool send_link = false;
      switch (port->pdt) {
      case DP_PEER_DEVICE_DP_LEGACY_CONV:
      case DP_PEER_DEVICE_SST_SINK:
              /* add i2c over sideband */
-             ret = drm_dp_mst_register_i2c_bus(&port->aux);
+             drm_dp_mst_register_i2c_bus(&port->aux);
              break;
      case DP_PEER_DEVICE_MST_BRANCHING:
              lct = drm_dp_calculate_rad(port, rad);
drivers/gpu/drm/drm_dp_mst_topology.c +9 -14
@@ -1823,25 +1814,20 @@ ssize_t drm_dp_mst_dpcd_write(struct
 drm_dp_aux *aux,
 
 static void drm_dp_check_mstb_guid(struct drm_dp_mst_branch *mstb,
 u8 *guid)
 {
-     int ret;
-
      memcpy(mstb->guid, guid, 16);
 
      if (!drm_dp_validate_guid(mstb->mgr, mstb->guid)) {
              if (mstb->port_parent) {
-                     ret = drm_dp_send_dpcd_write(
-                                     mstb->mgr,
-                                     mstb->port_parent,
-                                     DP_GUID,
-                                     16,
-                                     mstb->guid);
+                     drm_dp_send_dpcd_write(mstb->mgr,
+                                            mstb->port_parent,
+                                            DP_GUID,
+                                            16,
+                                            mstb->guid);
              } else {
-
-                     ret = drm_dp_dpcd_write(
-                                     mstb->mgr->aux,
-                                     DP_GUID,
-                                     mstb->guid,
-                                     16);
+                     drm_dp_dpcd_write(mstb->mgr->aux,
+                                       DP_GUID,
+                                       mstb->guid,
+                                       16);
              }
      }

}

drivers/gpu/drm/drm_dp_mst_topology.c +1 -1
@@ -2197,7 +2183,7 @@ static bool drm_dp_validate_guid(struct
 drm_dp_mst_topology_mgr *mgr,
      return false;
 }
 
-static int build_dpcd_read(struct drm_dp_sideband_msg_tx *msg, u8
 port_num, u32 offset, u8 num_bytes)
+static void build_dpcd_read(struct drm_dp_sideband_msg_tx *msg, u8
 port_num, u32 offset, u8 num_bytes)
 {
      struct drm_dp_sideband_msg_req_body req;
drivers/gpu/drm/drm_dp_mst_topology.c +0 -0
@@ -2206,8 +2192,6 @@ static int build_dpcd_read(struct

drm_dp_sideband_msg_tx *msg, u8 port_num, u32

      req.u.dpcd_read.dpcd_address = offset;
      req.u.dpcd_read.num_bytes = num_bytes;
      drm_dp_encode_sideband_req(&req, msg);
drivers/gpu/drm/drm_dp_mst_topology.c +0 -2
-
-     return 0;
 }
 
 static int drm_dp_send_sideband_msg(struct drm_dp_mst_topology_mgr

*mgr,

drivers/gpu/drm/drm_dp_mst_topology.c +2 -2
@@ -2429,14 +2413,14 @@ static void drm_dp_send_link_address(struct
 drm_dp_mst_topology_mgr *mgr,
 {
      struct drm_dp_sideband_msg_tx *txmsg;
      struct drm_dp_link_address_ack_reply *reply;
-     int i, len, ret;
+     int i, ret;
 
      txmsg = kzalloc(sizeof(*txmsg), GFP_KERNEL);
      if (!txmsg)
              return;
 
      txmsg->dst = mstb;
-     len = build_link_address(txmsg);
+     build_link_address(txmsg);
 
      mstb->link_address_sent = true;
      drm_dp_queue_down_tx(mgr, txmsg);
drivers/gpu/drm/drm_dp_mst_topology.c +0 -1
@@ -2478,7 +2462,6 @@ drm_dp_send_enum_path_resources(struct
 drm_dp_mst_topology_mgr *mgr,
 {
      struct drm_dp_enum_path_resources_ack_reply *path_res;
      struct drm_dp_sideband_msg_tx *txmsg;
-     int len;
      int ret;
 
      txmsg = kzalloc(sizeof(*txmsg), GFP_KERNEL);
drivers/gpu/drm/drm_dp_mst_topology.c +5 -5
@@ -2486,7 +2469,7 @@ drm_dp_send_enum_path_resources(struct
 drm_dp_mst_topology_mgr *mgr,
              return -ENOMEM;
 
      txmsg->dst = mstb;
-     len = build_enum_path_resources(txmsg, port->port_num);
+     build_enum_path_resources(txmsg, port->port_num);
 
      drm_dp_queue_down_tx(mgr, txmsg);
@@ -2569,7 +2552,7 @@ static int drm_dp_payload_send_msg(struct
 drm_dp_mst_topology_mgr *mgr,
 {
      struct drm_dp_sideband_msg_tx *txmsg;
      struct drm_dp_mst_branch *mstb;
-     int len, ret, port_num;
+     int ret, port_num;
      u8 sinks[DRM_DP_MAX_SDP_STREAMS];
      int i;
@@ -2594,9 +2577,9 @@ static int drm_dp_payload_send_msg(struct
 drm_dp_mst_topology_mgr *mgr,
              sinks[i] = i;
 
      txmsg->dst = mstb;
-     len = build_allocate_payload(txmsg, port_num,
-                                  id,
-                                  pbn, port->num_sdp_streams,
 sinks);
+     build_allocate_payload(txmsg, port_num,
+                            id,
+                            pbn, port->num_sdp_streams, sinks);
 
      drm_dp_queue_down_tx(mgr, txmsg);
drivers/gpu/drm/drm_dp_mst_topology.c +1 -1
@@ -2625,7 +2608,7 @@ int drm_dp_send_power_updown_phy(struct
 drm_dp_mst_topology_mgr *mgr,
                               struct drm_dp_mst_port *port, bool
 power_up)
 {
      struct drm_dp_sideband_msg_tx *txmsg;
-     int len, ret;
+     int ret;
 
      port = drm_dp_mst_topology_get_port_validated(mgr, port);
      if (!port)
drivers/gpu/drm/drm_dp_mst_topology.c +1 -1
@@ -2638,7 +2621,7 @@ int drm_dp_send_power_updown_phy(struct
 drm_dp_mst_topology_mgr *mgr,
      }
 
      txmsg->dst = port->parent;
-     len = build_power_updown_phy(txmsg, port->port_num, power_up);
+     build_power_updown_phy(txmsg, port->port_num, power_up);
      drm_dp_queue_down_tx(mgr, txmsg);
 
      ret = drm_dp_mst_wait_tx_reply(port->parent, txmsg);
drivers/gpu/drm/drm_dp_mst_topology.c +0 -1
@@ -2858,7 +2841,6 @@ static int drm_dp_send_dpcd_read(struct
 drm_dp_mst_topology_mgr *mgr,
                               struct drm_dp_mst_port *port,
                               int offset, int size, u8 *bytes)
 {
-     int len;
      int ret = 0;
      struct drm_dp_sideband_msg_tx *txmsg;
      struct drm_dp_mst_branch *mstb;
drivers/gpu/drm/drm_dp_mst_topology.c +1 -1
@@ -2873,7 +2855,7 @@ static int drm_dp_send_dpcd_read(struct
 drm_dp_mst_topology_mgr *mgr,
              goto fail_put;
      }
 
-     len = build_dpcd_read(txmsg, port->port_num, offset, size);
+     build_dpcd_read(txmsg, port->port_num, offset, size);
      txmsg->dst = port->parent;
 
      drm_dp_queue_down_tx(mgr, txmsg);
drivers/gpu/drm/drm_dp_mst_topology.c +0 -1
@@ -2911,7 +2893,6 @@ static int drm_dp_send_dpcd_write(struct
 drm_dp_mst_topology_mgr *mgr,
                                struct drm_dp_mst_port *port,
                                int offset, int size, u8 *bytes)
 {
-     int len;
      int ret;
      struct drm_dp_sideband_msg_tx *txmsg;
      struct drm_dp_mst_branch *mstb;
drivers/gpu/drm/drm_dp_mst_topology.c +1 -1
@@ -2926,7 +2907,7 @@ static int drm_dp_send_dpcd_write(struct
 drm_dp_mst_topology_mgr *mgr,
              goto fail_put;
      }
 
-     len = build_dpcd_write(txmsg, port->port_num, offset, size,
 bytes);
+     build_dpcd_write(txmsg, port->port_num, offset, size, bytes);
      txmsg->dst = mstb;
      drm_dp_queue_down_tx(mgr, txmsg);
drivers/gpu/drm/drm_dp_mst_topology.c +1 -1
@@ -3149,7 +3130,7 @@ static bool drm_dp_get_one_sb_msg(struct
 drm_dp_mst_topology_mgr *mgr, bool up)
 {
      int len;
      u8 replyblock[32];
-     int replylen, origlen, curreply;
+     int replylen, curreply;
      int ret;
      struct drm_dp_sideband_msg_rx *msg;

int basereg = up ? DP_SIDEBAND_MSG_UP_REQ_BASE :
DP_SIDEBAND_MSG_DOWN_REP_BASE;

drivers/gpu/drm/drm_dp_mst_topology.c +0 -1
@@ -3169,7 +3150,6 @@ static bool drm_dp_get_one_sb_msg(struct
 drm_dp_mst_topology_mgr *mgr, bool up)
      }
      replylen = msg->curchunk_len + msg->curchunk_hdrlen;
 
-     origlen = replylen;
      replylen -= len;
      curreply = len;
      while (replylen > 0) {
drivers/gpu/drm/drm_dp_mst_topology.c +3 -4
@@ -3961,17 +3941,16 @@ void drm_dp_mst_dump_topology(struct
 seq_file *m,
      mutex_lock(&mgr->lock);
      if (mgr->mst_primary) {
              u8 buf[DP_PAYLOAD_TABLE_SIZE];
-             int ret;
 
-             ret = drm_dp_dpcd_read(mgr->aux, DP_DPCD_REV, buf,
 DP_RECEIVER_CAP_SIZE);
+             drm_dp_dpcd_read(mgr->aux, DP_DPCD_REV, buf,
 DP_RECEIVER_CAP_SIZE);
              seq_printf(m, "dpcd: %*ph\n", DP_RECEIVER_CAP_SIZE,
 buf);
-             ret = drm_dp_dpcd_read(mgr->aux, DP_FAUX_CAP, buf, 2);
+             drm_dp_dpcd_read(mgr->aux, DP_FAUX_CAP, buf, 2);
              seq_printf(m, "faux/mst: %*ph\n", 2, buf);
-             ret = drm_dp_dpcd_read(mgr->aux, DP_MSTM_CTRL, buf,
 1);
+             drm_dp_dpcd_read(mgr->aux, DP_MSTM_CTRL, buf, 1);
              seq_printf(m, "mst ctrl: %*ph\n", 1, buf);
 
Quoted 8 lines
              /* dump the standard OUI branch header */
-             ret = drm_dp_dpcd_read(mgr->aux, DP_BRANCH_OUI, buf,
DP_BRANCH_OUI_HEADER_SIZE);
+             drm_dp_dpcd_read(mgr->aux, DP_BRANCH_OUI, buf,
DP_BRANCH_OUI_HEADER_SIZE);
              seq_printf(m, "branch oui: %*phN devid: ", 3, buf);
              for (i = 0x3; i < 0x8 && buf[i]; i++)
                      seq_printf(m, "%c", buf[i]);

--
Jani Nikula, Intel Open Source Graphics Center
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

--
Cheers,
Lyude Paul

#8 lore raw
In reply to Benjamin Gaignard
Quoted 56 lines · Benjamin Gaignard
Quoted 54 lines · Benjamin Gaignard
Quoted 52 lines · Benjamin Gaignard

Le mer. 4 déc. 2019 à 17:47, Jani Nikula <[email protected]> a écrit :

Quoted 49 lines
Quoted 36 lines · Benjamin Gaignard

Fix the warnings that show up with W=1.
They are all about unused but set variables.
If functions returns are not used anymore make them void.

---
CC: Jani Nikula <[email protected]>

changes in version 3:
- remove the hunk that may conflict with c485e2c97dae ("drm/dp_mst: Refactor pdt setup/teardown, add more locking")

changes in version 2:
- fix indentations
- when possible change functions prototype to void

drivers/gpu/drm/drm_dp_mst_topology.c | 83 +++++++++++++----------
------------

 1 file changed, 31 insertions(+), 52 deletions(-)
drivers/gpu/drm/drm_dp_mst_topology.c +0 -1
index 1437bc46368b..d5cb5688b5dd 100644
@@ -674,7 +674,6 @@ static bool drm_dp_sideband_msg_build(struct
 drm_dp_sideband_msg_rx *msg,
                                    u8 *replybuf, u8 replybuflen,
 bool hdr)
 {
      int ret;
-     u8 crc4;
 
      if (hdr) {
              u8 hdrlen;

drivers/gpu/drm/drm_dp_mst_topology.c static bool drm_dp_sideband_msg_build(struct · line 719

Quoted 7 lines
drivers/gpu/drm/drm_dp_mst_topology.c +0 -2
@@ -716,8 +715,6 @@ static bool drm_dp_sideband_msg_build(struct
 drm_dp_sideband_msg_rx *msg,
      }
 
      if (msg->curchunk_idx >= msg->curchunk_len) {
-             /* do CRC */
-             crc4 = drm_dp_msg_data_crc4(msg->chunk, msg-
 >curchunk_len - 1);

Again, someone needs to check if crc4 should be *used* instead of thrown
away. Blindly throwing stuff out is not the way to go.

Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

Hi Dave,

+ Lyude who has been hacking in this code recently

gentle ping for the reviewers,

hi-actually yes, we should probably be using this instead of just dropping this. Also, I didn't write this code originally I just refactored a bunch of it - Dave Airlied is the original author, but the original version of this code was written ages ago. tbh, I think it's a safe bet to say that they probably did mean to use this but forgot to and no one noticed until now.

Quoted 341 lines

Thanks,
Benjamin

Quoted 339 lines
Quoted 339 lines

Your are the original writer of this code, could you tell us if we can drop crc4
ao if there is something else that I have misunderstood ?

Thanks,
Benjamin

Quoted 332 lines

BR,
Jani.

Quoted 314 lines
drivers/gpu/drm/drm_dp_mst_topology.c +0 -0
              /* copy chunk into bigger msg */
              memcpy(&msg->msg[msg->curlen], msg->chunk, msg-
Quoted 1 line

curchunk_len - 1);

              msg->curlen += msg->curchunk_len - 1;
drivers/gpu/drm/drm_dp_mst_topology.c +1 -1
@@ -1014,7 +1011,7 @@ static bool drm_dp_sideband_parse_req(struct
 drm_dp_sideband_msg_rx *raw,
      }
 }
 
-static int build_dpcd_write(struct drm_dp_sideband_msg_tx *msg, u8
 port_num, u32 offset, u8 num_bytes, u8 *bytes)
+static void build_dpcd_write(struct drm_dp_sideband_msg_tx *msg, u8
 port_num, u32 offset, u8 num_bytes, u8 *bytes)
 {
      struct drm_dp_sideband_msg_req_body req;
drivers/gpu/drm/drm_dp_mst_topology.c +0 -0
@@ -1024,17 +1021,14 @@ static int build_dpcd_write(struct

drm_dp_sideband_msg_tx *msg, u8 port_num, u32

      req.u.dpcd_write.num_bytes = num_bytes;
      req.u.dpcd_write.bytes = bytes;
      drm_dp_encode_sideband_req(&req, msg);
drivers/gpu/drm/drm_dp_mst_topology.c +1 -4
-
-     return 0;
 }
 
-static int build_link_address(struct drm_dp_sideband_msg_tx *msg)
+static void build_link_address(struct drm_dp_sideband_msg_tx *msg)
 {
      struct drm_dp_sideband_msg_req_body req;
 
      req.req_type = DP_LINK_ADDRESS;
      drm_dp_encode_sideband_req(&req, msg);
-     return 0;
 }
 
 static int build_enum_path_resources(struct drm_dp_sideband_msg_tx

*msg, int port_num)

drivers/gpu/drm/drm_dp_mst_topology.c +0 -0
@@ -1048,7 +1042,7 @@ static int build_enum_path_resources(struct

drm_dp_sideband_msg_tx *msg, int por

      return 0;

}

-static int build_allocate_payload(struct drm_dp_sideband_msg_tx *msg, int port_num,
+static void build_allocate_payload(struct drm_dp_sideband_msg_tx *msg, int port_num,

                                u8 vcpi, uint16_t pbn,
                                u8 number_sdp_streams,
                                u8 *sdp_stream_sink)
drivers/gpu/drm/drm_dp_mst_topology.c +0 -0
@@ -1064,10 +1058,9 @@ static int build_allocate_payload(struct

drm_dp_sideband_msg_tx *msg, int port_n

                 number_sdp_streams);
      drm_dp_encode_sideband_req(&req, msg);
      msg->path_msg = true;
drivers/gpu/drm/drm_dp_mst_topology.c +0 -2
-     return 0;
 }
 
-static int build_power_updown_phy(struct drm_dp_sideband_msg_tx

*msg,
+static void build_power_updown_phy(struct drm_dp_sideband_msg_tx *msg,
int port_num, bool power_up)

 {
      struct drm_dp_sideband_msg_req_body req;
drivers/gpu/drm/drm_dp_mst_topology.c +0 -1
@@ -1080,7 +1073,6 @@ static int build_power_updown_phy(struct
 drm_dp_sideband_msg_tx *msg,
      req.u.port_num.port_number = port_num;
      drm_dp_encode_sideband_req(&req, msg);
      msg->path_msg = true;
-     return 0;
 }
 

static int drm_dp_mst_assign_payload_id(struct
drm_dp_mst_topology_mgr *mgr,

drivers/gpu/drm/drm_dp_mst_topology.c +1 -2
@@ -1746,14 +1738,13 @@ static u8 drm_dp_calculate_rad(struct
 drm_dp_mst_port *port,
  */
 static bool drm_dp_port_setup_pdt(struct drm_dp_mst_port *port)
 {
-     int ret;
      u8 rad[6], lct;
      bool send_link = false;
      switch (port->pdt) {
      case DP_PEER_DEVICE_DP_LEGACY_CONV:
      case DP_PEER_DEVICE_SST_SINK:
              /* add i2c over sideband */
-             ret = drm_dp_mst_register_i2c_bus(&port->aux);
+             drm_dp_mst_register_i2c_bus(&port->aux);
              break;
      case DP_PEER_DEVICE_MST_BRANCHING:
              lct = drm_dp_calculate_rad(port, rad);
drivers/gpu/drm/drm_dp_mst_topology.c +9 -14
@@ -1823,25 +1814,20 @@ ssize_t drm_dp_mst_dpcd_write(struct
 drm_dp_aux *aux,
 
 static void drm_dp_check_mstb_guid(struct drm_dp_mst_branch *mstb,
 u8 *guid)
 {
-     int ret;
-
      memcpy(mstb->guid, guid, 16);
 
      if (!drm_dp_validate_guid(mstb->mgr, mstb->guid)) {
              if (mstb->port_parent) {
-                     ret = drm_dp_send_dpcd_write(
-                                     mstb->mgr,
-                                     mstb->port_parent,
-                                     DP_GUID,
-                                     16,
-                                     mstb->guid);
+                     drm_dp_send_dpcd_write(mstb->mgr,
+                                            mstb->port_parent,
+                                            DP_GUID,
+                                            16,
+                                            mstb->guid);
              } else {
-
-                     ret = drm_dp_dpcd_write(
-                                     mstb->mgr->aux,
-                                     DP_GUID,
-                                     mstb->guid,
-                                     16);
+                     drm_dp_dpcd_write(mstb->mgr->aux,
+                                       DP_GUID,
+                                       mstb->guid,
+                                       16);
              }
      }

}

drivers/gpu/drm/drm_dp_mst_topology.c +1 -1
@@ -2197,7 +2183,7 @@ static bool drm_dp_validate_guid(struct
 drm_dp_mst_topology_mgr *mgr,
      return false;
 }
 
-static int build_dpcd_read(struct drm_dp_sideband_msg_tx *msg, u8
 port_num, u32 offset, u8 num_bytes)
+static void build_dpcd_read(struct drm_dp_sideband_msg_tx *msg, u8
 port_num, u32 offset, u8 num_bytes)
 {
      struct drm_dp_sideband_msg_req_body req;
drivers/gpu/drm/drm_dp_mst_topology.c +0 -0
@@ -2206,8 +2192,6 @@ static int build_dpcd_read(struct

drm_dp_sideband_msg_tx *msg, u8 port_num, u32

      req.u.dpcd_read.dpcd_address = offset;
      req.u.dpcd_read.num_bytes = num_bytes;
      drm_dp_encode_sideband_req(&req, msg);
drivers/gpu/drm/drm_dp_mst_topology.c +0 -2
-
-     return 0;
 }
 
 static int drm_dp_send_sideband_msg(struct drm_dp_mst_topology_mgr

*mgr,

drivers/gpu/drm/drm_dp_mst_topology.c +2 -2
@@ -2429,14 +2413,14 @@ static void drm_dp_send_link_address(struct
 drm_dp_mst_topology_mgr *mgr,
 {
      struct drm_dp_sideband_msg_tx *txmsg;
      struct drm_dp_link_address_ack_reply *reply;
-     int i, len, ret;
+     int i, ret;
 
      txmsg = kzalloc(sizeof(*txmsg), GFP_KERNEL);
      if (!txmsg)
              return;
 
      txmsg->dst = mstb;
-     len = build_link_address(txmsg);
+     build_link_address(txmsg);
 
      mstb->link_address_sent = true;
      drm_dp_queue_down_tx(mgr, txmsg);
drivers/gpu/drm/drm_dp_mst_topology.c +0 -1
@@ -2478,7 +2462,6 @@ drm_dp_send_enum_path_resources(struct
 drm_dp_mst_topology_mgr *mgr,
 {
      struct drm_dp_enum_path_resources_ack_reply *path_res;
      struct drm_dp_sideband_msg_tx *txmsg;
-     int len;
      int ret;
 
      txmsg = kzalloc(sizeof(*txmsg), GFP_KERNEL);
drivers/gpu/drm/drm_dp_mst_topology.c +5 -5
@@ -2486,7 +2469,7 @@ drm_dp_send_enum_path_resources(struct
 drm_dp_mst_topology_mgr *mgr,
              return -ENOMEM;
 
      txmsg->dst = mstb;
-     len = build_enum_path_resources(txmsg, port->port_num);
+     build_enum_path_resources(txmsg, port->port_num);
 
      drm_dp_queue_down_tx(mgr, txmsg);
@@ -2569,7 +2552,7 @@ static int drm_dp_payload_send_msg(struct
 drm_dp_mst_topology_mgr *mgr,
 {
      struct drm_dp_sideband_msg_tx *txmsg;
      struct drm_dp_mst_branch *mstb;
-     int len, ret, port_num;
+     int ret, port_num;
      u8 sinks[DRM_DP_MAX_SDP_STREAMS];
      int i;
@@ -2594,9 +2577,9 @@ static int drm_dp_payload_send_msg(struct
 drm_dp_mst_topology_mgr *mgr,
              sinks[i] = i;
 
      txmsg->dst = mstb;
-     len = build_allocate_payload(txmsg, port_num,
-                                  id,
-                                  pbn, port->num_sdp_streams,
 sinks);
+     build_allocate_payload(txmsg, port_num,
+                            id,
+                            pbn, port->num_sdp_streams, sinks);
 
      drm_dp_queue_down_tx(mgr, txmsg);
drivers/gpu/drm/drm_dp_mst_topology.c +1 -1
@@ -2625,7 +2608,7 @@ int drm_dp_send_power_updown_phy(struct
 drm_dp_mst_topology_mgr *mgr,
                               struct drm_dp_mst_port *port, bool
 power_up)
 {
      struct drm_dp_sideband_msg_tx *txmsg;
-     int len, ret;
+     int ret;
 
      port = drm_dp_mst_topology_get_port_validated(mgr, port);
      if (!port)
drivers/gpu/drm/drm_dp_mst_topology.c +1 -1
@@ -2638,7 +2621,7 @@ int drm_dp_send_power_updown_phy(struct
 drm_dp_mst_topology_mgr *mgr,
      }
 
      txmsg->dst = port->parent;
-     len = build_power_updown_phy(txmsg, port->port_num, power_up);
+     build_power_updown_phy(txmsg, port->port_num, power_up);
      drm_dp_queue_down_tx(mgr, txmsg);
 
      ret = drm_dp_mst_wait_tx_reply(port->parent, txmsg);
drivers/gpu/drm/drm_dp_mst_topology.c +0 -1
@@ -2858,7 +2841,6 @@ static int drm_dp_send_dpcd_read(struct
 drm_dp_mst_topology_mgr *mgr,
                               struct drm_dp_mst_port *port,
                               int offset, int size, u8 *bytes)
 {
-     int len;
      int ret = 0;
      struct drm_dp_sideband_msg_tx *txmsg;
      struct drm_dp_mst_branch *mstb;
drivers/gpu/drm/drm_dp_mst_topology.c +1 -1
@@ -2873,7 +2855,7 @@ static int drm_dp_send_dpcd_read(struct
 drm_dp_mst_topology_mgr *mgr,
              goto fail_put;
      }
 
-     len = build_dpcd_read(txmsg, port->port_num, offset, size);
+     build_dpcd_read(txmsg, port->port_num, offset, size);
      txmsg->dst = port->parent;
 
      drm_dp_queue_down_tx(mgr, txmsg);
drivers/gpu/drm/drm_dp_mst_topology.c +0 -1
@@ -2911,7 +2893,6 @@ static int drm_dp_send_dpcd_write(struct
 drm_dp_mst_topology_mgr *mgr,
                                struct drm_dp_mst_port *port,
                                int offset, int size, u8 *bytes)
 {
-     int len;
      int ret;
      struct drm_dp_sideband_msg_tx *txmsg;
      struct drm_dp_mst_branch *mstb;
drivers/gpu/drm/drm_dp_mst_topology.c +1 -1
@@ -2926,7 +2907,7 @@ static int drm_dp_send_dpcd_write(struct
 drm_dp_mst_topology_mgr *mgr,
              goto fail_put;
      }
 
-     len = build_dpcd_write(txmsg, port->port_num, offset, size,
 bytes);
+     build_dpcd_write(txmsg, port->port_num, offset, size, bytes);
      txmsg->dst = mstb;
      drm_dp_queue_down_tx(mgr, txmsg);
drivers/gpu/drm/drm_dp_mst_topology.c +1 -1
@@ -3149,7 +3130,7 @@ static bool drm_dp_get_one_sb_msg(struct
 drm_dp_mst_topology_mgr *mgr, bool up)
 {
      int len;
      u8 replyblock[32];
-     int replylen, origlen, curreply;
+     int replylen, curreply;
      int ret;
      struct drm_dp_sideband_msg_rx *msg;

int basereg = up ? DP_SIDEBAND_MSG_UP_REQ_BASE :
DP_SIDEBAND_MSG_DOWN_REP_BASE;

drivers/gpu/drm/drm_dp_mst_topology.c +0 -1
@@ -3169,7 +3150,6 @@ static bool drm_dp_get_one_sb_msg(struct
 drm_dp_mst_topology_mgr *mgr, bool up)
      }
      replylen = msg->curchunk_len + msg->curchunk_hdrlen;
 
-     origlen = replylen;
      replylen -= len;
      curreply = len;
      while (replylen > 0) {
drivers/gpu/drm/drm_dp_mst_topology.c +3 -4
@@ -3961,17 +3941,16 @@ void drm_dp_mst_dump_topology(struct
 seq_file *m,
      mutex_lock(&mgr->lock);
      if (mgr->mst_primary) {
              u8 buf[DP_PAYLOAD_TABLE_SIZE];
-             int ret;
 
-             ret = drm_dp_dpcd_read(mgr->aux, DP_DPCD_REV, buf,
 DP_RECEIVER_CAP_SIZE);
+             drm_dp_dpcd_read(mgr->aux, DP_DPCD_REV, buf,
 DP_RECEIVER_CAP_SIZE);
              seq_printf(m, "dpcd: %*ph\n", DP_RECEIVER_CAP_SIZE,
 buf);
-             ret = drm_dp_dpcd_read(mgr->aux, DP_FAUX_CAP, buf, 2);
+             drm_dp_dpcd_read(mgr->aux, DP_FAUX_CAP, buf, 2);
              seq_printf(m, "faux/mst: %*ph\n", 2, buf);
-             ret = drm_dp_dpcd_read(mgr->aux, DP_MSTM_CTRL, buf,
 1);
+             drm_dp_dpcd_read(mgr->aux, DP_MSTM_CTRL, buf, 1);
              seq_printf(m, "mst ctrl: %*ph\n", 1, buf);
 
Quoted 8 lines
              /* dump the standard OUI branch header */
-             ret = drm_dp_dpcd_read(mgr->aux, DP_BRANCH_OUI, buf,
DP_BRANCH_OUI_HEADER_SIZE);
+             drm_dp_dpcd_read(mgr->aux, DP_BRANCH_OUI, buf,
DP_BRANCH_OUI_HEADER_SIZE);
              seq_printf(m, "branch oui: %*phN devid: ", 3, buf);
              for (i = 0x3; i < 0x8 && buf[i]; i++)
                      seq_printf(m, "%c", buf[i]);

--
Jani Nikula, Intel Open Source Graphics Center
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

Signature · 2 lines
Cheers,
	Lyude Paul
#9 lore raw
Quoted 63 lines · Lyude Paul
Quoted 61 lines · Benjamin Gaignard
Quoted 58 lines · Benjamin Gaignard
Quoted 46 lines · Benjamin Gaignard

Le mer. 4 déc. 2019 à 17:47, Jani Nikula <[email protected]> a écrit :

Quoted 44 lines
Quoted 42 lines · Benjamin Gaignard

Fix the warnings that show up with W=1.
They are all about unused but set variables.
If functions returns are not used anymore make them void.

---
CC: Jani Nikula <[email protected]>

changes in version 3:
- remove the hunk that may conflict with c485e2c97dae ("drm/dp_mst: Refactor pdt setup/teardown, add more locking")

changes in version 2:
- fix indentations
- when possible change functions prototype to void

drivers/gpu/drm/drm_dp_mst_topology.c | 83 +++++++++++++----------
------------

 1 file changed, 31 insertions(+), 52 deletions(-)
drivers/gpu/drm/drm_dp_mst_topology.c +0 -1
index 1437bc46368b..d5cb5688b5dd 100644
@@ -674,7 +674,6 @@ static bool drm_dp_sideband_msg_build(struct
 drm_dp_sideband_msg_rx *msg,
                                    u8 *replybuf, u8 replybuflen,
 bool hdr)
 {
      int ret;
-     u8 crc4;
 
      if (hdr) {
              u8 hdrlen;
drivers/gpu/drm/drm_dp_mst_topology.c +0 -2
@@ -716,8 +715,6 @@ static bool drm_dp_sideband_msg_build(struct
 drm_dp_sideband_msg_rx *msg,
      }
 
      if (msg->curchunk_idx >= msg->curchunk_len) {
-             /* do CRC */
-             crc4 = drm_dp_msg_data_crc4(msg->chunk, msg-
Quoted 8 lines
Quoted 5 lines

drivers/gpu/drm/drm_dp_mst_topology.c static bool drm_dp_sideband_msg_build(struct · line 719

Quoted 1 line
drivers/gpu/drm/drm_dp_mst_topology.c +0 -0
 >curchunk_len - 1);

Again, someone needs to check if crc4 should be *used* instead of thrown
away. Blindly throwing stuff out is not the way to go.

Hi Dave,

+ Lyude who has been hacking in this code recently

Quoted 7 lines
Quoted 2 lines

gentle ping for the reviewers,

hi-actually yes, we should probably be using this instead of just dropping this. Also, I didn't write this code originally I just refactored a bunch of it - Dave Airlied is the original author, but the original version of this code was written ages ago. tbh, I think it's a safe bet to say that they probably did mean to use this but forgot to and no one noticed until now.

Hi,

Any clue about how to use crc value ? Does it have to be checked against something else ?
If crc are not matching what should we do of the data copied just before ?

Benjamin

Quoted 346 lines
Quoted 342 lines

Thanks,
Benjamin

Quoted 339 lines
Quoted 339 lines

Your are the original writer of this code, could you tell us if we can drop crc4
ao if there is something else that I have misunderstood ?

Thanks,
Benjamin

Quoted 332 lines

BR,
Jani.

Quoted 314 lines
drivers/gpu/drm/drm_dp_mst_topology.c +0 -0
              /* copy chunk into bigger msg */
              memcpy(&msg->msg[msg->curlen], msg->chunk, msg-
Quoted 1 line

curchunk_len - 1);

              msg->curlen += msg->curchunk_len - 1;
drivers/gpu/drm/drm_dp_mst_topology.c +1 -1
@@ -1014,7 +1011,7 @@ static bool drm_dp_sideband_parse_req(struct
 drm_dp_sideband_msg_rx *raw,
      }
 }
 
-static int build_dpcd_write(struct drm_dp_sideband_msg_tx *msg, u8
 port_num, u32 offset, u8 num_bytes, u8 *bytes)
+static void build_dpcd_write(struct drm_dp_sideband_msg_tx *msg, u8
 port_num, u32 offset, u8 num_bytes, u8 *bytes)
 {
      struct drm_dp_sideband_msg_req_body req;
drivers/gpu/drm/drm_dp_mst_topology.c +0 -0
@@ -1024,17 +1021,14 @@ static int build_dpcd_write(struct

drm_dp_sideband_msg_tx *msg, u8 port_num, u32

      req.u.dpcd_write.num_bytes = num_bytes;
      req.u.dpcd_write.bytes = bytes;
      drm_dp_encode_sideband_req(&req, msg);
drivers/gpu/drm/drm_dp_mst_topology.c +1 -4
-
-     return 0;
 }
 
-static int build_link_address(struct drm_dp_sideband_msg_tx *msg)
+static void build_link_address(struct drm_dp_sideband_msg_tx *msg)
 {
      struct drm_dp_sideband_msg_req_body req;
 
      req.req_type = DP_LINK_ADDRESS;
      drm_dp_encode_sideband_req(&req, msg);
-     return 0;
 }
 
 static int build_enum_path_resources(struct drm_dp_sideband_msg_tx

*msg, int port_num)

drivers/gpu/drm/drm_dp_mst_topology.c +0 -0
@@ -1048,7 +1042,7 @@ static int build_enum_path_resources(struct

drm_dp_sideband_msg_tx *msg, int por

      return 0;

}

-static int build_allocate_payload(struct drm_dp_sideband_msg_tx *msg, int port_num,
+static void build_allocate_payload(struct drm_dp_sideband_msg_tx *msg, int port_num,

                                u8 vcpi, uint16_t pbn,
                                u8 number_sdp_streams,
                                u8 *sdp_stream_sink)
drivers/gpu/drm/drm_dp_mst_topology.c +0 -0
@@ -1064,10 +1058,9 @@ static int build_allocate_payload(struct

drm_dp_sideband_msg_tx *msg, int port_n

                 number_sdp_streams);
      drm_dp_encode_sideband_req(&req, msg);
      msg->path_msg = true;
drivers/gpu/drm/drm_dp_mst_topology.c +0 -2
-     return 0;
 }
 
-static int build_power_updown_phy(struct drm_dp_sideband_msg_tx

*msg,
+static void build_power_updown_phy(struct drm_dp_sideband_msg_tx *msg,
int port_num, bool power_up)

 {
      struct drm_dp_sideband_msg_req_body req;
drivers/gpu/drm/drm_dp_mst_topology.c +0 -1
@@ -1080,7 +1073,6 @@ static int build_power_updown_phy(struct
 drm_dp_sideband_msg_tx *msg,
      req.u.port_num.port_number = port_num;
      drm_dp_encode_sideband_req(&req, msg);
      msg->path_msg = true;
-     return 0;
 }
 

static int drm_dp_mst_assign_payload_id(struct
drm_dp_mst_topology_mgr *mgr,

drivers/gpu/drm/drm_dp_mst_topology.c +1 -2
@@ -1746,14 +1738,13 @@ static u8 drm_dp_calculate_rad(struct
 drm_dp_mst_port *port,
  */
 static bool drm_dp_port_setup_pdt(struct drm_dp_mst_port *port)
 {
-     int ret;
      u8 rad[6], lct;
      bool send_link = false;
      switch (port->pdt) {
      case DP_PEER_DEVICE_DP_LEGACY_CONV:
      case DP_PEER_DEVICE_SST_SINK:
              /* add i2c over sideband */
-             ret = drm_dp_mst_register_i2c_bus(&port->aux);
+             drm_dp_mst_register_i2c_bus(&port->aux);
              break;
      case DP_PEER_DEVICE_MST_BRANCHING:
              lct = drm_dp_calculate_rad(port, rad);
drivers/gpu/drm/drm_dp_mst_topology.c +9 -14
@@ -1823,25 +1814,20 @@ ssize_t drm_dp_mst_dpcd_write(struct
 drm_dp_aux *aux,
 
 static void drm_dp_check_mstb_guid(struct drm_dp_mst_branch *mstb,
 u8 *guid)
 {
-     int ret;
-
      memcpy(mstb->guid, guid, 16);
 
      if (!drm_dp_validate_guid(mstb->mgr, mstb->guid)) {
              if (mstb->port_parent) {
-                     ret = drm_dp_send_dpcd_write(
-                                     mstb->mgr,
-                                     mstb->port_parent,
-                                     DP_GUID,
-                                     16,
-                                     mstb->guid);
+                     drm_dp_send_dpcd_write(mstb->mgr,
+                                            mstb->port_parent,
+                                            DP_GUID,
+                                            16,
+                                            mstb->guid);
              } else {
-
-                     ret = drm_dp_dpcd_write(
-                                     mstb->mgr->aux,
-                                     DP_GUID,
-                                     mstb->guid,
-                                     16);
+                     drm_dp_dpcd_write(mstb->mgr->aux,
+                                       DP_GUID,
+                                       mstb->guid,
+                                       16);
              }
      }

}

drivers/gpu/drm/drm_dp_mst_topology.c +1 -1
@@ -2197,7 +2183,7 @@ static bool drm_dp_validate_guid(struct
 drm_dp_mst_topology_mgr *mgr,
      return false;
 }
 
-static int build_dpcd_read(struct drm_dp_sideband_msg_tx *msg, u8
 port_num, u32 offset, u8 num_bytes)
+static void build_dpcd_read(struct drm_dp_sideband_msg_tx *msg, u8
 port_num, u32 offset, u8 num_bytes)
 {
      struct drm_dp_sideband_msg_req_body req;
drivers/gpu/drm/drm_dp_mst_topology.c +0 -0
@@ -2206,8 +2192,6 @@ static int build_dpcd_read(struct

drm_dp_sideband_msg_tx *msg, u8 port_num, u32

      req.u.dpcd_read.dpcd_address = offset;
      req.u.dpcd_read.num_bytes = num_bytes;
      drm_dp_encode_sideband_req(&req, msg);
drivers/gpu/drm/drm_dp_mst_topology.c +0 -2
-
-     return 0;
 }
 
 static int drm_dp_send_sideband_msg(struct drm_dp_mst_topology_mgr

*mgr,

drivers/gpu/drm/drm_dp_mst_topology.c +2 -2
@@ -2429,14 +2413,14 @@ static void drm_dp_send_link_address(struct
 drm_dp_mst_topology_mgr *mgr,
 {
      struct drm_dp_sideband_msg_tx *txmsg;
      struct drm_dp_link_address_ack_reply *reply;
-     int i, len, ret;
+     int i, ret;
 
      txmsg = kzalloc(sizeof(*txmsg), GFP_KERNEL);
      if (!txmsg)
              return;
 
      txmsg->dst = mstb;
-     len = build_link_address(txmsg);
+     build_link_address(txmsg);
 
      mstb->link_address_sent = true;
      drm_dp_queue_down_tx(mgr, txmsg);
drivers/gpu/drm/drm_dp_mst_topology.c +0 -1
@@ -2478,7 +2462,6 @@ drm_dp_send_enum_path_resources(struct
 drm_dp_mst_topology_mgr *mgr,
 {
      struct drm_dp_enum_path_resources_ack_reply *path_res;
      struct drm_dp_sideband_msg_tx *txmsg;
-     int len;
      int ret;
 
      txmsg = kzalloc(sizeof(*txmsg), GFP_KERNEL);
drivers/gpu/drm/drm_dp_mst_topology.c +5 -5
@@ -2486,7 +2469,7 @@ drm_dp_send_enum_path_resources(struct
 drm_dp_mst_topology_mgr *mgr,
              return -ENOMEM;
 
      txmsg->dst = mstb;
-     len = build_enum_path_resources(txmsg, port->port_num);
+     build_enum_path_resources(txmsg, port->port_num);
 
      drm_dp_queue_down_tx(mgr, txmsg);
@@ -2569,7 +2552,7 @@ static int drm_dp_payload_send_msg(struct
 drm_dp_mst_topology_mgr *mgr,
 {
      struct drm_dp_sideband_msg_tx *txmsg;
      struct drm_dp_mst_branch *mstb;
-     int len, ret, port_num;
+     int ret, port_num;
      u8 sinks[DRM_DP_MAX_SDP_STREAMS];
      int i;
@@ -2594,9 +2577,9 @@ static int drm_dp_payload_send_msg(struct
 drm_dp_mst_topology_mgr *mgr,
              sinks[i] = i;
 
      txmsg->dst = mstb;
-     len = build_allocate_payload(txmsg, port_num,
-                                  id,
-                                  pbn, port->num_sdp_streams,
 sinks);
+     build_allocate_payload(txmsg, port_num,
+                            id,
+                            pbn, port->num_sdp_streams, sinks);
 
      drm_dp_queue_down_tx(mgr, txmsg);
drivers/gpu/drm/drm_dp_mst_topology.c +1 -1
@@ -2625,7 +2608,7 @@ int drm_dp_send_power_updown_phy(struct
 drm_dp_mst_topology_mgr *mgr,
                               struct drm_dp_mst_port *port, bool
 power_up)
 {
      struct drm_dp_sideband_msg_tx *txmsg;
-     int len, ret;
+     int ret;
 
      port = drm_dp_mst_topology_get_port_validated(mgr, port);
      if (!port)
drivers/gpu/drm/drm_dp_mst_topology.c +1 -1
@@ -2638,7 +2621,7 @@ int drm_dp_send_power_updown_phy(struct
 drm_dp_mst_topology_mgr *mgr,
      }
 
      txmsg->dst = port->parent;
-     len = build_power_updown_phy(txmsg, port->port_num, power_up);
+     build_power_updown_phy(txmsg, port->port_num, power_up);
      drm_dp_queue_down_tx(mgr, txmsg);
 
      ret = drm_dp_mst_wait_tx_reply(port->parent, txmsg);
drivers/gpu/drm/drm_dp_mst_topology.c +0 -1
@@ -2858,7 +2841,6 @@ static int drm_dp_send_dpcd_read(struct
 drm_dp_mst_topology_mgr *mgr,
                               struct drm_dp_mst_port *port,
                               int offset, int size, u8 *bytes)
 {
-     int len;
      int ret = 0;
      struct drm_dp_sideband_msg_tx *txmsg;
      struct drm_dp_mst_branch *mstb;
drivers/gpu/drm/drm_dp_mst_topology.c +1 -1
@@ -2873,7 +2855,7 @@ static int drm_dp_send_dpcd_read(struct
 drm_dp_mst_topology_mgr *mgr,
              goto fail_put;
      }
 
-     len = build_dpcd_read(txmsg, port->port_num, offset, size);
+     build_dpcd_read(txmsg, port->port_num, offset, size);
      txmsg->dst = port->parent;
 
      drm_dp_queue_down_tx(mgr, txmsg);
drivers/gpu/drm/drm_dp_mst_topology.c +0 -1
@@ -2911,7 +2893,6 @@ static int drm_dp_send_dpcd_write(struct
 drm_dp_mst_topology_mgr *mgr,
                                struct drm_dp_mst_port *port,
                                int offset, int size, u8 *bytes)
 {
-     int len;
      int ret;
      struct drm_dp_sideband_msg_tx *txmsg;
      struct drm_dp_mst_branch *mstb;
drivers/gpu/drm/drm_dp_mst_topology.c +1 -1
@@ -2926,7 +2907,7 @@ static int drm_dp_send_dpcd_write(struct
 drm_dp_mst_topology_mgr *mgr,
              goto fail_put;
      }
 
-     len = build_dpcd_write(txmsg, port->port_num, offset, size,
 bytes);
+     build_dpcd_write(txmsg, port->port_num, offset, size, bytes);
      txmsg->dst = mstb;
      drm_dp_queue_down_tx(mgr, txmsg);
drivers/gpu/drm/drm_dp_mst_topology.c +1 -1
@@ -3149,7 +3130,7 @@ static bool drm_dp_get_one_sb_msg(struct
 drm_dp_mst_topology_mgr *mgr, bool up)
 {
      int len;
      u8 replyblock[32];
-     int replylen, origlen, curreply;
+     int replylen, curreply;
      int ret;
      struct drm_dp_sideband_msg_rx *msg;

int basereg = up ? DP_SIDEBAND_MSG_UP_REQ_BASE :
DP_SIDEBAND_MSG_DOWN_REP_BASE;

drivers/gpu/drm/drm_dp_mst_topology.c +0 -1
@@ -3169,7 +3150,6 @@ static bool drm_dp_get_one_sb_msg(struct
 drm_dp_mst_topology_mgr *mgr, bool up)
      }
      replylen = msg->curchunk_len + msg->curchunk_hdrlen;
 
-     origlen = replylen;
      replylen -= len;
      curreply = len;
      while (replylen > 0) {
drivers/gpu/drm/drm_dp_mst_topology.c +3 -4
@@ -3961,17 +3941,16 @@ void drm_dp_mst_dump_topology(struct
 seq_file *m,
      mutex_lock(&mgr->lock);
      if (mgr->mst_primary) {
              u8 buf[DP_PAYLOAD_TABLE_SIZE];
-             int ret;
 
-             ret = drm_dp_dpcd_read(mgr->aux, DP_DPCD_REV, buf,
 DP_RECEIVER_CAP_SIZE);
+             drm_dp_dpcd_read(mgr->aux, DP_DPCD_REV, buf,
 DP_RECEIVER_CAP_SIZE);
              seq_printf(m, "dpcd: %*ph\n", DP_RECEIVER_CAP_SIZE,
 buf);
-             ret = drm_dp_dpcd_read(mgr->aux, DP_FAUX_CAP, buf, 2);
+             drm_dp_dpcd_read(mgr->aux, DP_FAUX_CAP, buf, 2);
              seq_printf(m, "faux/mst: %*ph\n", 2, buf);
-             ret = drm_dp_dpcd_read(mgr->aux, DP_MSTM_CTRL, buf,
 1);
+             drm_dp_dpcd_read(mgr->aux, DP_MSTM_CTRL, buf, 1);
              seq_printf(m, "mst ctrl: %*ph\n", 1, buf);
 
Quoted 8 lines
              /* dump the standard OUI branch header */
-             ret = drm_dp_dpcd_read(mgr->aux, DP_BRANCH_OUI, buf,
DP_BRANCH_OUI_HEADER_SIZE);
+             drm_dp_dpcd_read(mgr->aux, DP_BRANCH_OUI, buf,
DP_BRANCH_OUI_HEADER_SIZE);
              seq_printf(m, "branch oui: %*phN devid: ", 3, buf);
              for (i = 0x3; i < 0x8 && buf[i]; i++)
                      seq_printf(m, "%c", buf[i]);

--
Jani Nikula, Intel Open Source Graphics Center
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

--
Cheers,
Lyude Paul

#10 lore raw
Quoted 75 lines · Benjamin Gaignard
Quoted 65 lines · Lyude Paul
Quoted 64 lines · Benjamin Gaignard
Quoted 61 lines · Benjamin Gaignard
Quoted 49 lines · Benjamin Gaignard

Le mer. 4 déc. 2019 à 17:47, Jani Nikula <
[email protected]> a
écrit :

Quoted 46 lines
Quoted 44 lines · Benjamin Gaignard

Fix the warnings that show up with W=1.
They are all about unused but set variables.
If functions returns are not used anymore make them void.

---
CC: Jani Nikula <[email protected]>

changes in version 3:
- remove the hunk that may conflict with c485e2c97dae ("drm/dp_mst: Refactor pdt setup/teardown, add more locking")

changes in version 2:
- fix indentations
- when possible change functions prototype to void

drivers/gpu/drm/drm_dp_mst_topology.c | 83 +++++++++++++------
----
------------

 1 file changed, 31 insertions(+), 52 deletions(-)
drivers/gpu/drm/drm_dp_mst_topology.c +0 -1
index 1437bc46368b..d5cb5688b5dd 100644
@@ -674,7 +674,6 @@ static bool drm_dp_sideband_msg_build(struct
 drm_dp_sideband_msg_rx *msg,
                                    u8 *replybuf, u8
 replybuflen,
 bool hdr)
 {
      int ret;
-     u8 crc4;
      if (hdr) {
              u8 hdrlen;
drivers/gpu/drm/drm_dp_mst_topology.c +0 -2
@@ -716,8 +715,6 @@ static bool drm_dp_sideband_msg_build(struct
 drm_dp_sideband_msg_rx *msg,
      }
 
      if (msg->curchunk_idx >= msg->curchunk_len) {
-             /* do CRC */
-             crc4 = drm_dp_msg_data_crc4(msg->chunk, msg-
Quoted 8 lines
Quoted 5 lines

drivers/gpu/drm/drm_dp_mst_topology.c static bool drm_dp_sideband_msg_build(struct · line 719

Quoted 1 line
drivers/gpu/drm/drm_dp_mst_topology.c +0 -0
 > curchunk_len - 1);

Again, someone needs to check if crc4 should be *used* instead of thrown
away. Blindly throwing stuff out is not the way to go.

Hi Dave,

+ Lyude who has been hacking in this code recently

Quoted 8 lines
Quoted 2 lines

gentle ping for the reviewers,

hi-actually yes, we should probably be using this instead of just dropping this. Also, I didn't write this code originally I just refactored a bunch of
it - Dave Airlied is the original author, but the original version of this code was written ages ago. tbh, I think it's a safe bet to say that they probably did mean to use this but forgot to and no one noticed until now.

Quoted 5 lines

Hi,

Any clue about how to use crc value ? Does it have to be checked against something else ?
If crc are not matching what should we do of the data copied just before ?

We should be able to just take the CRC value from the sideband message and then generate our own CRC value using the sideband message contents, and check if the two are equal. If they aren't, something went wrong and we didn't receive the message properly.

Now as to what we should do when we have CRC mismatches? That's a bit more difficult. If you have access to the DP MST spec, I suppose a place to start figuring that out would be checking if there's a way for us to request that a branch device resend whatever message it sent previously. If there isn't, I guess we should just print an error in dmesg (possibly with a hexdump of the failed message as well) and not forward the message to the driver. Not sure of any better way of handling it then that

Quoted 373 lines

Benjamin

Quoted 370 lines
Quoted 366 lines

Thanks,
Benjamin

Quoted 364 lines
Quoted 364 lines

Your are the original writer of this code, could you tell us if we can
drop crc4
ao if there is something else that I have misunderstood ?

Thanks,
Benjamin

Quoted 356 lines

BR,
Jani.

Quoted 341 lines
drivers/gpu/drm/drm_dp_mst_topology.c +0 -0
              /* copy chunk into bigger msg */
              memcpy(&msg->msg[msg->curlen], msg->chunk, msg-
Quoted 1 line

curchunk_len - 1);

              msg->curlen += msg->curchunk_len - 1;
drivers/gpu/drm/drm_dp_mst_topology.c +0 -0
@@ -1014,7 +1011,7 @@ static bool

drm_dp_sideband_parse_req(struct
drm_dp_sideband_msg_rx *raw,

      }

}

-static int build_dpcd_write(struct drm_dp_sideband_msg_tx *msg, u8
port_num, u32 offset, u8 num_bytes, u8 *bytes)
+static void build_dpcd_write(struct drm_dp_sideband_msg_tx *msg, u8
port_num, u32 offset, u8 num_bytes, u8 *bytes)

 {
      struct drm_dp_sideband_msg_req_body req;
drivers/gpu/drm/drm_dp_mst_topology.c +0 -0
@@ -1024,17 +1021,14 @@ static int build_dpcd_write(struct

drm_dp_sideband_msg_tx *msg, u8 port_num, u32

      req.u.dpcd_write.num_bytes = num_bytes;
      req.u.dpcd_write.bytes = bytes;
      drm_dp_encode_sideband_req(&req, msg);
drivers/gpu/drm/drm_dp_mst_topology.c +0 -3
-
-     return 0;
 }
 
-static int build_link_address(struct drm_dp_sideband_msg_tx

*msg)
+static void build_link_address(struct drm_dp_sideband_msg_tx *msg)

 {
      struct drm_dp_sideband_msg_req_body req;

      req.req_type = DP_LINK_ADDRESS;
      drm_dp_encode_sideband_req(&req, msg);

- return 0;
}

static int build_enum_path_resources(struct
drm_dp_sideband_msg_tx
*msg, int port_num)

drivers/gpu/drm/drm_dp_mst_topology.c +0 -0
@@ -1048,7 +1042,7 @@ static int

build_enum_path_resources(struct
drm_dp_sideband_msg_tx *msg, int por

      return 0;

}

-static int build_allocate_payload(struct drm_dp_sideband_msg_tx *msg, int port_num,
+static void build_allocate_payload(struct drm_dp_sideband_msg_tx
*msg, int port_num,

                                u8 vcpi, uint16_t pbn,
                                u8 number_sdp_streams,
                                u8 *sdp_stream_sink)
drivers/gpu/drm/drm_dp_mst_topology.c +0 -0
@@ -1064,10 +1058,9 @@ static int build_allocate_payload(struct

drm_dp_sideband_msg_tx *msg, int port_n

                 number_sdp_streams);
      drm_dp_encode_sideband_req(&req, msg);
      msg->path_msg = true;
drivers/gpu/drm/drm_dp_mst_topology.c +0 -2
-     return 0;
 }
 
-static int build_power_updown_phy(struct drm_dp_sideband_msg_tx

*msg,
+static void build_power_updown_phy(struct drm_dp_sideband_msg_tx
*msg,
int port_num, bool power_up)

 {
      struct drm_dp_sideband_msg_req_body req;
drivers/gpu/drm/drm_dp_mst_topology.c +0 -1
@@ -1080,7 +1073,6 @@ static int build_power_updown_phy(struct
 drm_dp_sideband_msg_tx *msg,
      req.u.port_num.port_number = port_num;
      drm_dp_encode_sideband_req(&req, msg);
      msg->path_msg = true;
-     return 0;
 }
 

static int drm_dp_mst_assign_payload_id(struct
drm_dp_mst_topology_mgr *mgr,

drivers/gpu/drm/drm_dp_mst_topology.c +1 -2
@@ -1746,14 +1738,13 @@ static u8 drm_dp_calculate_rad(struct
 drm_dp_mst_port *port,
  */
 static bool drm_dp_port_setup_pdt(struct drm_dp_mst_port *port)
 {
-     int ret;
      u8 rad[6], lct;
      bool send_link = false;
      switch (port->pdt) {
      case DP_PEER_DEVICE_DP_LEGACY_CONV:
      case DP_PEER_DEVICE_SST_SINK:
              /* add i2c over sideband */
-             ret = drm_dp_mst_register_i2c_bus(&port->aux);
+             drm_dp_mst_register_i2c_bus(&port->aux);
              break;
      case DP_PEER_DEVICE_MST_BRANCHING:
              lct = drm_dp_calculate_rad(port, rad);
drivers/gpu/drm/drm_dp_mst_topology.c +9 -14
@@ -1823,25 +1814,20 @@ ssize_t drm_dp_mst_dpcd_write(struct
 drm_dp_aux *aux,
 
 static void drm_dp_check_mstb_guid(struct drm_dp_mst_branch
 *mstb,
 u8 *guid)
 {
-     int ret;
-
      memcpy(mstb->guid, guid, 16);
 
      if (!drm_dp_validate_guid(mstb->mgr, mstb->guid)) {
              if (mstb->port_parent) {
-                     ret = drm_dp_send_dpcd_write(
-                                     mstb->mgr,
-                                     mstb->port_parent,
-                                     DP_GUID,
-                                     16,
-                                     mstb->guid);
+                     drm_dp_send_dpcd_write(mstb->mgr,
+                                            mstb->port_parent,
+                                            DP_GUID,
+                                            16,
+                                            mstb->guid);
              } else {
-
-                     ret = drm_dp_dpcd_write(
-                                     mstb->mgr->aux,
-                                     DP_GUID,
-                                     mstb->guid,
-                                     16);
+                     drm_dp_dpcd_write(mstb->mgr->aux,
+                                       DP_GUID,
+                                       mstb->guid,
+                                       16);
              }
      }

}

drivers/gpu/drm/drm_dp_mst_topology.c +0 -1
@@ -2197,7 +2183,7 @@ static bool drm_dp_validate_guid(struct
 drm_dp_mst_topology_mgr *mgr,
      return false;
 }
 
-static int build_dpcd_read(struct drm_dp_sideband_msg_tx *msg,

u8
port_num, u32 offset, u8 num_bytes)
+static void build_dpcd_read(struct drm_dp_sideband_msg_tx *msg, u8
port_num, u32 offset, u8 num_bytes)

 {
      struct drm_dp_sideband_msg_req_body req;
drivers/gpu/drm/drm_dp_mst_topology.c +0 -0
@@ -2206,8 +2192,6 @@ static int build_dpcd_read(struct

drm_dp_sideband_msg_tx *msg, u8 port_num, u32

      req.u.dpcd_read.dpcd_address = offset;
      req.u.dpcd_read.num_bytes = num_bytes;
      drm_dp_encode_sideband_req(&req, msg);
drivers/gpu/drm/drm_dp_mst_topology.c +0 -2
-
-     return 0;
 }
 
 static int drm_dp_send_sideband_msg(struct

drm_dp_mst_topology_mgr
*mgr,

drivers/gpu/drm/drm_dp_mst_topology.c +0 -0
@@ -2429,14 +2413,14 @@ static void

drm_dp_send_link_address(struct
drm_dp_mst_topology_mgr *mgr,

 {
      struct drm_dp_sideband_msg_tx *txmsg;
      struct drm_dp_link_address_ack_reply *reply;
drivers/gpu/drm/drm_dp_mst_topology.c +2 -3
-     int i, len, ret;
+     int i, ret;
 
      txmsg = kzalloc(sizeof(*txmsg), GFP_KERNEL);
      if (!txmsg)
              return;
 
      txmsg->dst = mstb;
-     len = build_link_address(txmsg);
+     build_link_address(txmsg);
 
      mstb->link_address_sent = true;
      drm_dp_queue_down_tx(mgr, txmsg);
@@ -2478,7 +2462,6 @@ drm_dp_send_enum_path_resources(struct
 drm_dp_mst_topology_mgr *mgr,
 {
      struct drm_dp_enum_path_resources_ack_reply *path_res;
      struct drm_dp_sideband_msg_tx *txmsg;
-     int len;
      int ret;
 
      txmsg = kzalloc(sizeof(*txmsg), GFP_KERNEL);
drivers/gpu/drm/drm_dp_mst_topology.c +5 -5
@@ -2486,7 +2469,7 @@ drm_dp_send_enum_path_resources(struct
 drm_dp_mst_topology_mgr *mgr,
              return -ENOMEM;
 
      txmsg->dst = mstb;
-     len = build_enum_path_resources(txmsg, port->port_num);
+     build_enum_path_resources(txmsg, port->port_num);
 
      drm_dp_queue_down_tx(mgr, txmsg);
@@ -2569,7 +2552,7 @@ static int drm_dp_payload_send_msg(struct
 drm_dp_mst_topology_mgr *mgr,
 {
      struct drm_dp_sideband_msg_tx *txmsg;
      struct drm_dp_mst_branch *mstb;
-     int len, ret, port_num;
+     int ret, port_num;
      u8 sinks[DRM_DP_MAX_SDP_STREAMS];
      int i;
@@ -2594,9 +2577,9 @@ static int drm_dp_payload_send_msg(struct
 drm_dp_mst_topology_mgr *mgr,
              sinks[i] = i;
 
      txmsg->dst = mstb;
-     len = build_allocate_payload(txmsg, port_num,
-                                  id,
-                                  pbn, port->num_sdp_streams,
 sinks);
+     build_allocate_payload(txmsg, port_num,
+                            id,
+                            pbn, port->num_sdp_streams, sinks);
 
      drm_dp_queue_down_tx(mgr, txmsg);
drivers/gpu/drm/drm_dp_mst_topology.c +0 -0
@@ -2625,7 +2608,7 @@ int drm_dp_send_power_updown_phy(struct
 drm_dp_mst_topology_mgr *mgr,
                               struct drm_dp_mst_port *port,

bool
power_up)

 {
      struct drm_dp_sideband_msg_tx *txmsg;
drivers/gpu/drm/drm_dp_mst_topology.c +2 -2
-     int len, ret;
+     int ret;
 
      port = drm_dp_mst_topology_get_port_validated(mgr, port);
      if (!port)
@@ -2638,7 +2621,7 @@ int drm_dp_send_power_updown_phy(struct
 drm_dp_mst_topology_mgr *mgr,
      }
 
      txmsg->dst = port->parent;
-     len = build_power_updown_phy(txmsg, port->port_num,
 power_up);
+     build_power_updown_phy(txmsg, port->port_num, power_up);
      drm_dp_queue_down_tx(mgr, txmsg);
      ret = drm_dp_mst_wait_tx_reply(port->parent, txmsg);
drivers/gpu/drm/drm_dp_mst_topology.c +0 -1
@@ -2858,7 +2841,6 @@ static int drm_dp_send_dpcd_read(struct
 drm_dp_mst_topology_mgr *mgr,
                               struct drm_dp_mst_port *port,
                               int offset, int size, u8 *bytes)
 {
-     int len;
      int ret = 0;
      struct drm_dp_sideband_msg_tx *txmsg;
      struct drm_dp_mst_branch *mstb;
drivers/gpu/drm/drm_dp_mst_topology.c +1 -1
@@ -2873,7 +2855,7 @@ static int drm_dp_send_dpcd_read(struct
 drm_dp_mst_topology_mgr *mgr,
              goto fail_put;
      }
 
-     len = build_dpcd_read(txmsg, port->port_num, offset,
 size);
+     build_dpcd_read(txmsg, port->port_num, offset, size);
      txmsg->dst = port->parent;
      drm_dp_queue_down_tx(mgr, txmsg);
drivers/gpu/drm/drm_dp_mst_topology.c +0 -1
@@ -2911,7 +2893,6 @@ static int drm_dp_send_dpcd_write(struct
 drm_dp_mst_topology_mgr *mgr,
                                struct drm_dp_mst_port *port,
                                int offset, int size, u8 *bytes)
 {
-     int len;
      int ret;
      struct drm_dp_sideband_msg_tx *txmsg;
      struct drm_dp_mst_branch *mstb;
drivers/gpu/drm/drm_dp_mst_topology.c +1 -1
@@ -2926,7 +2907,7 @@ static int drm_dp_send_dpcd_write(struct
 drm_dp_mst_topology_mgr *mgr,
              goto fail_put;
      }
 
-     len = build_dpcd_write(txmsg, port->port_num, offset,
 size,
 bytes);
+     build_dpcd_write(txmsg, port->port_num, offset, size,
bytes);
      txmsg->dst = mstb;

      drm_dp_queue_down_tx(mgr, txmsg);
drivers/gpu/drm/drm_dp_mst_topology.c +1 -1
@@ -3149,7 +3130,7 @@ static bool drm_dp_get_one_sb_msg(struct
 drm_dp_mst_topology_mgr *mgr, bool up)
 {
      int len;
      u8 replyblock[32];
-     int replylen, origlen, curreply;
+     int replylen, curreply;
      int ret;
      struct drm_dp_sideband_msg_rx *msg;

int basereg = up ? DP_SIDEBAND_MSG_UP_REQ_BASE :
DP_SIDEBAND_MSG_DOWN_REP_BASE;

drivers/gpu/drm/drm_dp_mst_topology.c +0 -1
@@ -3169,7 +3150,6 @@ static bool drm_dp_get_one_sb_msg(struct
 drm_dp_mst_topology_mgr *mgr, bool up)
      }
      replylen = msg->curchunk_len + msg->curchunk_hdrlen;
 
-     origlen = replylen;
      replylen -= len;
      curreply = len;
      while (replylen > 0) {
drivers/gpu/drm/drm_dp_mst_topology.c +2 -4
@@ -3961,17 +3941,16 @@ void drm_dp_mst_dump_topology(struct
 seq_file *m,
      mutex_lock(&mgr->lock);
      if (mgr->mst_primary) {
              u8 buf[DP_PAYLOAD_TABLE_SIZE];
-             int ret;
 
-             ret = drm_dp_dpcd_read(mgr->aux, DP_DPCD_REV, buf,
 DP_RECEIVER_CAP_SIZE);
+             drm_dp_dpcd_read(mgr->aux, DP_DPCD_REV, buf,
 DP_RECEIVER_CAP_SIZE);
              seq_printf(m, "dpcd: %*ph\n",
 DP_RECEIVER_CAP_SIZE,
 buf);
-             ret = drm_dp_dpcd_read(mgr->aux, DP_FAUX_CAP, buf,
 2);
+             drm_dp_dpcd_read(mgr->aux, DP_FAUX_CAP, buf, 2);
              seq_printf(m, "faux/mst: %*ph\n", 2, buf);
-             ret = drm_dp_dpcd_read(mgr->aux, DP_MSTM_CTRL,
 buf,

1);

drivers/gpu/drm/drm_dp_mst_topology.c +1 -1
+             drm_dp_dpcd_read(mgr->aux, DP_MSTM_CTRL, buf, 1);
              seq_printf(m, "mst ctrl: %*ph\n", 1, buf);
 
              /* dump the standard OUI branch header */
-             ret = drm_dp_dpcd_read(mgr->aux, DP_BRANCH_OUI,

buf,
DP_BRANCH_OUI_HEADER_SIZE);
+ drm_dp_dpcd_read(mgr->aux, DP_BRANCH_OUI, buf,

Quoted 5 lines
DP_BRANCH_OUI_HEADER_SIZE);
              seq_printf(m, "branch oui: %*phN devid: ", 3,
buf);
              for (i = 0x3; i < 0x8 && buf[i]; i++)
                      seq_printf(m, "%c", buf[i]);

--
Jani Nikula, Intel Open Source Graphics Center
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

--
Cheers,
Lyude Paul

Signature · 2 lines
Cheers,
	Lyude Paul
maintainer
#11 lore raw
Quoted 19 lines
Quoted 8 lines
Quoted 7 lines
Quoted 1 line

hi-actually yes, we should probably be using this instead of just dropping this. Also, I didn't write this code originally I just refactored a bunch of
it - Dave Airlied is the original author, but the original version of this code was written ages ago. tbh, I think it's a safe bet to say that they probably did mean to use this but forgot to and no one noticed until now.

Quoted 5 lines

Hi,

Any clue about how to use crc value ? Does it have to be checked against something else ?
If crc are not matching what should we do of the data copied just before ?

We should be able to just take the CRC value from the sideband message and then generate our own CRC value using the sideband message contents, and check if the two are equal. If they aren't, something went wrong and we didn't receive the message properly.

Quoted 7 lines

Now as to what we should do when we have CRC mismatches? That's a bit more difficult. If you have access to the DP MST spec, I suppose a place to start figuring that out would be checking if there's a way for us to request that a branch device resend whatever message it sent previously. If there isn't, I guess we should just print an error in dmesg (possibly with a hexdump of the failed message as well) and not forward the message to the driver. Not sure of any better way of handling it then that

Yeah I think this reflects what I wanted to do, I've no memory of a retransmit option in the spec, but I've away from it for a while. But we'd want to compare the CRC with what we got to make sure the are the same.

Dave.
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#12 lore raw
Quoted 23 lines · Dave Airlie
Quoted 16 lines
Quoted 11 lines
Quoted 6 lines

hi-actually yes, we should probably be using this instead of just dropping this. Also, I didn't write this code originally I just refactored a bunch of
it - Dave Airlied is the original author, but the original version of this code was written ages ago. tbh, I think it's a safe bet to say that they probably did mean to use this but forgot to and no one noticed until now.

Hi,

Any clue about how to use crc value ? Does it have to be checked against something else ?
If crc are not matching what should we do of the data copied just before ?

We should be able to just take the CRC value from the sideband message and then generate our own CRC value using the sideband message contents, and check if the two are equal. If they aren't, something went wrong and we didn't receive the message properly.

Quoted 7 lines

Now as to what we should do when we have CRC mismatches? That's a bit more difficult. If you have access to the DP MST spec, I suppose a place to start figuring that out would be checking if there's a way for us to request that a branch device resend whatever message it sent previously. If there isn't, I guess we should just print an error in dmesg (possibly with a hexdump of the failed message as well) and not forward the message to the driver. Not sure of any better way of handling it then that

Quoted 4 lines

Yeah I think this reflects what I wanted to do, I've no memory of a retransmit option in the spec, but I've away from it for a while. But we'd want to compare the CRC with what we got to make sure the are the same.

Hmm, that far more complex than just fix compilation warnings :)

I will split the patch in two:

- one for of all other warnings, hopefully it can get reviewed

- one for this crc4 variable. Does checking crc value and print an error should be acceptable ?

Something like:

if (crc4 != msg->chunk[msg->curchunk_len - 1])

    print_hex_dump(KERN_DEBUG, "wrong crc", DUMP_PREFIX_NONE, 16, 1,
msg->chunk,  msg->curchunk_len, false);

Benjamin

Quoted 2 lines

Dave.

#13 lore raw
Quoted 39 lines · Benjamin GAIGNARD
Quoted 23 lines · Dave Airlie
Quoted 16 lines
Quoted 11 lines
Quoted 6 lines

hi-actually yes, we should probably be using this instead of just dropping this. Also, I didn't write this code originally I just refactored a bunch of
it - Dave Airlied is the original author, but the original version of this code was written ages ago. tbh, I think it's a safe bet to say that they probably did mean to use this but forgot to and no one noticed until now.

Hi,

Any clue about how to use crc value ? Does it have to be checked against something else ?
If crc are not matching what should we do of the data copied just before ?

We should be able to just take the CRC value from the sideband message and then generate our own CRC value using the sideband message contents, and check if the two are equal. If they aren't, something went wrong and we didn't receive the message properly.

Quoted 7 lines

Now as to what we should do when we have CRC mismatches? That's a bit more difficult. If you have access to the DP MST spec, I suppose a place to start figuring that out would be checking if there's a way for us to request that a branch device resend whatever message it sent previously. If there isn't, I guess we should just print an error in dmesg (possibly with a hexdump of the failed message as well) and not forward the message to the driver. Not sure of any better way of handling it then that

Quoted 4 lines

Yeah I think this reflects what I wanted to do, I've no memory of a retransmit option in the spec, but I've away from it for a while. But we'd want to compare the CRC with what we got to make sure the are the same.

Hmm, that far more complex than just fix compilation warnings :)

I will split the patch in two:

- one for of all other warnings, hopefully it can get reviewed

- one for this crc4 variable. Does checking crc value and print an error should be acceptable ?

Quoted 6 lines

Something like:

if (crc4 != msg->chunk[msg->curchunk_len - 1])

    print_hex_dump(KERN_DEBUG, "wrong crc", DUMP_PREFIX_NONE, 16, 1,
msg->chunk,  msg->curchunk_len, false);

Yeah I think that should be reasonable as a start. Then we'll see how much the bug reports start flowing in ...
-Daniel

Quoted 11 lines

Benjamin

Quoted 2 lines

Dave.

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel