From e1dd2b2d75e06369028b12cc55b65962eaeda221 Mon Sep 17 00:00:00 2001 From: Owain Ainsworth Date: Sun, 7 Sep 2008 00:44:07 +0000 Subject: Kill some unneeded defines and struct members. --- sys/dev/pci/drm/drmP.h | 20 +++----------------- sys/dev/pci/drm/drm_drv.c | 10 +++++----- sys/dev/pci/drm/drm_fops.c | 10 ++++------ sys/dev/pci/drm/drm_lock.c | 2 +- 4 files changed, 13 insertions(+), 29 deletions(-) (limited to 'sys') diff --git a/sys/dev/pci/drm/drmP.h b/sys/dev/pci/drm/drmP.h index 5115722a487..7ab0d21ce41 100644 --- a/sys/dev/pci/drm/drmP.h +++ b/sys/dev/pci/drm/drmP.h @@ -111,20 +111,13 @@ #define __OS_HAS_AGP 1 -#define DRM_DEV_MODE (S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP) -#define DRM_DEV_UID 0 -#define DRM_DEV_GID 0 - #define wait_queue_head_t atomic_t #define DRM_WAKEUP(w) wakeup((void *)w) #define DRM_WAKEUP_INT(w) wakeup(w) #define DRM_INIT_WAITQUEUE(queue) do {(void)(queue);} while (0) -#define DRM_CDEV dev_t #define DRM_CURPROC curproc -#define DRM_STRUCTPROC struct proc -#define DRM_STRUCTCDEVPROC struct proc -#define DRM_PROC(p) (p) +#define DRM_CURRENTPID curproc->p_pid #define DRM_NOOP do {} while(0) #define DRM_SPINTYPE struct mutex #define DRM_SPININIT(l,name) mtx_init(l,IPL_NONE) @@ -139,10 +132,6 @@ #define DRM_SPINLOCK_ASSERT(l) DRM_NOOP #define DRM_LOCK() DRM_SPINLOCK(&dev->dev_lock) #define DRM_UNLOCK() DRM_SPINUNLOCK(&dev->dev_lock) -#define DRM_SLEEPLOCK(v,l,f,s,i) msleep(v,l,f,s,i); -#define DRM_PID(p) (p)->p_pid -#define DRM_CURRENTPID DRM_PID(curproc) -#define DRM_UID(p) (p)->p_pid #define DRM_MAXUNITS 8 extern struct drm_device *drm_units[]; @@ -244,7 +233,6 @@ typedef u_int8_t u8; #define DRM_HZ hz #define DRM_UDELAY(udelay) DELAY(udelay) -#define DRM_TIME_SLICE (hz/20) /* Time slice for GLXContexts */ #define LOCK_TEST_WITH_RETURN(dev, file_priv) \ do { \ @@ -356,8 +344,6 @@ struct drm_file { int flags; int master; int minor; - pid_t pid; - uid_t uid; }; struct drm_lock_data { @@ -638,8 +624,8 @@ dev_type_mmap(drmmmap); extern drm_local_map_t *drm_getsarea(struct drm_device *); /* File operations helpers (drm_fops.c) */ -int drm_open_helper(DRM_CDEV, int, int, - DRM_STRUCTPROC *, struct drm_device *); +int drm_open_helper(dev_t, int, int, struct proc *, + struct drm_device *); struct drm_file *drm_find_file_by_minor(struct drm_device *, int); /* Memory management support (drm_memory.c) */ diff --git a/sys/dev/pci/drm/drm_drv.c b/sys/dev/pci/drm/drm_drv.c index 91dfd2eea09..fd8ad5519cc 100644 --- a/sys/dev/pci/drm/drm_drv.c +++ b/sys/dev/pci/drm/drm_drv.c @@ -470,7 +470,7 @@ drm_version(struct drm_device *dev, void *data, struct drm_file *file_priv) } int -drmopen(DRM_CDEV kdev, int flags, int fmt, DRM_STRUCTPROC *p) +drmopen(dev_t kdev, int flags, int fmt, struct proc *p) { struct drm_device *dev = NULL; int retcode = 0; @@ -494,7 +494,7 @@ drmopen(DRM_CDEV kdev, int flags, int fmt, DRM_STRUCTPROC *p) } int -drmclose(DRM_CDEV kdev, int flags, int fmt, DRM_STRUCTPROC *p) +drmclose(dev_t kdev, int flags, int fmt, struct proc *p) { struct drm_device *dev = drm_get_device_from_kdev(kdev); struct drm_file *file_priv; @@ -547,7 +547,7 @@ drmclose(DRM_CDEV kdev, int flags, int fmt, DRM_STRUCTPROC *p) break; /* Got lock */ } /* Contention */ - retcode = DRM_SLEEPLOCK((void *)&dev->lock.lock_queue, + retcode = msleep((void *)&dev->lock.lock_queue, &dev->dev_lock, PZERO | PCATCH, "drmlk2", 0); if (retcode) break; @@ -585,8 +585,8 @@ done: /* drmioctl is called whenever a process performs an ioctl on /dev/drm. */ int -drmioctl(DRM_CDEV kdev, u_long cmd, caddr_t data, int flags, - DRM_STRUCTPROC *p) +drmioctl(dev_t kdev, u_long cmd, caddr_t data, int flags, + struct proc *p) { struct drm_device *dev = drm_get_device_from_kdev(kdev); int retcode = 0; diff --git a/sys/dev/pci/drm/drm_fops.c b/sys/dev/pci/drm/drm_fops.c index 558eb6cffb3..2f0b007def5 100644 --- a/sys/dev/pci/drm/drm_fops.c +++ b/sys/dev/pci/drm/drm_fops.c @@ -51,7 +51,7 @@ drm_find_file_by_minor(struct drm_device *dev, int minor) /* drm_open_helper is called whenever a process opens /dev/drm. */ int -drm_open_helper(DRM_CDEV kdev, int flags, int fmt, DRM_STRUCTPROC *p, +drm_open_helper(dev_t kdev, int flags, int fmt, struct proc *p, struct drm_device *dev) { struct drm_file *priv; @@ -61,14 +61,12 @@ drm_open_helper(DRM_CDEV kdev, int flags, int fmt, DRM_STRUCTPROC *p, if (flags & O_EXCL) return (EBUSY); /* No exclusive opens */ - DRM_DEBUG("pid = %d, minor = %d\n", DRM_CURRENTPID, m); + DRM_DEBUG("minor = %d\n", DRM_CURRENTPID, m); priv = drm_calloc(1, sizeof(*priv), DRM_MEM_FILES); if (priv == NULL) return (ENOMEM); - priv->uid = DRM_UID(p); - priv->pid = DRM_PID(p); priv->kdev = kdev; priv->flags = flags; priv->minor = m; @@ -106,13 +104,13 @@ drm_open_helper(DRM_CDEV kdev, int flags, int fmt, DRM_STRUCTPROC *p, * on older X Servers (4.3.0 and earlier) */ int -drmread(DRM_CDEV kdev, struct uio *uio, int ioflag) +drmread(dev_t kdev, struct uio *uio, int ioflag) { return 0; } int -drmpoll(DRM_CDEV kdev, int events, DRM_STRUCTPROC *p) +drmpoll(dev_t kdev, int events, struct proc *p) { return 0; } diff --git a/sys/dev/pci/drm/drm_lock.c b/sys/dev/pci/drm/drm_lock.c index 2c85d8bdc6b..e38316dc1ab 100644 --- a/sys/dev/pci/drm/drm_lock.c +++ b/sys/dev/pci/drm/drm_lock.c @@ -145,7 +145,7 @@ drm_lock(struct drm_device *dev, void *data, struct drm_file *file_priv) } /* Contention */ - ret = DRM_SLEEPLOCK((void *)&dev->lock.lock_queue, + ret = msleep((void *)&dev->lock.lock_queue, &dev->dev_lock, PZERO | PCATCH, "drmlkq", 0); if (ret != 0) break; -- cgit v1.2.3