On Wed, Nov 04, 2015 at 11:19:59PM +0200, ville.syrjala@xxxxxxxxxxxxxxx wrote: > From: Ville Syrjälä <ville.syrjala@xxxxxxxxxxxxxxx> > > 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@xxxxxxxxxxxxxxx> Reviewed-by: Chris Wilson <chris@xxxxxxxxxxxxxxxxxx> > @@ -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 _______________________________________________ Intel-gfx mailing list Intel-gfx@xxxxxxxxxxxxxxxxxxxxx http://lists.freedesktop.org/mailman/listinfo/intel-gfx