Commit b664259f authored by Jani Nikula's avatar Jani Nikula

drm/i915: split i915_driver_modeset_probe() to pre/post irq install

Pair the irq install and uninstall in the same layer. There are no
functional changes in the happy day scenario. The cleanup paths are
currently a mess though.

Note that modeset probe pre-irq + post-irq install are matched by
modeset driver remove pre-irq + post-irq uninstall, together, but not
independently. They are not symmetric pairs.

v2: don't add a new probe failure point here

Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: default avatarJani Nikula <jani.nikula@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200219133756.13224-1-jani.nikula@intel.com
parent 5d8b1341
...@@ -212,7 +212,8 @@ intel_teardown_mchbar(struct drm_i915_private *dev_priv) ...@@ -212,7 +212,8 @@ intel_teardown_mchbar(struct drm_i915_private *dev_priv)
release_resource(&dev_priv->mch_res); release_resource(&dev_priv->mch_res);
} }
static int i915_driver_modeset_probe(struct drm_i915_private *i915) /* part #1: call before irq install */
static int i915_driver_modeset_probe_noirq(struct drm_i915_private *i915)
{ {
int ret; int ret;
...@@ -236,15 +237,22 @@ static int i915_driver_modeset_probe(struct drm_i915_private *i915) ...@@ -236,15 +237,22 @@ static int i915_driver_modeset_probe(struct drm_i915_private *i915)
intel_csr_ucode_init(i915); intel_csr_ucode_init(i915);
ret = intel_irq_install(i915); return 0;
if (ret)
goto cleanup_csr; out:
return ret;
}
/* part #2: call after irq install */
static int i915_driver_modeset_probe(struct drm_i915_private *i915)
{
int ret;
/* Important: The output setup functions called by modeset_init need /* Important: The output setup functions called by modeset_init need
* working irqs for e.g. gmbus and dp aux transfers. */ * working irqs for e.g. gmbus and dp aux transfers. */
ret = intel_modeset_init(i915); ret = intel_modeset_init(i915);
if (ret) if (ret)
goto cleanup_irq; goto out;
ret = i915_gem_init(i915); ret = i915_gem_init(i915);
if (ret) if (ret)
...@@ -271,16 +279,10 @@ static int i915_driver_modeset_probe(struct drm_i915_private *i915) ...@@ -271,16 +279,10 @@ static int i915_driver_modeset_probe(struct drm_i915_private *i915)
i915_gem_driver_remove(i915); i915_gem_driver_remove(i915);
i915_gem_driver_release(i915); i915_gem_driver_release(i915);
cleanup_modeset: cleanup_modeset:
/* FIXME */
intel_modeset_driver_remove(i915); intel_modeset_driver_remove(i915);
intel_irq_uninstall(i915); intel_irq_uninstall(i915);
intel_modeset_driver_remove_noirq(i915); intel_modeset_driver_remove_noirq(i915);
goto cleanup_csr;
cleanup_irq:
intel_irq_uninstall(i915);
cleanup_csr:
intel_csr_ucode_fini(i915);
intel_power_domains_driver_remove(i915);
intel_vga_unregister(i915);
out: out:
return ret; return ret;
} }
...@@ -1459,10 +1461,18 @@ int i915_driver_probe(struct pci_dev *pdev, const struct pci_device_id *ent) ...@@ -1459,10 +1461,18 @@ int i915_driver_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
if (ret < 0) if (ret < 0)
goto out_cleanup_mmio; goto out_cleanup_mmio;
ret = i915_driver_modeset_probe(i915); ret = i915_driver_modeset_probe_noirq(i915);
if (ret < 0) if (ret < 0)
goto out_cleanup_hw; goto out_cleanup_hw;
ret = intel_irq_install(i915);
if (ret)
goto out_cleanup_modeset;
ret = i915_driver_modeset_probe(i915);
if (ret < 0)
goto out_cleanup_irq;
i915_driver_register(i915); i915_driver_register(i915);
enable_rpm_wakeref_asserts(&i915->runtime_pm); enable_rpm_wakeref_asserts(&i915->runtime_pm);
...@@ -1471,6 +1481,10 @@ int i915_driver_probe(struct pci_dev *pdev, const struct pci_device_id *ent) ...@@ -1471,6 +1481,10 @@ int i915_driver_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
return 0; return 0;
out_cleanup_irq:
intel_irq_uninstall(i915);
out_cleanup_modeset:
/* FIXME */
out_cleanup_hw: out_cleanup_hw:
i915_driver_hw_remove(i915); i915_driver_hw_remove(i915);
intel_memory_regions_driver_release(i915); intel_memory_regions_driver_release(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