drm/i915/dp: Move initialization of hpd_pin to a new function
authorAnder Conselvan de Oliveira <ander.conselvan.de.oliveira@intel.com>
Fri, 3 Feb 2017 14:03:14 +0000 (16:03 +0200)
committerAnder Conselvan de Oliveira <ander.conselvan.de.oliveira@intel.com>
Thu, 9 Feb 2017 08:20:11 +0000 (10:20 +0200)
This shaves a few lines from intel_dp_init_connector() and will serve as
a good place to add other port specific information in a follow up
patch.

While at it, convert BUG() to MISSING_CASE() in the default case.

v2: s/BUG/MISSING_CASE. (Chris)
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Jani Nikula <jani.nikula@linux.intel.com>
Signed-off-by: Ander Conselvan de Oliveira <ander.conselvan.de.oliveira@intel.com>
Reviewed-by: Jani Nikula <jani.nikula@intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20170203140316.20792-2-ander.conselvan.de.oliveira@intel.com
drivers/gpu/drm/i915/intel_dp.c

index dee5fc758109d73cd4cad54347b771c5cb30158d..fa77e96c49c7260c6a5c155e1956d04c1e15ad80 100644 (file)
@@ -5903,6 +5903,33 @@ out_vdd_off:
        return false;
 }
 
+static void
+intel_dp_init_connector_port_info(struct intel_digital_port *intel_dig_port)
+{
+       struct intel_encoder *encoder = &intel_dig_port->base;
+
+       /* Set up the hotplug pin. */
+       switch (intel_dig_port->port) {
+       case PORT_A:
+               encoder->hpd_pin = HPD_PORT_A;
+               break;
+       case PORT_B:
+               encoder->hpd_pin = HPD_PORT_B;
+               break;
+       case PORT_C:
+               encoder->hpd_pin = HPD_PORT_C;
+               break;
+       case PORT_D:
+               encoder->hpd_pin = HPD_PORT_D;
+               break;
+       case PORT_E:
+               encoder->hpd_pin = HPD_PORT_E;
+               break;
+       default:
+               MISSING_CASE(intel_dig_port->port);
+       }
+}
+
 bool
 intel_dp_init_connector(struct intel_digital_port *intel_dig_port,
                        struct intel_connector *intel_connector)
@@ -5988,26 +6015,7 @@ intel_dp_init_connector(struct intel_digital_port *intel_dig_port,
        else
                intel_connector->get_hw_state = intel_connector_get_hw_state;
 
-       /* Set up the hotplug pin. */
-       switch (port) {
-       case PORT_A:
-               intel_encoder->hpd_pin = HPD_PORT_A;
-               break;
-       case PORT_B:
-               intel_encoder->hpd_pin = HPD_PORT_B;
-               break;
-       case PORT_C:
-               intel_encoder->hpd_pin = HPD_PORT_C;
-               break;
-       case PORT_D:
-               intel_encoder->hpd_pin = HPD_PORT_D;
-               break;
-       case PORT_E:
-               intel_encoder->hpd_pin = HPD_PORT_E;
-               break;
-       default:
-               BUG();
-       }
+       intel_dp_init_connector_port_info(intel_dig_port);
 
        /* init MST on ports that can support it */
        if (HAS_DP_MST(dev_priv) && !is_edp(intel_dp) &&