Re: [PATCH 38/43] drm/i915: Parametrize AUX registes

Daniel Vetter
2015-09-28T13:49:07Z

On Mon, Sep 28, 2015 at 04:34:10PM +0300, Ville Syrjälä wrote:
> On Mon, Sep 28, 2015 at 03:28:39PM +0200, Daniel Vetter wrote:
> > On Mon, Sep 28, 2015 at 03:15:18PM +0300, Jani Nikula wrote:
> > > On Fri, 18 Sep 2015, ville.syrjala@linux.intel.com wrote:
> > > > @@ -1012,35 +1012,16 @@ intel_dp_aux_transfer(struct drm_dp_aux *aux, struct drm_dp_aux_msg *msg)
> > > > static uint32_t g4x_aux_ctl_reg(struct drm_i915_private *dev_priv,
> > > > enum port port)
> > > > {
> > > > - switch (port) {
> > > > - case PORT_B:
> > > > - return DPB_AUX_CH_CTL;
> > > > - case PORT_C:
> > > > - return DPC_AUX_CH_CTL;
> > > > - case PORT_D:
> > > > - return DPD_AUX_CH_CTL;
> > > > - default:
> > > > - MISSING_CASE(port);
> > > > - return DPB_AUX_CH_CTL;
> > > > - }
> > > > + return DP_AUX_CH_CTL(port);
> > >
> > > Together with the previous patch you now lose all MISSING_CASE/BUG/WARN
> > > for having an out-of-bounds/unsupported port. I kinda liked them.
> >
> > MISSING_REG() to satisfy the typechecks would be good I think. Or
> > MISSING_CASE_REG().
>
> I've never caught anything with such checks, but if people want then I
> could keep them around. I suppose the fact that we don't have AUX for
> port E+ means they could actually be useful here, at least on SKL. For
> the other platforms they're pointless IMO, but I can include them there
> if people so wish. I didn't actually check if port E on SKL was the only
> exception, or if we continue with similar limitations in the future.

It's not so much that it catches bugs, but it does prevent people from
using BUG() instead. And I don't take patches with BUG() any more because
too much time wasted with machines dying under console_lock because of
that ;-)
-Daniel
--
Daniel Vetter
Software Engineer, Intel Corporation