Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/external/bsd/drm2/dist Massage drm_drv.c into usability.



details:   https://anonhg.NetBSD.org/src/rev/a277557e4d40
branches:  trunk
changeset: 365828:a277557e4d40
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Mon Aug 27 06:54:08 2018 +0000

description:
Massage drm_drv.c into usability.

- expose drm_minor_lock/drm_minors_idr for drm_init in drm_module.c
- ifdef out Linux driver attachment goo

diffstat:

 sys/external/bsd/drm2/dist/drm/drm_drv.c      |  21 +++++++++++++++++----
 sys/external/bsd/drm2/dist/include/drm/drmP.h |   4 +++-
 2 files changed, 20 insertions(+), 5 deletions(-)

diffs (100 lines):

diff -r aa5a677f5a1b -r a277557e4d40 sys/external/bsd/drm2/dist/drm/drm_drv.c
--- a/sys/external/bsd/drm2/dist/drm/drm_drv.c  Mon Aug 27 06:53:55 2018 +0000
+++ b/sys/external/bsd/drm2/dist/drm/drm_drv.c  Mon Aug 27 06:54:08 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: drm_drv.c,v 1.4 2018/08/27 06:53:46 riastradh Exp $    */
+/*     $NetBSD: drm_drv.c,v 1.5 2018/08/27 06:54:08 riastradh Exp $    */
 
 /*
  * Created: Fri Jan 19 10:48:35 2001 by faith%acm.org@localhost
@@ -29,7 +29,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: drm_drv.c,v 1.4 2018/08/27 06:53:46 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: drm_drv.c,v 1.5 2018/08/27 06:54:08 riastradh Exp $");
 
 #include <linux/err.h>
 #include <linux/export.h>
@@ -59,11 +59,12 @@
 module_param_named(debug, drm_debug, int, 0600);
 
 #ifdef __NetBSD__
-static spinlock_t drm_minor_lock;
+spinlock_t drm_minor_lock;
+struct idr drm_minors_idr;
 #else
 static DEFINE_SPINLOCK(drm_minor_lock);
+static struct idr drm_minors_idr;
 #endif
-static struct idr drm_minors_idr;
 
 #ifndef __NetBSD__
 static struct dentry *drm_debugfs_root;
@@ -329,7 +330,9 @@
        if (!minor)
                return;
 
+#ifndef __NetBSD__
        put_device(minor->kdev);
+#endif
 
        spin_lock_irqsave(&drm_minor_lock, flags);
        idr_remove(&drm_minors_idr, minor->index);
@@ -386,7 +389,11 @@
        unsigned long flags;
 
        minor = *drm_minor_get_slot(dev, type);
+#ifdef __NetBSD__
+       if (!minor)
+#else
        if (!minor || !device_is_registered(minor->kdev))
+#endif
                return;
 
        /* replace @minor with NULL so lookups will fail from now on */
@@ -394,9 +401,11 @@
        idr_replace(&drm_minors_idr, NULL, minor->index);
        spin_unlock_irqrestore(&drm_minor_lock, flags);
 
+#ifndef __NetBSD__
        device_del(minor->kdev);
        dev_set_drvdata(minor->kdev, NULL); /* safety belt */
        drm_debugfs_cleanup(minor);
+#endif
 }
 
 /**
@@ -913,6 +922,8 @@
 }
 EXPORT_SYMBOL(drm_dev_set_unique);
 
+#ifndef __NetBSD__
+
 /*
  * DRM Core
  * The DRM core module initializes all global DRM objects and makes them
@@ -1023,3 +1034,5 @@
 
 module_init(drm_core_init);
 module_exit(drm_core_exit);
+
+#endif
diff -r aa5a677f5a1b -r a277557e4d40 sys/external/bsd/drm2/dist/include/drm/drmP.h
--- a/sys/external/bsd/drm2/dist/include/drm/drmP.h     Mon Aug 27 06:53:55 2018 +0000
+++ b/sys/external/bsd/drm2/dist/include/drm/drmP.h     Mon Aug 27 06:54:08 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: drmP.h,v 1.20 2018/08/27 06:50:58 riastradh Exp $      */
+/*     $NetBSD: drmP.h,v 1.21 2018/08/27 06:54:08 riastradh Exp $      */
 
 /*
  * Internal Header for the Direct Rendering Manager
@@ -986,6 +986,8 @@
 extern int drm_ioctl_permit(u32 flags, struct drm_file *file_priv);
 #ifdef __NetBSD__
 extern int drm_ioctl(struct file *, unsigned long, void *);
+extern struct spinlock drm_minor_lock;
+extern struct idr drm_minors_idr;
 #else
 extern long drm_ioctl(struct file *filp,
                      unsigned int cmd, unsigned long arg);



Home | Main Index | Thread Index | Old Index