Merge branch 'stable-3.2' into pandora-3.2
[pandora-kernel.git] / sound / core / timer_compat.c
index 8e7eddf..80343b9 100644 (file)
@@ -40,11 +40,11 @@ static int snd_timer_user_info_compat(struct file *file,
        struct snd_timer *t;
 
        tu = file->private_data;
-       if (snd_BUG_ON(!tu->timeri))
-               return -ENXIO;
+       if (!tu->timeri)
+               return -EBADFD;
        t = tu->timeri->timer;
-       if (snd_BUG_ON(!t))
-               return -ENXIO;
+       if (!t)
+               return -EBADFD;
        memset(&info, 0, sizeof(info));
        info.card = t->card ? t->card->number : -1;
        if (t->hw.flags & SNDRV_TIMER_HW_SLAVE)
@@ -73,8 +73,8 @@ static int snd_timer_user_status_compat(struct file *file,
        struct snd_timer_status32 status;
        
        tu = file->private_data;
-       if (snd_BUG_ON(!tu->timeri))
-               return -ENXIO;
+       if (!tu->timeri)
+               return -EBADFD;
        memset(&status, 0, sizeof(status));
        status.tstamp.tv_sec = tu->tstamp.tv_sec;
        status.tstamp.tv_nsec = tu->tstamp.tv_nsec;
@@ -97,7 +97,8 @@ enum {
        SNDRV_TIMER_IOCTL_STATUS32 = _IOW('T', 0x14, struct snd_timer_status32),
 };
 
-static long snd_timer_user_ioctl_compat(struct file *file, unsigned int cmd, unsigned long arg)
+static long __snd_timer_user_ioctl_compat(struct file *file, unsigned int cmd,
+                                         unsigned long arg)
 {
        void __user *argp = compat_ptr(arg);
 
@@ -118,7 +119,7 @@ static long snd_timer_user_ioctl_compat(struct file *file, unsigned int cmd, uns
        case SNDRV_TIMER_IOCTL_PAUSE:
        case SNDRV_TIMER_IOCTL_PAUSE_OLD:
        case SNDRV_TIMER_IOCTL_NEXT_DEVICE:
-               return snd_timer_user_ioctl(file, cmd, (unsigned long)argp);
+               return __snd_timer_user_ioctl(file, cmd, (unsigned long)argp);
        case SNDRV_TIMER_IOCTL_INFO32:
                return snd_timer_user_info_compat(file, argp);
        case SNDRV_TIMER_IOCTL_STATUS32:
@@ -126,3 +127,15 @@ static long snd_timer_user_ioctl_compat(struct file *file, unsigned int cmd, uns
        }
        return -ENOIOCTLCMD;
 }
+
+static long snd_timer_user_ioctl_compat(struct file *file, unsigned int cmd,
+                                       unsigned long arg)
+{
+       struct snd_timer_user *tu = file->private_data;
+       long ret;
+
+       mutex_lock(&tu->ioctl_lock);
+       ret = __snd_timer_user_ioctl_compat(file, cmd, arg);
+       mutex_unlock(&tu->ioctl_lock);
+       return ret;
+}