Commit 68d8c9fc authored by Dave Airlie's avatar Dave Airlie Committed by Dave Airlie

drm/dp/mst: update the link_address_sent before sending the link address (v3)

Update the state before sending the msg to close it.

v2: reset value if return indicates we haven't send the msg.
v3: just clean the code up.
Pointed out by Adam J Richter on

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=91481Reviewed-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
parent df4839fd
...@@ -53,7 +53,7 @@ static int drm_dp_send_dpcd_write(struct drm_dp_mst_topology_mgr *mgr, ...@@ -53,7 +53,7 @@ static int drm_dp_send_dpcd_write(struct drm_dp_mst_topology_mgr *mgr,
struct drm_dp_mst_port *port, struct drm_dp_mst_port *port,
int offset, int size, u8 *bytes); int offset, int size, u8 *bytes);
static int drm_dp_send_link_address(struct drm_dp_mst_topology_mgr *mgr, static void drm_dp_send_link_address(struct drm_dp_mst_topology_mgr *mgr,
struct drm_dp_mst_branch *mstb); struct drm_dp_mst_branch *mstb);
static int drm_dp_send_enum_path_resources(struct drm_dp_mst_topology_mgr *mgr, static int drm_dp_send_enum_path_resources(struct drm_dp_mst_topology_mgr *mgr,
struct drm_dp_mst_branch *mstb, struct drm_dp_mst_branch *mstb,
...@@ -1109,10 +1109,8 @@ static void drm_dp_add_port(struct drm_dp_mst_branch *mstb, ...@@ -1109,10 +1109,8 @@ static void drm_dp_add_port(struct drm_dp_mst_branch *mstb,
drm_dp_port_teardown_pdt(port, old_pdt); drm_dp_port_teardown_pdt(port, old_pdt);
ret = drm_dp_port_setup_pdt(port); ret = drm_dp_port_setup_pdt(port);
if (ret == true) { if (ret == true)
drm_dp_send_link_address(mstb->mgr, port->mstb); drm_dp_send_link_address(mstb->mgr, port->mstb);
port->mstb->link_address_sent = true;
}
} }
if (created && !port->input) { if (created && !port->input) {
...@@ -1216,10 +1214,9 @@ static void drm_dp_check_and_send_link_address(struct drm_dp_mst_topology_mgr *m ...@@ -1216,10 +1214,9 @@ static void drm_dp_check_and_send_link_address(struct drm_dp_mst_topology_mgr *m
{ {
struct drm_dp_mst_port *port; struct drm_dp_mst_port *port;
struct drm_dp_mst_branch *mstb_child; struct drm_dp_mst_branch *mstb_child;
if (!mstb->link_address_sent) { if (!mstb->link_address_sent)
drm_dp_send_link_address(mgr, mstb); drm_dp_send_link_address(mgr, mstb);
mstb->link_address_sent = true;
}
list_for_each_entry(port, &mstb->ports, next) { list_for_each_entry(port, &mstb->ports, next) {
if (port->input) if (port->input)
continue; continue;
...@@ -1472,7 +1469,7 @@ static void drm_dp_queue_down_tx(struct drm_dp_mst_topology_mgr *mgr, ...@@ -1472,7 +1469,7 @@ static void drm_dp_queue_down_tx(struct drm_dp_mst_topology_mgr *mgr,
mutex_unlock(&mgr->qlock); mutex_unlock(&mgr->qlock);
} }
static int drm_dp_send_link_address(struct drm_dp_mst_topology_mgr *mgr, static void drm_dp_send_link_address(struct drm_dp_mst_topology_mgr *mgr,
struct drm_dp_mst_branch *mstb) struct drm_dp_mst_branch *mstb)
{ {
int len; int len;
...@@ -1481,11 +1478,12 @@ static int drm_dp_send_link_address(struct drm_dp_mst_topology_mgr *mgr, ...@@ -1481,11 +1478,12 @@ static int drm_dp_send_link_address(struct drm_dp_mst_topology_mgr *mgr,
txmsg = kzalloc(sizeof(*txmsg), GFP_KERNEL); txmsg = kzalloc(sizeof(*txmsg), GFP_KERNEL);
if (!txmsg) if (!txmsg)
return -ENOMEM; return;
txmsg->dst = mstb; txmsg->dst = mstb;
len = build_link_address(txmsg); len = build_link_address(txmsg);
mstb->link_address_sent = true;
drm_dp_queue_down_tx(mgr, txmsg); drm_dp_queue_down_tx(mgr, txmsg);
ret = drm_dp_mst_wait_tx_reply(mstb, txmsg); ret = drm_dp_mst_wait_tx_reply(mstb, txmsg);
...@@ -1513,11 +1511,12 @@ static int drm_dp_send_link_address(struct drm_dp_mst_topology_mgr *mgr, ...@@ -1513,11 +1511,12 @@ static int drm_dp_send_link_address(struct drm_dp_mst_topology_mgr *mgr,
} }
(*mgr->cbs->hotplug)(mgr); (*mgr->cbs->hotplug)(mgr);
} }
} else } else {
mstb->link_address_sent = false;
DRM_DEBUG_KMS("link address failed %d\n", ret); DRM_DEBUG_KMS("link address failed %d\n", ret);
}
kfree(txmsg); kfree(txmsg);
return 0;
} }
static int drm_dp_send_enum_path_resources(struct drm_dp_mst_topology_mgr *mgr, static int drm_dp_send_enum_path_resources(struct drm_dp_mst_topology_mgr *mgr,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment