[Intel-gfx] [PATCH 10/13] drm/i915: split i915_driver_modeset_probe() to pre/post irq install
Jani Nikula
jani.nikula at intel.com
Thu Sep 19 14:03:57 UTC 2019
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.
Signed-off-by: Jani Nikula <jani.nikula at intel.com>
---
drivers/gpu/drm/i915/i915_drv.c | 41 +++++++++++++++++++++++----------
1 file changed, 29 insertions(+), 12 deletions(-)
diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
index 7a7a1b7d5da2..30b0548a5648 100644
--- a/drivers/gpu/drm/i915/i915_drv.c
+++ b/drivers/gpu/drm/i915/i915_drv.c
@@ -328,6 +328,7 @@ static const struct vga_switcheroo_client_ops i915_switcheroo_ops = {
.can_switch = i915_switcheroo_can_switch,
};
+/* part #1: call before irq install */
static int i915_driver_modeset_probe(struct drm_i915_private *i915)
{
struct pci_dev *pdev = i915->drm.pdev;
@@ -369,15 +370,27 @@ static int i915_driver_modeset_probe(struct drm_i915_private *i915)
intel_csr_ucode_init(i915);
- ret = intel_irq_install(i915);
- if (ret)
- goto cleanup_csr;
+ return 0;
+
+cleanup_vga_client:
+ vga_client_register(pdev, NULL, NULL, NULL);
+out:
+ return ret;
+}
+
+/* part #2: call after irq install */
+static int i915_driver_modeset_probe_irq(struct drm_i915_private *i915)
+{
+ int ret;
+
+ if (i915_inject_probe_failure(i915))
+ return -ENODEV;
/* Important: The output setup functions called by modeset_init need
* working irqs for e.g. gmbus and dp aux transfers. */
ret = intel_modeset_init(i915);
if (ret)
- goto cleanup_irq;
+ goto out;
ret = i915_gem_init(i915);
if (ret)
@@ -406,14 +419,6 @@ static int i915_driver_modeset_probe(struct drm_i915_private *i915)
cleanup_modeset:
intel_modeset_driver_remove_irq(i915);
intel_modeset_driver_remove(i915);
-cleanup_irq:
- intel_irq_uninstall(i915);
-cleanup_csr:
- intel_csr_ucode_fini(i915);
- intel_power_domains_driver_remove(i915);
- vga_switcheroo_unregister_client(pdev);
-cleanup_vga_client:
- vga_client_register(pdev, NULL, NULL, NULL);
out:
return ret;
}
@@ -1577,6 +1582,14 @@ int i915_driver_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
if (ret < 0)
goto out_cleanup_hw;
+ ret = intel_irq_install(dev_priv);
+ if (ret)
+ goto out_cleanup_modeset;
+
+ ret = i915_driver_modeset_probe_irq(dev_priv);
+ if (ret < 0)
+ goto out_cleanup_irq;
+
i915_driver_register(dev_priv);
enable_rpm_wakeref_asserts(&dev_priv->runtime_pm);
@@ -1585,6 +1598,10 @@ int i915_driver_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
return 0;
+out_cleanup_irq:
+ intel_irq_uninstall(dev_priv);
+out_cleanup_modeset:
+ /* FIXME */
out_cleanup_hw:
i915_driver_hw_remove(dev_priv);
i915_ggtt_driver_release(dev_priv);
--
2.20.1
More information about the Intel-gfx
mailing list