drm/dp_mst: Simplify the condition when to enumerate path resources

In the
	if (old_ddps != port->ddps || !created)
		if (port->ddps && !port->input)
			ret = drm_dp_send_enum_path_resources();

sequence the first if's condition is true if the port exists already
(!created) or the port was created anew (hence old_ddps==0) and it was
in the plugged state (port->ddps==1). The second if's condition is true
for output ports in the plugged state. So the function is called for an
output port in the plugged state, regardless if it already existed or
not and regardless of the old plugged state. In all other cases
port->full_pbn can be zeroed as the port is either an input for which
full_pbn is never set, or an output in the unplugged state for which
full_pbn was already zeroed previously or the port was just created
(with port->full_pbn==0).

Simplify the condition, making it clear that the path resources are
always enumerated for an output port in the plugged state.

Cc: Lyude Paul <lyude@redhat.com>
Cc: dri-devel@lists.freedesktop.org
Reviewed-by: Lyude Paul <lyude@redhat.com>
Signed-off-by: Imre Deak <imre.deak@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20240722165503.2084999-4-imre.deak@intel.com
This commit is contained in:
Imre Deak 2024-07-22 19:54:52 +03:00
parent dbaeef363e
commit 0cf09702a1

View File

@ -2339,7 +2339,7 @@ drm_dp_mst_handle_link_address_port(struct drm_dp_mst_branch *mstb,
{ {
struct drm_dp_mst_topology_mgr *mgr = mstb->mgr; struct drm_dp_mst_topology_mgr *mgr = mstb->mgr;
struct drm_dp_mst_port *port; struct drm_dp_mst_port *port;
int old_ddps = 0, ret; int ret;
u8 new_pdt = DP_PEER_DEVICE_NONE; u8 new_pdt = DP_PEER_DEVICE_NONE;
bool new_mcs = 0; bool new_mcs = 0;
bool created = false, send_link_addr = false, changed = false; bool created = false, send_link_addr = false, changed = false;
@ -2372,7 +2372,6 @@ drm_dp_mst_handle_link_address_port(struct drm_dp_mst_branch *mstb,
*/ */
drm_modeset_lock(&mgr->base.lock, NULL); drm_modeset_lock(&mgr->base.lock, NULL);
old_ddps = port->ddps;
changed = port->ddps != port_msg->ddps || changed = port->ddps != port_msg->ddps ||
(port->ddps && (port->ddps &&
(port->ldps != port_msg->legacy_device_plug_status || (port->ldps != port_msg->legacy_device_plug_status ||
@ -2407,7 +2406,6 @@ drm_dp_mst_handle_link_address_port(struct drm_dp_mst_branch *mstb,
* Reprobe PBN caps on both hotplug, and when re-probing the link * Reprobe PBN caps on both hotplug, and when re-probing the link
* for our parent mstb * for our parent mstb
*/ */
if (old_ddps != port->ddps || !created) {
if (port->ddps && !port->input) { if (port->ddps && !port->input) {
ret = drm_dp_send_enum_path_resources(mgr, mstb, ret = drm_dp_send_enum_path_resources(mgr, mstb,
port); port);
@ -2416,7 +2414,6 @@ drm_dp_mst_handle_link_address_port(struct drm_dp_mst_branch *mstb,
} else { } else {
port->full_pbn = 0; port->full_pbn = 0;
} }
}
ret = drm_dp_port_set_pdt(port, new_pdt, new_mcs); ret = drm_dp_port_set_pdt(port, new_pdt, new_mcs);
if (ret == 1) { if (ret == 1) {