remove DRM read, poll and write_string

main
Keith Whitwell 2003-04-22 08:06:14 +00:00
parent 46e06192a8
commit fc4fb6b51b
12 changed files with 0 additions and 224 deletions

View File

@ -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,

View File

@ -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);

View File

@ -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

View File

@ -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;
}

View File

@ -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)

View File

@ -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)

View File

@ -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,

View File

@ -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);

View File

@ -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

View File

@ -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;
}

View File

@ -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)

View File

@ -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)