]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blobdiff - drivers/gpu/drm/i915/intel_bios.c
drm/i915/bios: cleanup comments and useless return
[mirror_ubuntu-bionic-kernel.git] / drivers / gpu / drm / i915 / intel_bios.c
index b881ce8596eeca2a8c2d5ee7639a50240dd9548a..edc218e5eead89ed8ad36ab69c5adb834367b022 100644 (file)
@@ -435,21 +435,27 @@ static void
 parse_general_definitions(struct drm_i915_private *dev_priv,
                          const struct bdb_header *bdb)
 {
-       const struct bdb_general_definitions *general;
-
-       general = find_section(bdb, BDB_GENERAL_DEFINITIONS);
-       if (general) {
-               u16 block_size = get_blocksize(general);
-               if (block_size >= sizeof(*general)) {
-                       int bus_pin = general->crt_ddc_gmbus_pin;
-                       DRM_DEBUG_KMS("crt_ddc_bus_pin: %d\n", bus_pin);
-                       if (intel_gmbus_is_valid_pin(dev_priv, bus_pin))
-                               dev_priv->vbt.crt_ddc_pin = bus_pin;
-               } else {
-                       DRM_DEBUG_KMS("BDB_GD too small (%d). Invalid.\n",
-                                     block_size);
-               }
+       const struct bdb_general_definitions *defs;
+       u16 block_size;
+       int bus_pin;
+
+       defs = find_section(bdb, BDB_GENERAL_DEFINITIONS);
+       if (!defs) {
+               DRM_DEBUG_KMS("General definitions block not found\n");
+               return;
        }
+
+       block_size = get_blocksize(defs);
+       if (block_size < sizeof(*defs)) {
+               DRM_DEBUG_KMS("General definitions block too small (%u)\n",
+                             block_size);
+               return;
+       }
+
+       bus_pin = defs->crt_ddc_gmbus_pin;
+       DRM_DEBUG_KMS("crt_ddc_bus_pin: %d\n", bus_pin);
+       if (intel_gmbus_is_valid_pin(dev_priv, bus_pin))
+               dev_priv->vbt.crt_ddc_pin = bus_pin;
 }
 
 static const struct child_device_config *
@@ -1240,7 +1246,7 @@ static void parse_ddi_ports(struct drm_i915_private *dev_priv,
 {
        enum port port;
 
-       if (!HAS_DDI(dev_priv))
+       if (!HAS_DDI(dev_priv) && !IS_CHERRYVIEW(dev_priv))
                return;
 
        if (!dev_priv->vbt.child_dev_num)
@@ -1259,7 +1265,6 @@ parse_device_mapping(struct drm_i915_private *dev_priv,
 {
        const struct bdb_general_definitions *defs;
        const struct child_device_config *child;
-       struct child_device_config *child_dev_ptr;
        int i, child_device_num, count;
        u8 expected_size;
        u16 block_size;
@@ -1306,10 +1311,8 @@ parse_device_mapping(struct drm_i915_private *dev_priv,
        /* get the number of child device that is present */
        for (i = 0; i < child_device_num; i++) {
                child = child_device_ptr(defs, i);
-               if (!child->device_type) {
-                       /* skip the device block if device type is invalid */
+               if (!child->device_type)
                        continue;
-               }
                count++;
        }
        if (!count) {
@@ -1326,36 +1329,18 @@ parse_device_mapping(struct drm_i915_private *dev_priv,
        count = 0;
        for (i = 0; i < child_device_num; i++) {
                child = child_device_ptr(defs, i);
-               if (!child->device_type) {
-                       /* skip the device block if device type is invalid */
+               if (!child->device_type)
                        continue;
-               }
-
-               child_dev_ptr = dev_priv->vbt.child_dev + count;
-               count++;
 
                /*
                 * Copy as much as we know (sizeof) and is available
                 * (child_dev_size) of the child device. Accessing the data must
                 * depend on VBT version.
                 */
-               memcpy(child_dev_ptr, child,
+               memcpy(dev_priv->vbt.child_dev + count, child,
                       min_t(size_t, defs->child_dev_size, sizeof(*child)));
-
-               /*
-                * copied full block, now init values when they are not
-                * available in current version
-                */
-               if (bdb->version < 196) {
-                       /* Set default values for bits added from v196 */
-                       child_dev_ptr->iboost = 0;
-                       child_dev_ptr->hpd_invert = 0;
-               }
-
-               if (bdb->version < 192)
-                       child_dev_ptr->lspcon = 0;
+               count++;
        }
-       return;
 }
 
 /* Common defaults which may be overridden by VBT. */