patch-2_6_7-vs1_9_1_12
[linux-2.6.git] / sound / pci / emu10k1 / emufx.c
index d0f3264..c4f7630 100644 (file)
@@ -120,8 +120,8 @@ static char *creative_outs[32] = {
        /* 0x0a */ "PCM Capture Left",
        /* 0x0b */ "PCM Capture Right",
        /* 0x0c */ "MIC Capture",
-       /* 0x0d */ NULL,
-       /* 0x0e */ NULL,
+       /* 0x0d */ "AC97 Surround Left",
+       /* 0x0e */ "AC97 Surround Right",
        /* 0x0f */ NULL,
        /* 0x10 */ NULL,
        /* 0x11 */ "Analog Center",
@@ -898,8 +898,10 @@ static snd_emu10k1_fx8010_ctl_t *snd_emu10k1_look_for_ctl(emu10k1_t *emu, snd_ct
 static int snd_emu10k1_verify_controls(emu10k1_t *emu, emu10k1_fx8010_code_t *icode)
 {
        unsigned int i;
-       snd_ctl_elem_id_t *_id, id;
-       emu10k1_fx8010_control_gpr_t *_gctl, gctl;
+       snd_ctl_elem_id_t __user *_id;
+       snd_ctl_elem_id_t id;
+       emu10k1_fx8010_control_gpr_t __user *_gctl;
+       emu10k1_fx8010_control_gpr_t gctl;
        
        for (i = 0, _id = icode->gpr_del_controls;
             i < icode->gpr_del_control_count; i++, _id++) {
@@ -946,7 +948,8 @@ static void snd_emu10k1_ctl_private_free(snd_kcontrol_t *kctl)
 static void snd_emu10k1_add_controls(emu10k1_t *emu, emu10k1_fx8010_code_t *icode)
 {
        unsigned int i, j;
-       emu10k1_fx8010_control_gpr_t *_gctl, gctl;
+       emu10k1_fx8010_control_gpr_t __user *_gctl;
+       emu10k1_fx8010_control_gpr_t gctl;
        snd_emu10k1_fx8010_ctl_t *ctl, nctl;
        snd_kcontrol_new_t knew;
        snd_kcontrol_t *kctl;
@@ -1012,7 +1015,8 @@ static void snd_emu10k1_add_controls(emu10k1_t *emu, emu10k1_fx8010_code_t *icod
 static void snd_emu10k1_del_controls(emu10k1_t *emu, emu10k1_fx8010_code_t *icode)
 {
        unsigned int i;
-       snd_ctl_elem_id_t *_id, id;
+       snd_ctl_elem_id_t id;
+       snd_ctl_elem_id_t __user *_id;
        snd_emu10k1_fx8010_ctl_t *ctl;
        snd_card_t *card = emu->card;
        
@@ -1031,7 +1035,8 @@ static int snd_emu10k1_list_controls(emu10k1_t *emu, emu10k1_fx8010_code_t *icod
 {
        unsigned int i = 0, j;
        unsigned int total = 0;
-       emu10k1_fx8010_control_gpr_t *_gctl, gctl;
+       emu10k1_fx8010_control_gpr_t gctl;
+       emu10k1_fx8010_control_gpr_t __user *_gctl;
        snd_emu10k1_fx8010_ctl_t *ctl;
        snd_ctl_elem_id_t *id;
        struct list_head *list;
@@ -2113,22 +2118,26 @@ static int __devinit _snd_emu10k1_init_efx(emu10k1_t *emu)
                for (z = 0; z < 2; z++)
                        OP(icode, &ptr, iACC3, EXTOUT(EXTOUT_REAR_L + z), GPR(playback + SND_EMU10K1_PLAYBACK_CHANNELS + 2 + z), C_00000000, C_00000000);
 
-       if (emu->fx8010.extout_mask & (1<<EXTOUT_CENTER)) {
+       if (emu->fx8010.extout_mask & ((1<<EXTOUT_AC97_REAR_L)|(1<<EXTOUT_AC97_REAR_R)))
+               for (z = 0; z < 2; z++)
+                       OP(icode, &ptr, iACC3, EXTOUT(EXTOUT_AC97_REAR_L + z), GPR(playback + SND_EMU10K1_PLAYBACK_CHANNELS + 2 + z), C_00000000, C_00000000);
+
+       if (emu->fx8010.extout_mask & (1<<EXTOUT_AC97_CENTER)) {
 #ifndef EMU10K1_CENTER_LFE_FROM_FRONT
-               OP(icode, &ptr, iACC3, EXTOUT(EXTOUT_CENTER), GPR(playback + SND_EMU10K1_PLAYBACK_CHANNELS + 4), C_00000000, C_00000000);
+               OP(icode, &ptr, iACC3, EXTOUT(EXTOUT_AC97_CENTER), GPR(playback + SND_EMU10K1_PLAYBACK_CHANNELS + 4), C_00000000, C_00000000);
                OP(icode, &ptr, iACC3, EXTOUT(EXTOUT_ACENTER), GPR(playback + SND_EMU10K1_PLAYBACK_CHANNELS + 4), C_00000000, C_00000000);
 #else
-               OP(icode, &ptr, iACC3, EXTOUT(EXTOUT_CENTER), GPR(playback + SND_EMU10K1_PLAYBACK_CHANNELS + 0), C_00000000, C_00000000);
+               OP(icode, &ptr, iACC3, EXTOUT(EXTOUT_AC97_CENTER), GPR(playback + SND_EMU10K1_PLAYBACK_CHANNELS + 0), C_00000000, C_00000000);
                OP(icode, &ptr, iACC3, EXTOUT(EXTOUT_ACENTER), GPR(playback + SND_EMU10K1_PLAYBACK_CHANNELS + 0), C_00000000, C_00000000);
 #endif
        }
 
-       if (emu->fx8010.extout_mask & (1<<EXTOUT_LFE)) {
+       if (emu->fx8010.extout_mask & (1<<EXTOUT_AC97_LFE)) {
 #ifndef EMU10K1_CENTER_LFE_FROM_FRONT
-               OP(icode, &ptr, iACC3, EXTOUT(EXTOUT_LFE), GPR(playback + SND_EMU10K1_PLAYBACK_CHANNELS + 5), C_00000000, C_00000000);
+               OP(icode, &ptr, iACC3, EXTOUT(EXTOUT_AC97_LFE), GPR(playback + SND_EMU10K1_PLAYBACK_CHANNELS + 5), C_00000000, C_00000000);
                OP(icode, &ptr, iACC3, EXTOUT(EXTOUT_ALFE), GPR(playback + SND_EMU10K1_PLAYBACK_CHANNELS + 5), C_00000000, C_00000000);
 #else
-               OP(icode, &ptr, iACC3, EXTOUT(EXTOUT_LFE), GPR(playback + SND_EMU10K1_PLAYBACK_CHANNELS + 1), C_00000000, C_00000000);
+               OP(icode, &ptr, iACC3, EXTOUT(EXTOUT_AC97_LFE), GPR(playback + SND_EMU10K1_PLAYBACK_CHANNELS + 1), C_00000000, C_00000000);
                OP(icode, &ptr, iACC3, EXTOUT(EXTOUT_ALFE), GPR(playback + SND_EMU10K1_PLAYBACK_CHANNELS + 1), C_00000000, C_00000000);
 #endif
        }
@@ -2293,6 +2302,7 @@ static int snd_emu10k1_fx8010_ioctl(snd_hwdep_t * hw, struct file *file, unsigne
        emu10k1_fx8010_code_t *icode;
        emu10k1_fx8010_pcm_t *ipcm;
        unsigned int addr;
+       void __user *argp = (void __user *)arg;
        int res;
        
        switch (cmd) {
@@ -2304,7 +2314,7 @@ static int snd_emu10k1_fx8010_ioctl(snd_hwdep_t * hw, struct file *file, unsigne
                        kfree(info);
                        return res;
                }
-               if (copy_to_user((void *)arg, info, sizeof(*info))) {
+               if (copy_to_user(argp, info, sizeof(*info))) {
                        kfree(info);
                        return -EFAULT;
                }
@@ -2316,7 +2326,7 @@ static int snd_emu10k1_fx8010_ioctl(snd_hwdep_t * hw, struct file *file, unsigne
                icode = (emu10k1_fx8010_code_t *)kmalloc(sizeof(*icode), GFP_KERNEL);
                if (icode == NULL)
                        return -ENOMEM;
-               if (copy_from_user(icode, (void *)arg, sizeof(*icode))) {
+               if (copy_from_user(icode, argp, sizeof(*icode))) {
                        kfree(icode);
                        return -EFAULT;
                }
@@ -2327,12 +2337,12 @@ static int snd_emu10k1_fx8010_ioctl(snd_hwdep_t * hw, struct file *file, unsigne
                icode = (emu10k1_fx8010_code_t *)kmalloc(sizeof(*icode), GFP_KERNEL);
                if (icode == NULL)
                        return -ENOMEM;
-               if (copy_from_user(icode, (void *)arg, sizeof(*icode))) {
+               if (copy_from_user(icode, argp, sizeof(*icode))) {
                        kfree(icode);
                        return -EFAULT;
                }
                res = snd_emu10k1_icode_peek(emu, icode);
-               if (res == 0 && copy_to_user((void *)arg, icode, sizeof(*icode))) {
+               if (res == 0 && copy_to_user(argp, icode, sizeof(*icode))) {
                        kfree(icode);
                        return -EFAULT;
                }
@@ -2344,7 +2354,7 @@ static int snd_emu10k1_fx8010_ioctl(snd_hwdep_t * hw, struct file *file, unsigne
                ipcm = (emu10k1_fx8010_pcm_t *)kmalloc(sizeof(*ipcm), GFP_KERNEL);
                if (ipcm == NULL)
                        return -ENOMEM;
-               if (copy_from_user(ipcm, (void *)arg, sizeof(*ipcm))) {
+               if (copy_from_user(ipcm, argp, sizeof(*ipcm))) {
                        kfree(ipcm);
                        return -EFAULT;
                }
@@ -2357,12 +2367,12 @@ static int snd_emu10k1_fx8010_ioctl(snd_hwdep_t * hw, struct file *file, unsigne
                ipcm = (emu10k1_fx8010_pcm_t *)snd_kcalloc(sizeof(*ipcm), GFP_KERNEL);
                if (ipcm == NULL)
                        return -ENOMEM;
-               if (copy_from_user(ipcm, (void *)arg, sizeof(*ipcm))) {
+               if (copy_from_user(ipcm, argp, sizeof(*ipcm))) {
                        kfree(ipcm);
                        return -EFAULT;
                }
                res = snd_emu10k1_ipcm_peek(emu, ipcm);
-               if (res == 0 && copy_to_user((void *)arg, ipcm, sizeof(*ipcm))) {
+               if (res == 0 && copy_to_user(argp, ipcm, sizeof(*ipcm))) {
                        kfree(ipcm);
                        return -EFAULT;
                }
@@ -2373,7 +2383,7 @@ static int snd_emu10k1_fx8010_ioctl(snd_hwdep_t * hw, struct file *file, unsigne
                        return -EINVAL;
                if (!capable(CAP_SYS_ADMIN))
                        return -EPERM;
-               if (get_user(addr, (unsigned int *)arg))
+               if (get_user(addr, (unsigned int __user *)argp))
                        return -EFAULT;
                down(&emu->fx8010.lock);
                res = snd_emu10k1_fx8010_tram_setup(emu, addr);
@@ -2411,7 +2421,7 @@ static int snd_emu10k1_fx8010_ioctl(snd_hwdep_t * hw, struct file *file, unsigne
        case SNDRV_EMU10K1_IOCTL_SINGLE_STEP:
                if (!capable(CAP_SYS_ADMIN))
                        return -EPERM;
-               if (get_user(addr, (unsigned int *)arg))
+               if (get_user(addr, (unsigned int __user *)argp))
                        return -EFAULT;
                if (addr > 0x1ff)
                        return -EINVAL;
@@ -2430,7 +2440,7 @@ static int snd_emu10k1_fx8010_ioctl(snd_hwdep_t * hw, struct file *file, unsigne
                        addr = snd_emu10k1_ptr_read(emu, A_DBG, 0);
                else
                        addr = snd_emu10k1_ptr_read(emu, DBG, 0);
-               if (put_user(addr, (unsigned int *)arg))
+               if (put_user(addr, (unsigned int __user *)argp))
                        return -EFAULT;
                return 0;
        }