From fc4fb6b51b50e37ff697e872b297b6460c3617af Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Tue, 22 Apr 2003 08:06:14 +0000 Subject: remove DRM read, poll and write_string --- linux/drmP.h | 6 ---- linux/drm_context.h | 6 ---- linux/drm_drv.h | 2 -- linux/drm_fops.h | 94 ----------------------------------------------------- linux/i810_dma.c | 2 -- linux/i830_dma.c | 2 -- 6 files changed, 112 deletions(-) (limited to 'linux') diff --git a/linux/drmP.h b/linux/drmP.h index 7c7428ba..8b701467 100644 --- a/linux/drmP.h +++ b/linux/drmP.h @@ -697,13 +697,7 @@ extern int DRM(unlock)(struct inode *inode, struct file *filp, extern int DRM(open_helper)(struct inode *inode, struct file *filp, drm_device_t *dev); extern int DRM(flush)(struct file *filp); -extern int DRM(release_fuck)(struct inode *inode, struct file *filp); extern int DRM(fasync)(int fd, struct file *filp, int on); -extern ssize_t DRM(read)(struct file *filp, char *buf, size_t count, - loff_t *off); -extern int DRM(write_string)(drm_device_t *dev, const char *s); -extern unsigned int DRM(poll)(struct file *filp, - struct poll_table_struct *wait); /* Mapping support (drm_vm.h) */ extern struct page *DRM(vm_nopage)(struct vm_area_struct *vma, diff --git a/linux/drm_context.h b/linux/drm_context.h index 88b485ff..fab0885b 100644 --- a/linux/drm_context.h +++ b/linux/drm_context.h @@ -242,9 +242,6 @@ int DRM(context_switch)( drm_device_t *dev, int old, int new ) if ( DRM(flags) & DRM_FLAG_NOCTX ) { DRM(context_switch_complete)( dev, new ); - } else { - sprintf( buf, "C %d %d\n", old, new ); - DRM(write_string)( dev, buf ); } return 0; @@ -455,9 +452,6 @@ int DRM(context_switch)(drm_device_t *dev, int old, int new) if (DRM(flags) & DRM_FLAG_NOCTX) { DRM(context_switch_complete)(dev, new); - } else { - sprintf(buf, "C %d %d\n", old, new); - DRM(write_string)(dev, buf); } atomic_dec(&q->use_count); diff --git a/linux/drm_drv.h b/linux/drm_drv.h index b2070d32..848a2f11 100644 --- a/linux/drm_drv.h +++ b/linux/drm_drv.h @@ -121,9 +121,7 @@ static struct file_operations DRM(fops) = { \ .release = DRM(release), \ .ioctl = DRM(ioctl), \ .mmap = DRM(mmap), \ - .read = DRM(read), \ .fasync = DRM(fasync), \ - .poll = DRM(poll), \ } #endif diff --git a/linux/drm_fops.h b/linux/drm_fops.h index 833409f0..3baac693 100644 --- a/linux/drm_fops.h +++ b/linux/drm_fops.h @@ -114,97 +114,3 @@ int DRM(fasync)(int fd, struct file *filp, int on) } -/* The drm_read and drm_write_string code (especially that which manages - the circular buffer), is based on Alessandro Rubini's LINUX DEVICE - DRIVERS (Cambridge: O'Reilly, 1998), pages 111-113. */ - -ssize_t DRM(read)(struct file *filp, char *buf, size_t count, loff_t *off) -{ - drm_file_t *priv = filp->private_data; - drm_device_t *dev = priv->dev; - int left; - int avail; - int send; - int cur; - - DRM_DEBUG("%p, %p\n", dev->buf_rp, dev->buf_wp); - - while (dev->buf_rp == dev->buf_wp) { - DRM_DEBUG(" sleeping\n"); - if (filp->f_flags & O_NONBLOCK) { - return -EAGAIN; - } - interruptible_sleep_on(&dev->buf_readers); - if (signal_pending(current)) { - DRM_DEBUG(" interrupted\n"); - return -ERESTARTSYS; - } - DRM_DEBUG(" awake\n"); - } - - left = (dev->buf_rp + DRM_BSZ - dev->buf_wp) % DRM_BSZ; - avail = DRM_BSZ - left; - send = DRM_MIN(avail, count); - - while (send) { - if (dev->buf_wp > dev->buf_rp) { - cur = DRM_MIN(send, dev->buf_wp - dev->buf_rp); - } else { - cur = DRM_MIN(send, dev->buf_end - dev->buf_rp); - } - if (copy_to_user(buf, dev->buf_rp, cur)) - return -EFAULT; - dev->buf_rp += cur; - if (dev->buf_rp == dev->buf_end) dev->buf_rp = dev->buf; - send -= cur; - } - - wake_up_interruptible(&dev->buf_writers); - return DRM_MIN(avail, count);; -} - -int DRM(write_string)(drm_device_t *dev, const char *s) -{ - int left = (dev->buf_rp + DRM_BSZ - dev->buf_wp) % DRM_BSZ; - int send = strlen(s); - int count; - - DRM_DEBUG("%d left, %d to send (%p, %p)\n", - left, send, dev->buf_rp, dev->buf_wp); - - if (left == 1 || dev->buf_wp != dev->buf_rp) { - DRM_ERROR("Buffer not empty (%d left, wp = %p, rp = %p)\n", - left, - dev->buf_wp, - dev->buf_rp); - } - - while (send) { - if (dev->buf_wp >= dev->buf_rp) { - count = DRM_MIN(send, dev->buf_end - dev->buf_wp); - if (count == left) --count; /* Leave a hole */ - } else { - count = DRM_MIN(send, dev->buf_rp - dev->buf_wp - 1); - } - strncpy(dev->buf_wp, s, count); - dev->buf_wp += count; - if (dev->buf_wp == dev->buf_end) dev->buf_wp = dev->buf; - send -= count; - } - - if (dev->buf_async) kill_fasync(&dev->buf_async, SIGIO, POLL_IN); - - DRM_DEBUG("waking\n"); - wake_up_interruptible(&dev->buf_readers); - return 0; -} - -unsigned int DRM(poll)(struct file *filp, struct poll_table_struct *wait) -{ - drm_file_t *priv = filp->private_data; - drm_device_t *dev = priv->dev; - - poll_wait(filp, &dev->buf_readers, wait); - if (dev->buf_wp != dev->buf_rp) return POLLIN | POLLRDNORM; - return 0; -} diff --git a/linux/i810_dma.c b/linux/i810_dma.c index c06fd915..a3727164 100644 --- a/linux/i810_dma.c +++ b/linux/i810_dma.c @@ -122,9 +122,7 @@ static struct file_operations i810_buffer_fops = { .release = DRM(release), .ioctl = DRM(ioctl), .mmap = i810_mmap_buffers, - .read = DRM(read), .fasync = DRM(fasync), - .poll = DRM(poll), }; int i810_mmap_buffers(struct file *filp, struct vm_area_struct *vma) diff --git a/linux/i830_dma.c b/linux/i830_dma.c index b76d2b11..df58e990 100644 --- a/linux/i830_dma.c +++ b/linux/i830_dma.c @@ -130,9 +130,7 @@ static struct file_operations i830_buffer_fops = { .release = DRM(release), .ioctl = DRM(ioctl), .mmap = i830_mmap_buffers, - .read = DRM(read), .fasync = DRM(fasync), - .poll = DRM(poll), }; int i830_mmap_buffers(struct file *filp, struct vm_area_struct *vma) -- cgit v1.2.3