Update of /cvsroot/alsa/alsa-kernel/core/oss
In directory sc8-pr-cvs1:/tmp/cvs-serv4916

Modified Files:
        mixer_oss.c pcm_oss.c 
Log Message:
- added OSS_ALSAEMULVER ioctl
- cleanups for put_user()


Index: mixer_oss.c
===================================================================
RCS file: /cvsroot/alsa/alsa-kernel/core/oss/mixer_oss.c,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -r1.26 -r1.27
--- mixer_oss.c 30 Oct 2003 11:29:26 -0000      1.26
+++ mixer_oss.c 9 Dec 2003 11:25:01 -0000       1.27
@@ -30,6 +30,8 @@
 #include <sound/mixer_oss.h>
 #include <linux/soundcard.h>
 
+#define OSS_ALSAEMULVER         _SIOR ('M', 249, int)
+
 MODULE_AUTHOR("Jaroslav Kysela <[EMAIL PROTECTED]>");
 MODULE_DESCRIPTION("Mixer OSS emulation for ALSA.");
 MODULE_LICENSE("GPL");
@@ -306,34 +308,36 @@
                        tmp = snd_mixer_oss_set_recsrc(fmixer, tmp);
                        if (tmp < 0)
                                return tmp;
-                       return put_user(tmp, (int *)arg) ? -EFAULT : 0;
+                       return put_user(tmp, (int *)arg);
                case OSS_GETVERSION:
                        return put_user(SNDRV_OSS_VERSION, (int *) arg);
+               case OSS_ALSAEMULVER:
+                       return put_user(1, (int *) arg);
                case SOUND_MIXER_READ_DEVMASK:
                        tmp = snd_mixer_oss_devmask(fmixer);
                        if (tmp < 0)
                                return tmp;
-                       return put_user(tmp, (int *)arg) ? -EFAULT : 0;
+                       return put_user(tmp, (int *)arg);
                case SOUND_MIXER_READ_STEREODEVS:
                        tmp = snd_mixer_oss_stereodevs(fmixer);
                        if (tmp < 0)
                                return tmp;
-                       return put_user(tmp, (int *)arg) ? -EFAULT : 0;
+                       return put_user(tmp, (int *)arg);
                case SOUND_MIXER_READ_RECMASK:
                        tmp = snd_mixer_oss_recmask(fmixer);
                        if (tmp < 0)
                                return tmp;
-                       return put_user(tmp, (int *)arg) ? -EFAULT : 0;
+                       return put_user(tmp, (int *)arg);
                case SOUND_MIXER_READ_CAPS:
                        tmp = snd_mixer_oss_caps(fmixer);
                        if (tmp < 0)
                                return tmp;
-                       return put_user(tmp, (int *)arg) ? -EFAULT : 0;
+                       return put_user(tmp, (int *)arg);
                case SOUND_MIXER_READ_RECSRC:
                        tmp = snd_mixer_oss_get_recsrc(fmixer);
                        if (tmp < 0)
                                return tmp;
-                       return put_user(tmp, (int *)arg) ? -EFAULT : 0;
+                       return put_user(tmp, (int *)arg);
                }
        }
        if (cmd & SIOC_IN) {
@@ -342,12 +346,12 @@
                tmp = snd_mixer_oss_set_volume(fmixer, cmd & 0xff, tmp);
                if (tmp < 0)
                        return tmp;
-               return put_user(tmp, (int *)arg) ? -EFAULT : 0;
+               return put_user(tmp, (int *)arg);
        } else if (cmd & SIOC_OUT) {
                tmp = snd_mixer_oss_get_volume(fmixer, cmd & 0xff);
                if (tmp < 0)
                        return tmp;
-               return put_user(tmp, (int *)arg) ? -EFAULT : 0;
+               return put_user(tmp, (int *)arg);
        }
        return -ENXIO;
 }

Index: pcm_oss.c
===================================================================
RCS file: /cvsroot/alsa/alsa-kernel/core/oss/pcm_oss.c,v
retrieving revision 1.60
retrieving revision 1.61
diff -u -r1.60 -r1.61
--- pcm_oss.c   1 Dec 2003 13:15:00 -0000       1.60
+++ pcm_oss.c   9 Dec 2003 11:25:01 -0000       1.61
@@ -40,6 +40,8 @@
 #include <linux/soundcard.h>
 #include <sound/initval.h>
 
+#define OSS_ALSAEMULVER                _SIOR ('M', 249, int)
+
 static int dsp_map[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS-1)] = 0};
 static int adsp_map[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS-1)] = 1};
 static int nonblock_open;
@@ -1871,7 +1873,9 @@
 
        pcm_oss_file = snd_magic_cast(snd_pcm_oss_file_t, file->private_data, return 
-ENXIO);
        if (cmd == OSS_GETVERSION)
-               return put_user(SNDRV_OSS_VERSION, (int *)arg) ? -EFAULT : 0;
+               return put_user(SNDRV_OSS_VERSION, (int *)arg);
+       if (cmd == OSS_ALSAEMULVER)
+               return put_user(1, (int *)arg);
 #if defined(CONFIG_SND_MIXER_OSS) || (defined(MODULE) && 
defined(CONFIG_SND_MIXER_OSS_MODULE))
        if (((cmd >> 8) & 0xff) == 'M') {       /* mixer ioctl - for OSS compatibility 
*/
                snd_pcm_substream_t *substream;
@@ -1900,48 +1904,48 @@
                        return -EFAULT;
                if ((res = snd_pcm_oss_set_rate(pcm_oss_file, res))<0)
                        return res;
-               return put_user(res, (int *)arg) ? -EFAULT : 0;
+               return put_user(res, (int *)arg);
        case SOUND_PCM_READ_RATE:
                res = snd_pcm_oss_get_rate(pcm_oss_file);
                if (res < 0)
                        return res;
-               return put_user(res, (int *)arg) ? -EFAULT : 0;
+               return put_user(res, (int *)arg);
        case SNDCTL_DSP_STEREO:
                if (get_user(res, (int *)arg))
                        return -EFAULT;
                res = res > 0 ? 2 : 1;
                if ((res = snd_pcm_oss_set_channels(pcm_oss_file, res)) < 0)
                        return res;
-               return put_user(--res, (int *)arg) ? -EFAULT : 0;
+               return put_user(--res, (int *)arg);
        case SNDCTL_DSP_GETBLKSIZE:
                res = snd_pcm_oss_get_block_size(pcm_oss_file);
                if (res < 0)
                        return res;
-               return put_user(res, (int *)arg) ? -EFAULT : 0;
+               return put_user(res, (int *)arg);
        case SNDCTL_DSP_SETFMT:
                if (get_user(res, (int *)arg))
                        return -EFAULT;
                res = snd_pcm_oss_set_format(pcm_oss_file, res);
                if (res < 0)
                        return res;
-               return put_user(res, (int *)arg) ? -EFAULT : 0;
+               return put_user(res, (int *)arg);
        case SOUND_PCM_READ_BITS:
                res = snd_pcm_oss_get_format(pcm_oss_file);
                if (res < 0)
                        return res;
-               return put_user(res, (int *)arg) ? -EFAULT : 0;
+               return put_user(res, (int *)arg);
        case SNDCTL_DSP_CHANNELS:
                if (get_user(res, (int *)arg))
                        return -EFAULT;
                res = snd_pcm_oss_set_channels(pcm_oss_file, res);
                if (res < 0)
                        return res;
-               return put_user(res, (int *)arg) ? -EFAULT : 0;
+               return put_user(res, (int *)arg);
        case SOUND_PCM_READ_CHANNELS:
                res = snd_pcm_oss_get_channels(pcm_oss_file);
                if (res < 0)
                        return res;
-               return put_user(res, (int *)arg) ? -EFAULT : 0;
+               return put_user(res, (int *)arg);
        case SOUND_PCM_WRITE_FILTER:
        case SOUND_PCM_READ_FILTER:
                return -EIO;
@@ -1953,7 +1957,7 @@
                res = snd_pcm_oss_set_subdivide(pcm_oss_file, res);
                if (res < 0)
                        return res;
-               return put_user(res, (int *)arg) ? -EFAULT : 0;
+               return put_user(res, (int *)arg);
        case SNDCTL_DSP_SETFRAGMENT:
                if (get_user(res, (int *)arg))
                        return -EFAULT;
@@ -1962,7 +1966,7 @@
                res = snd_pcm_oss_get_formats(pcm_oss_file);
                if (res < 0)
                        return res;
-               return put_user(res, (int *)arg) ? -EFAULT : 0;
+               return put_user(res, (int *)arg);
        case SNDCTL_DSP_GETOSPACE:
        case SNDCTL_DSP_GETISPACE:
                return snd_pcm_oss_get_space(pcm_oss_file,
@@ -1975,12 +1979,12 @@
                res = snd_pcm_oss_get_caps(pcm_oss_file);
                if (res < 0)
                        return res;
-               return put_user(res, (int *)arg) ? -EFAULT : 0;
+               return put_user(res, (int *)arg);
        case SNDCTL_DSP_GETTRIGGER:
                res = snd_pcm_oss_get_trigger(pcm_oss_file);
                if (res < 0)
                        return res;
-               return put_user(res, (int *)arg) ? -EFAULT : 0;
+               return put_user(res, (int *)arg);
        case SNDCTL_DSP_SETTRIGGER:
                if (get_user(res, (int *)arg))
                        return -EFAULT;
@@ -2011,7 +2015,7 @@
                        put_user(0, (int *)arg);
                        return res;
                }
-               return put_user(res, (int *)arg) ? -EFAULT : 0;
+               return put_user(res, (int *)arg);
        case SNDCTL_DSP_PROFILE:
                return 0;       /* silently ignore */
        default:



-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
Does SourceForge.net help you be more productive?  Does it
help you create better code?  SHARE THE LOVE, and help us help
YOU!  Click Here: http://sourceforge.net/donate/
_______________________________________________
Alsa-cvslog mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/alsa-cvslog

Reply via email to