[Intel-gfx] [PATCH 11/29] drm/i915: Store DVO SRCDIM register offset under intel_dvo_device
Chris Wilson
chris at chris-wilson.co.uk
Thu Nov 5 03:10:31 PST 2015
On Wed, Nov 04, 2015 at 11:19:59PM +0200, ville.syrjala at linux.intel.com wrote:
> From: Ville Syrjälä <ville.syrjala at linux.intel.com>
>
> Store the DVO SRCDIM register offset alongside the DVO control register
> offset in intel_dvo_device. This gets rid of the switch statement whose
> case values are the DVO control register offsets. Such a construct would
> cause problems for register type safety.
>
> Signed-off-by: Ville Syrjälä <ville.syrjala at linux.intel.com>
Reviewed-by: Chris Wilson <chris at chris-wilson.co.uk>
> @@ -255,20 +262,8 @@ static void intel_dvo_pre_enable(struct intel_encoder *encoder)
> struct intel_dvo *intel_dvo = enc_to_dvo(encoder);
> int pipe = crtc->pipe;
> u32 dvo_val;
> - u32 dvo_reg = intel_dvo->dev.dvo_reg, dvo_srcdim_reg;
> -
> - switch (dvo_reg) {
> - case DVOA:
> - default:
> - dvo_srcdim_reg = DVOA_SRCDIM;
> - break;
> - case DVOB:
> - dvo_srcdim_reg = DVOB_SRCDIM;
> - break;
> - case DVOC:
> - dvo_srcdim_reg = DVOC_SRCDIM;
> - break;
> - }
> + u32 dvo_reg = intel_dvo->dev.dvo_reg;
> + u32 dvo_srcdim_reg = intel_dvo->dev.dvo_srcdim_reg;
It doesn't look like we get much advantage here from the locals now.
Or perhaps struct intel_dvo_device *info = &intel_dvo->dev;
then
val = I915_READ(info->dvo_reg);
....
I915_WRITE(info->dvo_srcdim_reg, foo);
I915_WRITE(info->dvo_reg, val);
-Chris
--
Chris Wilson, Intel Open Source Technology Centre
More information about the Intel-gfx
mailing list