@@ -3955,6 +3955,7 @@ static int displayport_config_ctl_show(struct seq_file *m, void *data)
struct drm_connector *drm_connector;
struct intel_encoder *encoder;
struct intel_connector *connector;
+ char *conn_name;
if (!dev)
return -ENODEV;
@@ -3964,23 +3965,14 @@ static int displayport_config_ctl_show(struct seq_file *m, void *data)
head) {
connector = to_intel_connector(drm_connector);
encoder = connector->encoder;
- if (drm_connector->connector_type ==
- DRM_MODE_CONNECTOR_DisplayPort) {
- if (encoder->type == INTEL_OUTPUT_DISPLAYPORT ||
- encoder->type == INTEL_OUTPUT_UNKNOWN) {
- if (drm_connector->status ==
- connector_status_connected) {
- displayport_show_config_info(m,
- connector);
- } else {
- seq_printf(m, DP_CONF_STR_CONNECTOR,
- encoder->base.name);
- seq_puts(m, "disconnected\n");
- }
- }
+ conn_name = connector->base.name;
+ if (dp_connector_is_valid(drm_connector, 1)) {
+ displayport_show_config_info(m, connector);
+ } else {
+ seq_printf(m, DP_CONF_STR_CONNECTOR, conn_name);
+ seq_puts(m, "disconnected\n");
}
}
-
return 0;
}
@@ -4001,7 +3993,6 @@ static ssize_t displayport_config_ctl_write(struct file *file,
struct seq_file *m;
struct drm_device *dev;
struct drm_connector *connector;
- struct drm_encoder *drm_enc;
struct intel_encoder *intel_encoder;
struct intel_connector *intel_connector;
struct intel_dp *intel_dp;
@@ -4036,18 +4027,13 @@ static ssize_t displayport_config_ctl_write(struct file *file,
list_for_each_entry(connector, &dev->mode_config.connector_list, head) {
intel_connector = to_intel_connector(connector);
intel_encoder = intel_connector->encoder;
- drm_enc = &intel_encoder->base;
- if (connector->connector_type ==
- DRM_MODE_CONNECTOR_DisplayPort) {
- if (intel_encoder->type == INTEL_OUTPUT_DISPLAYPORT ||
- intel_encoder->type == INTEL_OUTPUT_UNKNOWN) {
- intel_dp = enc_to_intel_dp(drm_enc);
- status = displayport_parse_config(input_buffer,
- len,
- intel_dp);
- if (status < 0)
- goto out;
- }
+ if (dp_connector_is_valid(connector, 0)) {
+ intel_dp = enc_to_intel_dp(&intel_encoder->base);
+ status = displayport_parse_config(input_buffer,
+ len,
+ intel_dp);
+ if (status < 0)
+ goto out;
}
}
out:
Updates displayport_config_ctl_write and displayport_config_ctl_show to use the dp_connector_is_valid() function. This saves on code and improves maintainability by unifying the code in a single, common path. Signed-off-by: Todd Previte <tprevite@gmail.com> --- drivers/gpu/drm/i915/i915_debugfs.c | 42 +++++++++++++------------------------ 1 file changed, 14 insertions(+), 28 deletions(-)