summaryrefslogtreecommitdiff
path: root/linux-core/sis_drv.c
diff options
context:
space:
mode:
Diffstat (limited to 'linux-core/sis_drv.c')
-rw-r--r--linux-core/sis_drv.c63
1 files changed, 30 insertions, 33 deletions
diff --git a/linux-core/sis_drv.c b/linux-core/sis_drv.c
index 434a1ccd..d5fe8fc0 100644
--- a/linux-core/sis_drv.c
+++ b/linux-core/sis_drv.c
@@ -9,11 +9,11 @@
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
- *
+ *
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
- *
+ *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
@@ -100,7 +100,7 @@ static drm_ioctl_desc_t sis_ioctls[] = {
[DRM_IOCTL_NR(SIS_IOCTL_AGP_INIT)] = { sis_agp_init, 1, 1 },
[DRM_IOCTL_NR(SIS_IOCTL_AGP_ALLOC)] = { sis_agp_alloc, 1, 1 },
[DRM_IOCTL_NR(SIS_IOCTL_AGP_FREE)] = { sis_agp_free, 1, 1 },
-
+
#if defined(SIS_STEREO)
[DRM_IOCTL_NR(DRM_IOCTL_CONTROL)] = { sis_control, 1, 1 },
[DRM_IOCTL_NR(SIS_IOCTL_FLIP)] = { sis_flip, 1, 1 },
@@ -121,7 +121,7 @@ MODULE_PARM(sis, "s");
static int sis_setup(drm_device_t *dev)
{
int i;
-
+
atomic_set(&dev->ioctl_count, 0);
atomic_set(&dev->vma_count, 0);
dev->buf_use = 0;
@@ -163,7 +163,7 @@ static int sis_setup(drm_device_t *dev)
dev->ctx_start = 0;
dev->lck_start = 0;
-
+
dev->buf_rp = dev->buf;
dev->buf_wp = dev->buf;
dev->buf_end = dev->buf + DRM_BSZ;
@@ -172,15 +172,15 @@ static int sis_setup(drm_device_t *dev)
init_waitqueue_head(&dev->buf_writers);
sis_res_ctx.handle=-1;
-
+
DRM_DEBUG("\n");
-
+
/* The kernel's context could be created here, but is now created
in drm_dma_enqueue. This is more resource-efficient for
hardware that does not do DMA, but may mean that
drm_select_queue fails between the time the interrupt is
initialized and the time the queues are initialized. */
-
+
return 0;
}
@@ -200,12 +200,12 @@ static int sis_takedown(drm_device_t *dev)
down(&dev->struct_sem);
del_timer(&dev->timer);
-
+
if (dev->devname) {
drm_free(dev->devname, strlen(dev->devname)+1, DRM_MEM_DRIVER);
dev->devname = NULL;
}
-
+
if (dev->unique) {
drm_free(dev->unique, strlen(dev->unique)+1, DRM_MEM_DRIVER);
dev->unique = NULL;
@@ -224,7 +224,7 @@ static int sis_takedown(drm_device_t *dev)
if (dev->agp) {
drm_agp_mem_t *entry;
drm_agp_mem_t *nexte;
-
+
/* Remove AGP resources, but leave dev->agp
intact until cleanup is called. */
for (entry = dev->agp->memory; entry; entry = nexte) {
@@ -234,13 +234,13 @@ static int sis_takedown(drm_device_t *dev)
drm_free(entry, sizeof(*entry), DRM_MEM_AGPLISTS);
}
dev->agp->memory = NULL;
-
+
if (dev->agp->acquired && drm_agp.release)
(*drm_agp.release)();
-
+
dev->agp->acquired = 0;
dev->agp->enabled = 0;
- }
+ }
#endif
/* Clear vma list (only built for debugging) */
@@ -251,7 +251,7 @@ static int sis_takedown(drm_device_t *dev)
}
dev->vmalist = NULL;
}
-
+
/* Clear map area and mtrr information */
if (dev->maplist) {
for (i = 0; i < dev->map_count; i++) {
@@ -289,14 +289,14 @@ static int sis_takedown(drm_device_t *dev)
dev->maplist = NULL;
dev->map_count = 0;
}
-
+
if (dev->lock.hw_lock) {
dev->lock.hw_lock = NULL; /* SHM removed */
dev->lock.pid = 0;
wake_up_interruptible(&dev->lock.lock_queue);
}
up(&dev->struct_sem);
-
+
return 0;
}
@@ -313,7 +313,7 @@ int sis_init(void)
memset((void *)dev, 0, sizeof(*dev));
dev->count_lock = SPIN_LOCK_UNLOCKED;
sema_init(&dev->struct_sem, 1);
-
+
#ifdef MODULE
drm_parse_options(sis);
#endif
@@ -356,7 +356,7 @@ int sis_init(void)
SIS_PATCHLEVEL,
SIS_DATE,
sis_misc.minor);
-
+
return 0;
}
@@ -367,7 +367,7 @@ void sis_cleanup(void)
drm_device_t *dev = &sis_device;
DRM_DEBUG("\n");
-
+
drm_proc_cleanup();
if (misc_deregister(&sis_misc)) {
DRM_ERROR("Cannot unload module\n");
@@ -378,7 +378,7 @@ void sis_cleanup(void)
#ifdef CONFIG_MTRR
if(dev->agp && dev->agp->agp_mtrr) {
int retval;
- retval = mtrr_del(dev->agp->agp_mtrr,
+ retval = mtrr_del(dev->agp->agp_mtrr,
dev->agp->agp_info.aper_base,
dev->agp->agp_info.aper_size * 1024*1024);
DRM_DEBUG("mtrr_del = %d\n", retval);
@@ -433,7 +433,7 @@ int sis_open(struct inode *inode, struct file *filp)
{
drm_device_t *dev = &sis_device;
int retcode = 0;
-
+
DRM_DEBUG("open_count = %d\n", dev->open_count);
if (!(retcode = drm_open_helper(inode, filp, dev))) {
@@ -492,7 +492,7 @@ int sis_ioctl(struct inode *inode, struct file *filp, unsigned int cmd,
atomic_inc(&dev->ioctl_count);
atomic_inc(&dev->total_ioctl);
++priv->ioctl_count;
-
+
DRM_DEBUG("pid = %d, cmd = 0x%02x, nr = 0x%02x, dev 0x%x, auth = %d\n",
current->pid, cmd, nr, dev->device, priv->authenticated);
@@ -512,7 +512,7 @@ int sis_ioctl(struct inode *inode, struct file *filp, unsigned int cmd,
retcode = (func)(inode, filp, cmd, arg);
}
}
-
+
atomic_dec(&dev->ioctl_count);
return retcode;
}
@@ -549,7 +549,7 @@ int sis_lock(struct inode *inode, struct file *filp, unsigned int cmd,
if (lock.context < 0 || lock.context >= dev->queue_count)
return -EINVAL;
#endif
-
+
if (!ret) {
#if 0
if (_DRM_LOCKING_CONTEXT(dev->lock.hw_lock->lock)
@@ -561,7 +561,7 @@ int sis_lock(struct inode *inode, struct file *filp, unsigned int cmd,
/* Can't take lock if we just had it and
there is contention. */
DRM_DEBUG("%d (pid %d) delayed j=%d dev=%d jiffies=%d\n",
- lock.context, current->pid, j,
+ lock.context, current->pid, j,
dev->lock.lock_time, jiffies);
current->state = TASK_INTERRUPTIBLE;
current->policy |= SCHED_YIELD;
@@ -584,7 +584,7 @@ int sis_lock(struct inode *inode, struct file *filp, unsigned int cmd,
atomic_inc(&dev->total_locks);
break; /* Got lock */
}
-
+
/* Contention */
atomic_inc(&dev->total_sleeps);
current->state = TASK_INTERRUPTIBLE;
@@ -626,7 +626,6 @@ int sis_lock(struct inode *inode, struct file *filp, unsigned int cmd,
#endif
if (!ret) {
-#if LINUX_VERSION_CODE >= 0x020400 /* KERNEL_VERSION(2,4,0) */
sigemptyset(&dev->sigmask);
sigaddset(&dev->sigmask, SIGSTOP);
sigaddset(&dev->sigmask, SIGTSTP);
@@ -635,7 +634,7 @@ int sis_lock(struct inode *inode, struct file *filp, unsigned int cmd,
dev->sigdata.context = lock.context;
dev->sigdata.lock = dev->lock.hw_lock;
block_all_signals(drm_notifier, &dev->sigdata, &dev->sigmask);
-#endif
+
if (lock.flags & _DRM_LOCK_READY) {
/* Wait for space in DMA/FIFO */
}
@@ -652,7 +651,7 @@ int sis_lock(struct inode *inode, struct file *filp, unsigned int cmd,
#if DRM_DMA_HISTOGRAM
atomic_inc(&dev->histo.lacq[drm_histogram_slot(get_cycles() - start)]);
#endif
-
+
return ret;
}
@@ -665,7 +664,7 @@ int sis_unlock(struct inode *inode, struct file *filp, unsigned int cmd,
drm_lock_t lock;
copy_from_user_ret(&lock, (drm_lock_t *)arg, sizeof(lock), -EFAULT);
-
+
if (lock.context == DRM_KERNEL_CONTEXT) {
DRM_ERROR("Process %d using kernel context %d\n",
current->pid, lock.context);
@@ -687,9 +686,7 @@ int sis_unlock(struct inode *inode, struct file *filp, unsigned int cmd,
}
}
-#if LINUX_VERSION_CODE >= 0x020400 /* KERNEL_VERSION(2,4,0) */
unblock_all_signals();
-#endif
return 0;
}