drm/i915: constify fdi link training vtable
authorDave Airlie <airlied@redhat.com>
Tue, 28 Sep 2021 22:57:59 +0000 (01:57 +0300)
committerJani Nikula <jani.nikula@intel.com>
Wed, 29 Sep 2021 06:28:37 +0000 (09:28 +0300)
Put the vtable into ro memory.

Reviewed-by: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/ec4687956f9b98024fea55b2f0ed1e192e244ff1.1632869550.git.jani.nikula@intel.com
drivers/gpu/drm/i915/display/intel_fdi.c
drivers/gpu/drm/i915/i915_drv.h

index f828beb..af01d1f 100644 (file)
@@ -15,7 +15,7 @@ void intel_fdi_link_train(struct intel_crtc *crtc,
 {
        struct drm_i915_private *dev_priv = to_i915(crtc->base.dev);
 
-       dev_priv->fdi_funcs.fdi_link_train(crtc, crtc_state);
+       dev_priv->fdi_funcs->fdi_link_train(crtc, crtc_state);
 }
 
 /* units of 100MHz */
@@ -1013,15 +1013,27 @@ void lpt_fdi_program_mphy(struct drm_i915_private *dev_priv)
        intel_sbi_write(dev_priv, 0x21EC, tmp, SBI_MPHY);
 }
 
+static const struct intel_fdi_funcs ilk_funcs = {
+       .fdi_link_train = ilk_fdi_link_train,
+};
+
+static const struct intel_fdi_funcs gen6_funcs = {
+       .fdi_link_train = gen6_fdi_link_train,
+};
+
+static const struct intel_fdi_funcs ivb_funcs = {
+       .fdi_link_train = ivb_manual_fdi_link_train,
+};
+
 void
 intel_fdi_init_hook(struct drm_i915_private *dev_priv)
 {
        if (IS_IRONLAKE(dev_priv)) {
-               dev_priv->fdi_funcs.fdi_link_train = ilk_fdi_link_train;
+               dev_priv->fdi_funcs = &ilk_funcs;
        } else if (IS_SANDYBRIDGE(dev_priv)) {
-               dev_priv->fdi_funcs.fdi_link_train = gen6_fdi_link_train;
+               dev_priv->fdi_funcs = &gen6_funcs;
        } else if (IS_IVYBRIDGE(dev_priv)) {
                /* FIXME: detect B0+ stepping and use auto training */
-               dev_priv->fdi_funcs.fdi_link_train = ivb_manual_fdi_link_train;
+               dev_priv->fdi_funcs = &ivb_funcs;
        }
 }
index ed2d8b6..e01fe21 100644 (file)
@@ -991,7 +991,7 @@ struct drm_i915_private {
        struct intel_hotplug_funcs hotplug_funcs;
 
        /* fdi display functions */
-       struct intel_fdi_funcs fdi_funcs;
+       const struct intel_fdi_funcs *fdi_funcs;
 
        /* display pll funcs */
        struct intel_dpll_funcs dpll_funcs;