Lines Matching refs:dev

38 int DRM(open_helper)(struct inode *inode, struct file *filp, drm_device_t *dev)  in DRM()
56 priv->dev = dev; in DRM()
60 down(&dev->struct_sem); in DRM()
61 if (!dev->file_last) { in DRM()
64 dev->file_first = priv; in DRM()
65 dev->file_last = priv; in DRM()
68 priv->prev = dev->file_last; in DRM()
69 dev->file_last->next = priv; in DRM()
70 dev->file_last = priv; in DRM()
72 up(&dev->struct_sem); in DRM()
78 if (!dev->hose) { in DRM()
81 if (pci_dev) dev->hose = pci_dev->sysdata; in DRM()
82 if (!dev->hose) { in DRM()
84 if (b) dev->hose = b->sysdata; in DRM()
95 drm_device_t *dev = priv->dev; in DRM() local
98 current->pid, (long)dev->device, dev->open_count); in DRM()
105 drm_device_t *dev = priv->dev; in DRM() local
108 DRM_DEBUG("fd = %d, device = 0x%lx\n", fd, (long)dev->device); in DRM()
109 retcode = fasync_helper(fd, filp, on, &dev->buf_async); in DRM()
122 drm_device_t *dev = priv->dev; in DRM() local
129 DRM_DEBUG("%p, %p\n", dev->buf_rp, dev->buf_wp); in DRM()
131 add_wait_queue(&dev->buf_readers, &wait); in DRM()
133 while (dev->buf_rp == dev->buf_wp) { in DRM()
136 remove_wait_queue(&dev->buf_readers, &wait); in DRM()
143 remove_wait_queue(&dev->buf_readers, &wait); in DRM()
150 remove_wait_queue(&dev->buf_readers, &wait); in DRM()
153 left = (dev->buf_rp + DRM_BSZ - dev->buf_wp) % DRM_BSZ; in DRM()
158 if (dev->buf_wp > dev->buf_rp) { in DRM()
159 cur = DRM_MIN(send, dev->buf_wp - dev->buf_rp); in DRM()
161 cur = DRM_MIN(send, dev->buf_end - dev->buf_rp); in DRM()
163 if (copy_to_user(buf, dev->buf_rp, cur)) in DRM()
165 dev->buf_rp += cur; in DRM()
166 if (dev->buf_rp == dev->buf_end) dev->buf_rp = dev->buf; in DRM()
170 wake_up_interruptible(&dev->buf_writers); in DRM()
174 int DRM(write_string)(drm_device_t *dev, const char *s) in DRM()
176 int left = (dev->buf_rp + DRM_BSZ - dev->buf_wp) % DRM_BSZ; in DRM()
181 left, send, dev->buf_rp, dev->buf_wp); in DRM()
183 if (left == 1 || dev->buf_wp != dev->buf_rp) { in DRM()
186 dev->buf_wp, in DRM()
187 dev->buf_rp); in DRM()
191 if (dev->buf_wp >= dev->buf_rp) { in DRM()
192 count = DRM_MIN(send, dev->buf_end - dev->buf_wp); in DRM()
195 count = DRM_MIN(send, dev->buf_rp - dev->buf_wp - 1); in DRM()
197 strncpy(dev->buf_wp, s, count); in DRM()
198 dev->buf_wp += count; in DRM()
199 if (dev->buf_wp == dev->buf_end) dev->buf_wp = dev->buf; in DRM()
203 if (dev->buf_async) kill_fasync(&dev->buf_async, SIGIO, POLL_IN); in DRM()
206 wake_up_interruptible(&dev->buf_readers); in DRM()
213 drm_device_t *dev = priv->dev; in DRM() local
215 poll_wait(filp, &dev->buf_readers, wait); in DRM()
216 if (dev->buf_wp != dev->buf_rp) return POLLIN | POLLRDNORM; in DRM()