drm/nouveau: give a slightly larger pci(e)gart aperture on all chipsets
[firefly-linux-kernel-4.4.55.git] / drivers / gpu / drm / drm_stub.c
index 6d7b083c5b776d482d3b0a21f60a43adebd8f66d..21bcd4a555d858088136924f022b4afaf5916b0c 100644 (file)
@@ -122,11 +122,10 @@ again:
        ret = idr_get_new_above(&drm_minors_idr, NULL,
                                base, &new_id);
        mutex_unlock(&dev->struct_mutex);
-       if (ret == -EAGAIN) {
+       if (ret == -EAGAIN)
                goto again;
-       } else if (ret) {
+       else if (ret)
                return ret;
-       }
 
        if (new_id >= limit) {
                idr_remove(&drm_minors_idr, new_id);
@@ -211,7 +210,7 @@ EXPORT_SYMBOL(drm_master_put);
 int drm_setmaster_ioctl(struct drm_device *dev, void *data,
                        struct drm_file *file_priv)
 {
-       int ret = 0;
+       int ret;
 
        if (file_priv->is_master)
                return 0;
@@ -319,6 +318,7 @@ int drm_fill_in_dev(struct drm_device *dev,
        drm_lastclose(dev);
        return retcode;
 }
+EXPORT_SYMBOL(drm_fill_in_dev);
 
 
 /**
@@ -397,6 +397,7 @@ err_idr:
        *minor = NULL;
        return ret;
 }
+EXPORT_SYMBOL(drm_get_minor);
 
 /**
  * Put a secondary minor number.
@@ -428,6 +429,12 @@ int drm_put_minor(struct drm_minor **minor_p)
        *minor_p = NULL;
        return 0;
 }
+EXPORT_SYMBOL(drm_put_minor);
+
+static void drm_unplug_minor(struct drm_minor *minor)
+{
+       drm_sysfs_device_remove(minor);
+}
 
 /**
  * Called via drm_exit() at module unload time or when pci device is
@@ -492,3 +499,21 @@ void drm_put_dev(struct drm_device *dev)
        kfree(dev);
 }
 EXPORT_SYMBOL(drm_put_dev);
+
+void drm_unplug_dev(struct drm_device *dev)
+{
+       /* for a USB device */
+       if (drm_core_check_feature(dev, DRIVER_MODESET))
+               drm_unplug_minor(dev->control);
+       drm_unplug_minor(dev->primary);
+
+       mutex_lock(&drm_global_mutex);
+
+       drm_device_set_unplugged(dev);
+
+       if (dev->open_count == 0) {
+               drm_put_dev(dev);
+       }
+       mutex_unlock(&drm_global_mutex);
+}
+EXPORT_SYMBOL(drm_unplug_dev);