[Intel-gfx] [PATCH] drm/i915: Unexport intel_ddi_connector_get_hw_state

Daniel Vetter daniel.vetter at ffwll.ch
Thu May 22 22:49:46 CEST 2014


The connector->get_hw_state function is actually platform dependent.
So move it out of the shared connector init functions. This allows us
to drop another intel_ddi.c export.

v2: Fix segfaults when the dp connector fails to initialize (e.g. due
there not being a panel). Spotted by Paulo.

Cc: Paulo Zanoni <przanoni at gmail.com>
Signed-off-by: Daniel Vetter <daniel.vetter at ffwll.ch>
---
 drivers/gpu/drm/i915/intel_ddi.c  | 8 ++++++--
 drivers/gpu/drm/i915/intel_dp.c   | 6 ++----
 drivers/gpu/drm/i915/intel_drv.h  | 1 -
 drivers/gpu/drm/i915/intel_hdmi.c | 5 +----
 4 files changed, 9 insertions(+), 11 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_ddi.c b/drivers/gpu/drm/i915/intel_ddi.c
index ace43c6a6fa4..9e5c189c8100 100644
--- a/drivers/gpu/drm/i915/intel_ddi.c
+++ b/drivers/gpu/drm/i915/intel_ddi.c
@@ -1037,7 +1037,7 @@ void intel_ddi_disable_transcoder_func(struct drm_i915_private *dev_priv,
 	I915_WRITE(reg, val);
 }
 
-bool intel_ddi_connector_get_hw_state(struct intel_connector *intel_connector)
+static bool intel_ddi_connector_get_hw_state(struct intel_connector *intel_connector)
 {
 	struct drm_device *dev = intel_connector->base.dev;
 	struct drm_i915_private *dev_priv = dev->dev_private;
@@ -1691,11 +1691,15 @@ void intel_ddi_init(struct drm_device *dev, enum port port)
 
 	if (init_dp)
 		dp_connector = intel_ddi_init_dp_connector(intel_dig_port);
+	if (dp_connector)
+		dp_connector->get_hw_state = intel_ddi_connector_get_hw_state;
 
 	/* In theory we don't need the encoder->type check, but leave it just in
 	 * case we have some really bad VBTs... */
-	if (intel_encoder->type != INTEL_OUTPUT_EDP && init_hdmi)
+	if (intel_encoder->type != INTEL_OUTPUT_EDP && init_hdmi) {
 		hdmi_connector = intel_ddi_init_hdmi_connector(intel_dig_port);
+		hdmi_connector->get_hw_state = intel_ddi_connector_get_hw_state;
+	}
 
 	if (!dp_connector && !hdmi_connector) {
 		drm_encoder_cleanup(encoder);
diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
index 5746fe22dde3..803d0b8f30f2 100644
--- a/drivers/gpu/drm/i915/intel_dp.c
+++ b/drivers/gpu/drm/i915/intel_dp.c
@@ -3931,10 +3931,6 @@ intel_dp_init_connector(struct intel_digital_port *intel_dig_port,
 	intel_connector_attach_encoder(intel_connector, intel_encoder);
 	drm_sysfs_connector_add(connector);
 
-	if (HAS_DDI(dev))
-		intel_connector->get_hw_state = intel_ddi_connector_get_hw_state;
-	else
-		intel_connector->get_hw_state = intel_connector_get_hw_state;
 	intel_connector->unregister = intel_dp_connector_unregister;
 
 	/* Set up the hotplug pin. */
@@ -4038,6 +4034,8 @@ intel_dp_init(struct drm_device *dev, int output_reg, enum port port)
 	intel_encoder->cloneable = 0;
 	intel_encoder->hot_plug = intel_dp_hot_plug;
 
+	intel_connector->get_hw_state = intel_connector_get_hw_state;
+
 	if (!intel_dp_init_connector(intel_dig_port, intel_connector)) {
 		drm_encoder_cleanup(encoder);
 		kfree(intel_dig_port);
diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
index ba727b11014a..1c093e71db7d 100644
--- a/drivers/gpu/drm/i915/intel_drv.h
+++ b/drivers/gpu/drm/i915/intel_drv.h
@@ -686,7 +686,6 @@ void intel_ddi_pll_enable(struct intel_crtc *crtc);
 void intel_ddi_put_crtc_pll(struct drm_crtc *crtc);
 void intel_ddi_set_pipe_settings(struct drm_crtc *crtc);
 void intel_ddi_prepare_link_retrain(struct drm_encoder *encoder);
-bool intel_ddi_connector_get_hw_state(struct intel_connector *intel_connector);
 void intel_ddi_fdi_disable(struct drm_crtc *crtc);
 void intel_ddi_get_config(struct intel_encoder *encoder,
 			  struct intel_crtc_config *pipe_config);
diff --git a/drivers/gpu/drm/i915/intel_hdmi.c b/drivers/gpu/drm/i915/intel_hdmi.c
index ced93bd33f80..b748bb39347c 100644
--- a/drivers/gpu/drm/i915/intel_hdmi.c
+++ b/drivers/gpu/drm/i915/intel_hdmi.c
@@ -1328,10 +1328,6 @@ void intel_hdmi_init_connector(struct intel_digital_port *intel_dig_port,
 		intel_hdmi->set_infoframes = cpt_set_infoframes;
 	}
 
-	if (HAS_DDI(dev))
-		intel_connector->get_hw_state = intel_ddi_connector_get_hw_state;
-	else
-		intel_connector->get_hw_state = intel_connector_get_hw_state;
 	intel_connector->unregister = intel_connector_unregister;
 
 	intel_hdmi_add_properties(intel_hdmi, connector);
@@ -1400,4 +1396,5 @@ void intel_hdmi_init(struct drm_device *dev, int hdmi_reg, enum port port)
 	intel_dig_port->dp.output_reg = 0;
 
 	intel_hdmi_init_connector(intel_dig_port, intel_connector);
+	intel_connector->get_hw_state = intel_connector_get_hw_state;
 }
-- 
1.8.1.4




More information about the Intel-gfx mailing list