[Intel-gfx] [PATCH 45/66] drm/i915: Unexport intel_ddi_connector_get_hw_state
Paulo Zanoni
przanoni at gmail.com
Thu May 22 22:13:35 CEST 2014
2014-04-24 18:55 GMT-03:00 Daniel Vetter <daniel.vetter at ffwll.ch>:
> 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.
>
> Signed-off-by: Daniel Vetter <daniel.vetter at ffwll.ch>
The nice thing about the current code is that intel_ddi_init(),
intel_hdmi_init() and intel_dp_init() only init encoder-specific data,
and the xx_connector_init() functions only init connector-specific
data. This patch will break this abstraction. I think the cost of
breaking the organization just to unexport a function is not worth it.
Also, see below:
> ---
> drivers/gpu/drm/i915/intel_ddi.c | 10 +++++++---
> drivers/gpu/drm/i915/intel_dp.c | 5 +----
> drivers/gpu/drm/i915/intel_drv.h | 1 -
> drivers/gpu/drm/i915/intel_hdmi.c | 5 +----
> 4 files changed, 9 insertions(+), 12 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/intel_ddi.c b/drivers/gpu/drm/i915/intel_ddi.c
> index ace43c6a6fa4..afa1e87c54cc 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;
> @@ -1689,13 +1689,17 @@ void intel_ddi_init(struct drm_device *dev, enum port port)
> intel_encoder->cloneable = 0;
> intel_encoder->hot_plug = intel_ddi_hot_plug;
>
> - if (init_dp)
> + if (init_dp) {
> dp_connector = intel_ddi_init_dp_connector(intel_dig_port);
> + dp_connector->get_hw_state = intel_ddi_connector_get_hw_state;
This can segfault.
> + }
>
> /* 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..ca94be9554f4 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. */
> @@ -4043,4 +4039,5 @@ intel_dp_init(struct drm_device *dev, int output_reg, enum port port)
> kfree(intel_dig_port);
> kfree(intel_connector);
> }
> + intel_connector->get_hw_state = intel_connector_get_hw_state;
This can also segfault.
> }
> 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
>
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx
--
Paulo Zanoni
More information about the Intel-gfx
mailing list