vserver 1.9.3
[linux-2.6.git] / sound / i2c / l3 / uda1341.c
index 395ada0..4f2229d 100644 (file)
@@ -17,7 +17,7 @@
  * 2002-05-12   Tomas Kasparek  another code cleanup
  */
 
-/* $Id: uda1341.c,v 1.10 2003/10/23 14:34:52 perex Exp $ */
+/* $Id: uda1341.c,v 1.13 2004/07/20 15:54:13 cladisch Exp $ */
 
 #include <sound/driver.h>
 #include <linux/module.h>
@@ -131,7 +131,6 @@ struct uda1341 {
 
 //hack for ALSA magic casting
 typedef struct l3_client l3_client_t;
-#define chip_t l3_client_t      
 
 /* transfer 8bit integer into string with binary representation */
 void int2str_bin8(uint8_t val, char *buf){
@@ -332,7 +331,7 @@ int snd_uda1341_cfg_write(struct l3_client *clnt, unsigned short what,
 static void snd_uda1341_proc_read(snd_info_entry_t *entry, 
                                  snd_info_buffer_t * buffer)
 {
-       struct l3_client *clnt = snd_magic_cast(l3_client_t, entry->private_data, return);
+       struct l3_client *clnt = entry->private_data;
        struct uda1341 *uda = clnt->driver_data;
        int peak;
 
@@ -397,7 +396,7 @@ static void snd_uda1341_proc_read(snd_info_entry_t *entry,
 static void snd_uda1341_proc_regs_read(snd_info_entry_t *entry, 
                                       snd_info_buffer_t * buffer)
 {
-       struct l3_client *clnt = snd_magic_cast(l3_client_t, entry->private_data, return);
+       struct l3_client *clnt = entry->private_data;
        struct uda1341 *uda = clnt->driver_data;                
        int reg;
        char buf[12];
@@ -618,8 +617,6 @@ static int snd_uda1341_put_2regs(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t
 
 /* }}} */
   
-#define UDA1341_CONTROLS (sizeof(snd_uda1341_controls)/sizeof(snd_kcontrol_new_t))
-
 static snd_kcontrol_new_t snd_uda1341_controls[] = {
        UDA1341_SINGLE("Master Playback Switch", CMD_MUTE, data0_2, 2, 1, 1),
        UDA1341_SINGLE("Master Playback Volume", CMD_VOLUME, data0_0, 0, 63, 1),
@@ -653,12 +650,12 @@ static snd_kcontrol_new_t snd_uda1341_controls[] = {
 static void uda1341_free(struct l3_client *uda1341)
 {
        l3_detach_client(uda1341); // calls kfree for driver_data (uda1341_t)
-       snd_magic_kfree(uda1341);
+       kfree(uda1341);
 }
 
 static int uda1341_dev_free(snd_device_t *device)
 {
-       struct l3_client *clnt = snd_magic_cast(l3_client_t, device->device_data, return);
+       struct l3_client *clnt = device->device_data;
        uda1341_free(clnt);
        return 0;
 }
@@ -673,7 +670,7 @@ int __init snd_chip_uda1341_mixer_new(snd_card_t *card, struct l3_client **clnt)
 
        snd_assert(card != NULL, return -EINVAL);
 
-       uda1341 = snd_magic_kcalloc(l3_client_t, 0, GFP_KERNEL);
+       uda1341 = kcalloc(1, sizeof(*uda1341), GFP_KERNEL);
        if (uda1341 == NULL)
                return -ENOMEM;
          
@@ -688,7 +685,7 @@ int __init snd_chip_uda1341_mixer_new(snd_card_t *card, struct l3_client **clnt)
                return err;
        }
 
-       for (idx = 0; idx < UDA1341_CONTROLS; idx++) {
+       for (idx = 0; idx < ARRAY_SIZE(snd_uda1341_controls); idx++) {
                if ((err = snd_ctl_add(card, snd_ctl_new1(&snd_uda1341_controls[idx], uda1341))) < 0)
                        return err;
        }
@@ -710,7 +707,7 @@ static int uda1341_attach(struct l3_client *clnt)
 {
        struct uda1341 *uda;
 
-       uda = snd_magic_kcalloc(uda1341_t, 0, GFP_KERNEL);
+       uda = kcalloc(1, sizeof(*uda), 0, GFP_KERNEL);
        if (!uda)
                return -ENOMEM;
 
@@ -734,7 +731,7 @@ static int uda1341_attach(struct l3_client *clnt)
 static void uda1341_detach(struct l3_client *clnt)
 {
        if (clnt->driver_data)
-               snd_magic_kfree(clnt->driver_data);
+               kfree(clnt->driver_data);
 }
 
 static int
@@ -821,8 +818,7 @@ module_exit(uda1341_exit);
 MODULE_AUTHOR("Tomas Kasparek <tomas.kasparek@seznam.cz>");
 MODULE_LICENSE("GPL");
 MODULE_DESCRIPTION("Philips UDA1341 CODEC driver for ALSA");
-MODULE_CLASSES("{sound}");
-MODULE_DEVICES("{{UDA1341,UDA1341TS}}");
+MODULE_SUPPORTED_DEVICE("{{UDA1341,UDA1341TS}}");
 
 EXPORT_SYMBOL(snd_chip_uda1341_mixer_new);