]> err.no Git - linux-2.6/blobdiff - sound/pci/emu10k1/emufx.c
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6
[linux-2.6] / sound / pci / emu10k1 / emufx.c
index febdd130a209fe29bde27124dcfde0c8e0cbea22..71dc4c8865b88323edbe13a811c5171061d26e51 100644 (file)
@@ -1,5 +1,5 @@
 /*
- *  Copyright (c) by Jaroslav Kysela <perex@suse.cz>
+ *  Copyright (c) by Jaroslav Kysela <perex@perex.cz>
  *                   Creative Labs, Inc.
  *  Routines for effect processor FX8010
  *
@@ -28,7 +28,6 @@
  *
  */
 
-#include <sound/driver.h>
 #include <linux/pci.h>
 #include <linux/capability.h>
 #include <linux/delay.h>
@@ -642,10 +641,8 @@ snd_emu10k1_look_for_ctl(struct snd_emu10k1 *emu, struct snd_ctl_elem_id *id)
 {
        struct snd_emu10k1_fx8010_ctl *ctl;
        struct snd_kcontrol *kcontrol;
-       struct list_head *list;
-       
-       list_for_each(list, &emu->fx8010.gpr_ctl) {
-               ctl = emu10k1_gpr_ctl(list);
+
+       list_for_each_entry(ctl, &emu->fx8010.gpr_ctl, list) {
                kcontrol = ctl->kcontrol;
                if (kcontrol->id.iface == id->iface &&
                    !strcmp(kcontrol->id.name, id->name) &&
@@ -668,7 +665,7 @@ static unsigned int *copy_tlv(const unsigned int __user *_tlv)
                return NULL;
        if (data[1] >= MAX_TLV_SIZE)
                return NULL;
-       tlv = kmalloc(data[1] * 4 + sizeof(data), GFP_KERNEL);
+       tlv = kmalloc(data[1] + sizeof(data), GFP_KERNEL);
        if (!tlv)
                return NULL;
        memcpy(tlv, data, sizeof(data));
@@ -895,14 +892,12 @@ static int snd_emu10k1_list_controls(struct snd_emu10k1 *emu,
        struct snd_emu10k1_fx8010_control_gpr *gctl;
        struct snd_emu10k1_fx8010_ctl *ctl;
        struct snd_ctl_elem_id *id;
-       struct list_head *list;
 
        gctl = kmalloc(sizeof(*gctl), GFP_KERNEL);
        if (! gctl)
                return -ENOMEM;
 
-       list_for_each(list, &emu->fx8010.gpr_ctl) {
-               ctl = emu10k1_gpr_ctl(list);
+       list_for_each_entry(ctl, &emu->fx8010.gpr_ctl, list) {
                total++;
                if (icode->gpr_list_controls &&
                    i < icode->gpr_list_control_count) {
@@ -1266,7 +1261,7 @@ static int __devinit _snd_emu10k1_audigy_init_efx(struct snd_emu10k1 *emu)
 A_OP(icode, &ptr, iMAC0, A_GPR(var), A_GPR(var), A_GPR(vol), A_EXTIN(input))
 
        /* emu1212 DSP 0 and DSP 1 Capture */
-       if (emu->card_capabilities->emu1010) {
+       if (emu->card_capabilities->emu_model) {
                if (emu->card_capabilities->ca0108_chip) {
                        /* Note:JCD:No longer bit shift lower 16bits to upper 16bits of 32bit value. */
                        A_OP(icode, &ptr, iMACINT0, A_GPR(tmp), A_C_00000000, A3_EMU32IN(0x0), A_C_00000001);
@@ -1520,7 +1515,7 @@ A_OP(icode, &ptr, iMAC0, A_GPR(var), A_GPR(var), A_GPR(vol), A_EXTIN(input))
 
        /* digital outputs */
        /* A_PUT_STEREO_OUTPUT(A_EXTOUT_FRONT_L, A_EXTOUT_FRONT_R, playback + SND_EMU10K1_PLAYBACK_CHANNELS); */
-       if (emu->card_capabilities->emu1010) {
+       if (emu->card_capabilities->emu_model) {
                /* EMU1010 Outputs from PCM Front, Rear, Center, LFE, Side */
                snd_printk("EMU outputs on\n");
                for (z = 0; z < 8; z++) {
@@ -1568,7 +1563,7 @@ A_OP(icode, &ptr, iMAC0, A_GPR(var), A_GPR(var), A_GPR(vol), A_EXTIN(input))
        A_PUT_OUTPUT(A_EXTOUT_ADC_CAP_R, capture+1);
 #endif
 
-       if (emu->card_capabilities->emu1010) {
+       if (emu->card_capabilities->emu_model) {
                if (emu->card_capabilities->ca0108_chip) {
                        snd_printk("EMU2 inputs on\n");
                        for (z = 0; z < 0x10; z++) {
@@ -2440,14 +2435,13 @@ static void copy_string(char *dst, char *src, char *null, int idx)
                strcpy(dst, src);
 }
 
-static int snd_emu10k1_fx8010_info(struct snd_emu10k1 *emu,
+static void snd_emu10k1_fx8010_info(struct snd_emu10k1 *emu,
                                   struct snd_emu10k1_fx8010_info *info)
 {
        char **fxbus, **extin, **extout;
        unsigned short fxbus_mask, extin_mask, extout_mask;
        int res;
 
-       memset(info, 0, sizeof(info));
        info->internal_tram_size = emu->fx8010.itram_size;
        info->external_tram_size = emu->fx8010.etram_pages.bytes / 2;
        fxbus = fxbuses;
@@ -2464,7 +2458,6 @@ static int snd_emu10k1_fx8010_info(struct snd_emu10k1 *emu,
        for (res = 16; res < 32; res++, extout++)
                copy_string(info->extout_names[res], extout_mask & (1 << res) ? *extout : NULL, "Unused", res);
        info->gpr_controls = emu->fx8010.gpr_count;
-       return 0;
 }
 
 static int snd_emu10k1_fx8010_ioctl(struct snd_hwdep * hw, struct file *file, unsigned int cmd, unsigned long arg)
@@ -2485,10 +2478,7 @@ static int snd_emu10k1_fx8010_ioctl(struct snd_hwdep * hw, struct file *file, un
                info = kmalloc(sizeof(*info), GFP_KERNEL);
                if (!info)
                        return -ENOMEM;
-               if ((res = snd_emu10k1_fx8010_info(emu, info)) < 0) {
-                       kfree(info);
-                       return res;
-               }
+               snd_emu10k1_fx8010_info(emu, info);
                if (copy_to_user(argp, info, sizeof(*info))) {
                        kfree(info);
                        return -EFAULT;