Commit 20c22ad3 authored by Lyude Paul's avatar Lyude Paul

drm/dp_mst: Remove drm_dp_mst_has_audio()

Drive-by fix I noticed the other day - drm_dp_mst_has_audio() only ever
made sense back when we still had to validate ports before accessing
them in order to (attempt to) avoid NULL dereferences. Since we have
proper reference counting that guarantees we always can safely access
the MST port, there's no use in keeping this function around as all it
does is validate the port pointer before checking the audio status.

Note - drm_dp_mst_port->has_audio is technically protected by
drm_device->mode_config.connection_mutex, since it's only ever updated
from drm_dp_mst_get_edid(). Additionally, we change the declaration for
port in struct intel_connector to be properly typed, so we can directly
access it.

Changes since v1:
* Change type of intel_connector->port in a separate patch - Sean Paul

Cc: "Lee, Shawn C" <shawn.c.lee@intel.com>
Reviewed-by: default avatarSean Paul <sean@poorly.run>
Signed-off-by: default avatarLyude Paul <lyude@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200406200646.1263435-2-lyude@redhat.com
parent 75727b30
...@@ -4062,27 +4062,6 @@ drm_dp_mst_detect_port(struct drm_connector *connector, ...@@ -4062,27 +4062,6 @@ drm_dp_mst_detect_port(struct drm_connector *connector,
} }
EXPORT_SYMBOL(drm_dp_mst_detect_port); EXPORT_SYMBOL(drm_dp_mst_detect_port);
/**
* drm_dp_mst_port_has_audio() - Check whether port has audio capability or not
* @mgr: manager for this port
* @port: unverified pointer to a port.
*
* This returns whether the port supports audio or not.
*/
bool drm_dp_mst_port_has_audio(struct drm_dp_mst_topology_mgr *mgr,
struct drm_dp_mst_port *port)
{
bool ret = false;
port = drm_dp_mst_topology_get_port_validated(mgr, port);
if (!port)
return ret;
ret = port->has_audio;
drm_dp_mst_topology_put_port(port);
return ret;
}
EXPORT_SYMBOL(drm_dp_mst_port_has_audio);
/** /**
* drm_dp_mst_get_edid() - get EDID for an MST port * drm_dp_mst_get_edid() - get EDID for an MST port
* @connector: toplevel connector to get EDID for * @connector: toplevel connector to get EDID for
......
...@@ -631,15 +631,9 @@ static void intel_dp_info(struct seq_file *m, ...@@ -631,15 +631,9 @@ static void intel_dp_info(struct seq_file *m,
} }
static void intel_dp_mst_info(struct seq_file *m, static void intel_dp_mst_info(struct seq_file *m,
struct intel_connector *intel_connector) struct intel_connector *intel_connector)
{ {
struct intel_encoder *intel_encoder = intel_attached_encoder(intel_connector); bool has_audio = intel_connector->port->has_audio;
struct intel_dp_mst_encoder *intel_mst =
enc_to_mst(intel_encoder);
struct intel_digital_port *intel_dig_port = intel_mst->primary;
struct intel_dp *intel_dp = &intel_dig_port->dp;
bool has_audio = drm_dp_mst_port_has_audio(&intel_dp->mst_mgr,
intel_connector->port);
seq_printf(m, "\taudio support: %s\n", yesno(has_audio)); seq_printf(m, "\taudio support: %s\n", yesno(has_audio));
} }
......
...@@ -158,8 +158,7 @@ static int intel_dp_mst_compute_config(struct intel_encoder *encoder, ...@@ -158,8 +158,7 @@ static int intel_dp_mst_compute_config(struct intel_encoder *encoder,
pipe_config->has_pch_encoder = false; pipe_config->has_pch_encoder = false;
if (intel_conn_state->force_audio == HDMI_AUDIO_AUTO) if (intel_conn_state->force_audio == HDMI_AUDIO_AUTO)
pipe_config->has_audio = pipe_config->has_audio = connector->port->has_audio;
drm_dp_mst_port_has_audio(&intel_dp->mst_mgr, port);
else else
pipe_config->has_audio = pipe_config->has_audio =
intel_conn_state->force_audio == HDMI_AUDIO_ON; intel_conn_state->force_audio == HDMI_AUDIO_ON;
......
...@@ -732,8 +732,6 @@ drm_dp_mst_detect_port(struct drm_connector *connector, ...@@ -732,8 +732,6 @@ drm_dp_mst_detect_port(struct drm_connector *connector,
struct drm_dp_mst_topology_mgr *mgr, struct drm_dp_mst_topology_mgr *mgr,
struct drm_dp_mst_port *port); struct drm_dp_mst_port *port);
bool drm_dp_mst_port_has_audio(struct drm_dp_mst_topology_mgr *mgr,
struct drm_dp_mst_port *port);
struct edid *drm_dp_mst_get_edid(struct drm_connector *connector, struct drm_dp_mst_topology_mgr *mgr, struct drm_dp_mst_port *port); struct edid *drm_dp_mst_get_edid(struct drm_connector *connector, struct drm_dp_mst_topology_mgr *mgr, struct drm_dp_mst_port *port);
......
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