]> err.no Git - linux-2.6/blobdiff - sound/core/timer.c
Merge 'drm-3264' branch of rsync://rsync.kernel.org/pub/scm/linux/kernel/git/airlied...
[linux-2.6] / sound / core / timer.c
index be6d37af76d8582db00fc5a93a8821dc9b579fb3..cfaccd415b3b918cedc9cbdc6a9d4c89dd0a0861 100644 (file)
@@ -26,6 +26,7 @@
 #include <linux/slab.h>
 #include <linux/time.h>
 #include <linux/moduleparam.h>
+#include <linux/string.h>
 #include <sound/core.h>
 #include <sound/timer.h>
 #include <sound/control.h>
@@ -100,7 +101,7 @@ static snd_timer_instance_t *snd_timer_instance_new(char *owner, snd_timer_t *ti
        timeri = kcalloc(1, sizeof(*timeri), GFP_KERNEL);
        if (timeri == NULL)
                return NULL;
-       timeri->owner = snd_kmalloc_strdup(owner, GFP_KERNEL);
+       timeri->owner = kstrdup(owner, GFP_KERNEL);
        if (! timeri->owner) {
                kfree(timeri);
                return NULL;
@@ -845,7 +846,7 @@ int snd_timer_dev_register(snd_device_t *dev)
        return 0;
 }
 
-int snd_timer_unregister(snd_timer_t *timer)
+static int snd_timer_unregister(snd_timer_t *timer)
 {
        struct list_head *p, *n;
        snd_timer_instance_t *ti;
@@ -946,11 +947,6 @@ struct snd_timer_system_private {
        unsigned long correction;
 };
 
-unsigned int snd_timer_system_resolution(void)
-{
-       return 1000000000L / HZ;
-}
-
 static void snd_timer_s_function(unsigned long data)
 {
        snd_timer_t *timer = (snd_timer_t *)data;
@@ -1474,14 +1470,10 @@ static int snd_timer_user_tselect(struct file *file, snd_timer_select_t __user *
        if ((err = snd_timer_open(&tu->timeri, str, &tselect.id, current->pid)) < 0)
                goto __err;
 
-       if (tu->queue) {
-               kfree(tu->queue);
-               tu->queue = NULL;
-       }
-       if (tu->tqueue) {
-               kfree(tu->tqueue);
-               tu->tqueue = NULL;
-       }
+       kfree(tu->queue);
+       tu->queue = NULL;
+       kfree(tu->tqueue);
+       tu->tqueue = NULL;
        if (tu->tread) {
                tu->tqueue = (snd_timer_tread_t *)kmalloc(tu->queue_size * sizeof(snd_timer_tread_t), GFP_KERNEL);
                if (tu->tqueue == NULL)
@@ -1680,6 +1672,23 @@ static int snd_timer_user_continue(struct file *file)
        return (err = snd_timer_continue(tu->timeri)) < 0 ? err : 0;
 }
 
+static int snd_timer_user_pause(struct file *file)
+{
+       int err;
+       snd_timer_user_t *tu;
+               
+       tu = file->private_data;
+       snd_assert(tu->timeri != NULL, return -ENXIO);
+       return (err = snd_timer_pause(tu->timeri)) < 0 ? err : 0;
+}
+
+enum {
+       SNDRV_TIMER_IOCTL_START_OLD = _IO('T', 0x20),
+       SNDRV_TIMER_IOCTL_STOP_OLD = _IO('T', 0x21),
+       SNDRV_TIMER_IOCTL_CONTINUE_OLD = _IO('T', 0x22),
+       SNDRV_TIMER_IOCTL_PAUSE_OLD = _IO('T', 0x23),
+};
+
 static long snd_timer_user_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
 {
        snd_timer_user_t *tu;
@@ -1724,11 +1733,17 @@ static long snd_timer_user_ioctl(struct file *file, unsigned int cmd, unsigned l
        case SNDRV_TIMER_IOCTL_STATUS:
                return snd_timer_user_status(file, argp);
        case SNDRV_TIMER_IOCTL_START:
+       case SNDRV_TIMER_IOCTL_START_OLD:
                return snd_timer_user_start(file);
        case SNDRV_TIMER_IOCTL_STOP:
+       case SNDRV_TIMER_IOCTL_STOP_OLD:
                return snd_timer_user_stop(file);
        case SNDRV_TIMER_IOCTL_CONTINUE:
+       case SNDRV_TIMER_IOCTL_CONTINUE_OLD:
                return snd_timer_user_continue(file);
+       case SNDRV_TIMER_IOCTL_PAUSE:
+       case SNDRV_TIMER_IOCTL_PAUSE_OLD:
+               return snd_timer_user_pause(file);
        }
        return -ENOTTY;
 }
@@ -1915,4 +1930,3 @@ EXPORT_SYMBOL(snd_timer_global_free);
 EXPORT_SYMBOL(snd_timer_global_register);
 EXPORT_SYMBOL(snd_timer_global_unregister);
 EXPORT_SYMBOL(snd_timer_interrupt);
-EXPORT_SYMBOL(snd_timer_system_resolution);