Commit ae6daede authored by Jani Nikula's avatar Jani Nikula

drm/i915/display: change probe for no display case

Return NULL for errors, and handle the no display case in one
location. This will make subsequent changes easier.
Reviewed-by: default avatarRodrigo Vivi <rodrigo.vivi@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/8dfac3532a72ca6494c9955987166d9c6e0919bd.1716399081.git.jani.nikula@intel.comSigned-off-by: default avatarJani Nikula <jani.nikula@intel.com>
parent 54698865
...@@ -881,7 +881,7 @@ probe_gmdid_display(struct drm_i915_private *i915, u16 *ver, u16 *rel, u16 *step ...@@ -881,7 +881,7 @@ probe_gmdid_display(struct drm_i915_private *i915, u16 *ver, u16 *rel, u16 *step
addr = pci_iomap_range(pdev, 0, i915_mmio_reg_offset(GMD_ID_DISPLAY), sizeof(u32)); addr = pci_iomap_range(pdev, 0, i915_mmio_reg_offset(GMD_ID_DISPLAY), sizeof(u32));
if (!addr) { if (!addr) {
drm_err(&i915->drm, "Cannot map MMIO BAR to read display GMD_ID\n"); drm_err(&i915->drm, "Cannot map MMIO BAR to read display GMD_ID\n");
return &no_display; return NULL;
} }
val = ioread32(addr); val = ioread32(addr);
...@@ -889,7 +889,7 @@ probe_gmdid_display(struct drm_i915_private *i915, u16 *ver, u16 *rel, u16 *step ...@@ -889,7 +889,7 @@ probe_gmdid_display(struct drm_i915_private *i915, u16 *ver, u16 *rel, u16 *step
if (val == 0) { if (val == 0) {
drm_dbg_kms(&i915->drm, "Device doesn't have display\n"); drm_dbg_kms(&i915->drm, "Device doesn't have display\n");
return &no_display; return NULL;
} }
*ver = REG_FIELD_GET(GMD_ID_ARCH_MASK, val); *ver = REG_FIELD_GET(GMD_ID_ARCH_MASK, val);
...@@ -903,7 +903,7 @@ probe_gmdid_display(struct drm_i915_private *i915, u16 *ver, u16 *rel, u16 *step ...@@ -903,7 +903,7 @@ probe_gmdid_display(struct drm_i915_private *i915, u16 *ver, u16 *rel, u16 *step
drm_err(&i915->drm, "Unrecognized display IP version %d.%02d; disabling display.\n", drm_err(&i915->drm, "Unrecognized display IP version %d.%02d; disabling display.\n",
*ver, *rel); *ver, *rel);
return &no_display; return NULL;
} }
static const struct intel_display_device_info * static const struct intel_display_device_info *
...@@ -914,7 +914,7 @@ probe_display(struct drm_i915_private *i915) ...@@ -914,7 +914,7 @@ probe_display(struct drm_i915_private *i915)
if (has_no_display(pdev)) { if (has_no_display(pdev)) {
drm_dbg_kms(&i915->drm, "Device doesn't have display\n"); drm_dbg_kms(&i915->drm, "Device doesn't have display\n");
return &no_display; return NULL;
} }
for (i = 0; i < ARRAY_SIZE(intel_display_ids); i++) { for (i = 0; i < ARRAY_SIZE(intel_display_ids); i++) {
...@@ -925,7 +925,7 @@ probe_display(struct drm_i915_private *i915) ...@@ -925,7 +925,7 @@ probe_display(struct drm_i915_private *i915)
drm_dbg(&i915->drm, "No display ID found for device ID %04x; disabling display.\n", drm_dbg(&i915->drm, "No display ID found for device ID %04x; disabling display.\n",
pdev->device); pdev->device);
return &no_display; return NULL;
} }
void intel_display_device_probe(struct drm_i915_private *i915) void intel_display_device_probe(struct drm_i915_private *i915)
...@@ -943,6 +943,9 @@ void intel_display_device_probe(struct drm_i915_private *i915) ...@@ -943,6 +943,9 @@ void intel_display_device_probe(struct drm_i915_private *i915)
else else
info = probe_display(i915); info = probe_display(i915);
if (!info)
goto no_display;
DISPLAY_INFO(i915) = info; DISPLAY_INFO(i915) = info;
memcpy(DISPLAY_RUNTIME_INFO(i915), memcpy(DISPLAY_RUNTIME_INFO(i915),
...@@ -954,6 +957,11 @@ void intel_display_device_probe(struct drm_i915_private *i915) ...@@ -954,6 +957,11 @@ void intel_display_device_probe(struct drm_i915_private *i915)
DISPLAY_RUNTIME_INFO(i915)->ip.rel = rel; DISPLAY_RUNTIME_INFO(i915)->ip.rel = rel;
DISPLAY_RUNTIME_INFO(i915)->ip.step = step; DISPLAY_RUNTIME_INFO(i915)->ip.step = step;
} }
return;
no_display:
DISPLAY_INFO(i915) = &no_display;
} }
void intel_display_device_remove(struct drm_i915_private *i915) void intel_display_device_remove(struct drm_i915_private *i915)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment