Merge tag 'pci-v3.16-fixes-1' of git://git.kernel.org/pub/scm/linux/kernel/git/helgaa...
[firefly-linux-kernel-4.4.55.git] / drivers / gpu / drm / nouveau / nouveau_vga.c
index fb84da3cb50d50a31f905052b4b85c2cbaf54143..4f4c3fec6916fc4ea568276851f41f5adaadfbd1 100644 (file)
@@ -64,12 +64,13 @@ static bool
 nouveau_switcheroo_can_switch(struct pci_dev *pdev)
 {
        struct drm_device *dev = pci_get_drvdata(pdev);
-       bool can_switch;
 
-       spin_lock(&dev->count_lock);
-       can_switch = (dev->open_count == 0);
-       spin_unlock(&dev->count_lock);
-       return can_switch;
+       /*
+        * FIXME: open_count is protected by drm_global_mutex but that would lead to
+        * locking inversion with the driver load path. And the access here is
+        * completely racy anyway. So don't bother with locking for now.
+        */
+       return dev->open_count == 0;
 }
 
 static const struct vga_switcheroo_client_ops