drm/radeon: Prevent a crash on load with newer drm code
authorFrançois Tigeot <ftigeot@wolfpond.org>
Fri, 8 Dec 2017 21:57:34 +0000 (22:57 +0100)
committerFrançois Tigeot <ftigeot@wolfpond.org>
Fri, 8 Dec 2017 22:01:18 +0000 (23:01 +0100)
* The existing drm/radeon code base contained an invalid unlock/lock
  sequence in radeon_irq_kms_init() which caused the kernel to crash
  during driver initialization with the drm code base from Linux 4.8

* Fixed by replacing the problematic function with its version from
  Linux 4.8

sys/dev/drm/radeon/radeon_irq_kms.c

index bb15445..8603819 100644 (file)
@@ -262,16 +262,28 @@ int radeon_irq_kms_init(struct radeon_device *rdev)
        if (r) {
                return r;
        }
+
        /* enable msi */
        rdev->msi_enabled = (rdev->ddev->irq_type == PCI_INTR_TYPE_MSI);
 
+#ifndef __DragonFly__
+       if (radeon_msi_ok(rdev)) {
+               int ret = pci_enable_msi(rdev->pdev);
+               if (!ret) {
+                       rdev->msi_enabled = 1;
+                       dev_info(rdev->dev, "radeon: using MSI.\n");
+               }
+       }
+#endif
+
        TASK_INIT(&rdev->hotplug_work, 0, radeon_hotplug_work_func, rdev);
+#if 0
+       INIT_WORK(&rdev->dp_work, radeon_dp_work_func);
+#endif
        TASK_INIT(&rdev->audio_work, 0, r600_audio_update_hdmi, rdev);
 
        rdev->irq.installed = true;
-       DRM_UNLOCK(rdev->ddev);
        r = drm_irq_install(rdev->ddev, rdev->ddev->irq);
-       DRM_LOCK(rdev->ddev);
        if (r) {
                rdev->irq.installed = false;
                taskqueue_drain(rdev->tq, &rdev->hotplug_work);