Update of /cvsroot/alsa/alsa-kernel/isa/gus
In directory sc8-pr-cvs1:/tmp/cvs-serv6295/isa/gus

Modified Files:
        gus_irq.c gus_mem.c gus_mem_proc.c gus_reset.c 
Log Message:
[PATCH: proc-card-dev.dif]

- added snd_card_proc_new() to create a normal text proc file for
  the card basis.  it's handled as an ALSA device, so no explicit
  destruction is necessary.

- snd_info_set_text_ops() to set the callback function for convenience.

- applied the new function to each source and clean-up.



Index: gus_irq.c
===================================================================
RCS file: /cvsroot/alsa/alsa-kernel/isa/gus/gus_irq.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- gus_irq.c   12 Aug 2002 08:43:46 -0000      1.4
+++ gus_irq.c   7 Jan 2003 10:36:29 -0000       1.5
@@ -132,26 +132,8 @@
 {
        snd_info_entry_t *entry;
 
-       gus->irq_entry = NULL;
-       entry = snd_info_create_card_entry(gus->card, "gusirq", gus->card->proc_root);
-       if (entry) {
-               entry->content = SNDRV_INFO_CONTENT_TEXT;
-               entry->c.text.read_size = 512;
-               entry->c.text.read = snd_gus_irq_info_read;
-               entry->private_data = gus;
-               if (snd_info_register(entry) < 0) {
-                       snd_info_free_entry(entry);
-                       entry = NULL;
-               }
-       }
-       gus->irq_entry = entry; 
+       if (! snd_card_proc_new(gus->card, "gusirq", &entry))
+               snd_info_set_text_ops(entry, gus, snd_gus_irq_info_read);
 }
 
-void snd_gus_irq_profile_done(snd_gus_card_t *gus)
-{
-       if (gus->irq_entry) {
-               snd_info_unregister(gus->irq_entry);
-               gus->irq_entry = NULL;
-       }
-}
 #endif

Index: gus_mem.c
===================================================================
RCS file: /cvsroot/alsa/alsa-kernel/isa/gus/gus_mem.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- gus_mem.c   12 Aug 2002 08:43:46 -0000      1.5
+++ gus_mem.c   7 Jan 2003 10:36:29 -0000       1.6
@@ -264,19 +264,10 @@
        if (snd_gf1_mem_xalloc(alloc, &block) == NULL)
                return -ENOMEM;
 #ifdef CONFIG_SND_DEBUG
-       alloc->info_entry = NULL;
-       entry = snd_info_create_card_entry(gus->card, "gusmem", gus->card->proc_root);
-       if (entry) {
-               entry->content = SNDRV_INFO_CONTENT_TEXT;
+       if (! snd_card_proc_new(gus->card, "gusmem", &entry)) {
+               snd_info_set_text_ops(entry, gus, snd_gf1_mem_info_read);
                entry->c.text.read_size = 256 * 1024;
-               entry->c.text.read = snd_gf1_mem_info_read;
-               entry->private_data = gus;
-               if (snd_info_register(entry) < 0) {
-                       snd_info_free_entry(entry);
-                       entry = NULL;
-               }
        }
-       alloc->info_entry = entry;
 #endif
        return 0;
 }
@@ -293,10 +284,6 @@
                snd_gf1_mem_xfree(alloc, block);
                block = nblock;
        }
-#ifdef CONFIG_SND_DEBUG
-       if (alloc->info_entry)
-               snd_info_unregister(alloc->info_entry);
-#endif
        return 0;
 }
 

Index: gus_mem_proc.c
===================================================================
RCS file: /cvsroot/alsa/alsa-kernel/isa/gus/gus_mem_proc.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- gus_mem_proc.c      13 Aug 2002 16:13:38 -0000      1.7
+++ gus_mem_proc.c      7 Jan 2003 10:36:29 -0000       1.8
@@ -96,73 +96,40 @@
        gus_proc_private_t *priv;
        snd_info_entry_t *entry;
 
-       memset(&gus->gf1.rom_entries, 0, sizeof(gus->gf1.rom_entries));
-       memset(&gus->gf1.ram_entries, 0, sizeof(gus->gf1.ram_entries));
        for (idx = 0; idx < 4; idx++) {
                if (gus->gf1.mem_alloc.banks_8[idx].size > 0) {
                        priv = snd_magic_kcalloc(gus_proc_private_t, 0, GFP_KERNEL);
-                       if (priv == NULL) {
-                               snd_gf1_mem_proc_done(gus);
+                       if (priv == NULL)
                                return -ENOMEM;
-                       }
                        priv->gus = gus;
                        sprintf(name, "gus-ram-%i", idx);
-                       entry = snd_info_create_card_entry(gus->card, name, 
gus->card->proc_root);
-                       if (entry) {
+                       if (! snd_card_proc_new(gus->card, name, &entry)) {
                                entry->content = SNDRV_INFO_CONTENT_DATA;
                                entry->private_data = priv;
                                entry->private_free = snd_gf1_mem_proc_free;
                                entry->c.ops = &snd_gf1_mem_proc_ops;
                                priv->address = 
gus->gf1.mem_alloc.banks_8[idx].address;
                                priv->size = entry->size = 
gus->gf1.mem_alloc.banks_8[idx].size;
-                               if (snd_info_register(entry) < 0) {
-                                       snd_info_free_entry(entry);
-                                       entry = NULL;
-                               }
                        }
-                       gus->gf1.ram_entries[idx] = entry;
                }
        }
        for (idx = 0; idx < 4; idx++) {
                if (gus->gf1.rom_present & (1 << idx)) {
                        priv = snd_magic_kcalloc(gus_proc_private_t, 0, GFP_KERNEL);
-                       if (priv == NULL) {
-                               snd_gf1_mem_proc_done(gus);
+                       if (priv == NULL)
                                return -ENOMEM;
-                       }
                        priv->rom = 1;
                        priv->gus = gus;
                        sprintf(name, "gus-rom-%i", idx);
-                       entry = snd_info_create_card_entry(gus->card, name, 
gus->card->proc_root);
-                       if (entry) {
+                       if (! snd_card_proc_new(gus->card, name, &entry)) {
                                entry->content = SNDRV_INFO_CONTENT_DATA;
                                entry->private_data = priv;
                                entry->private_free = snd_gf1_mem_proc_free;
                                entry->c.ops = &snd_gf1_mem_proc_ops;
                                priv->address = idx * 4096 * 1024;
                                priv->size = entry->size = gus->gf1.rom_memory;
-                               if (snd_info_register(entry) < 0) {
-                                       snd_info_free_entry(entry);
-                                       entry = NULL;
-                               }
                        }
-                       gus->gf1.rom_entries[idx] = entry;
                }
-       }
-       return 0;
-}
-
-int snd_gf1_mem_proc_done(snd_gus_card_t * gus)
-{
-       int idx;
-
-       for (idx = 0; idx < 4; idx++) {
-               if (gus->gf1.ram_entries[idx])
-                       snd_info_unregister(gus->gf1.ram_entries[idx]);
-       }
-       for (idx = 0; idx < 4; idx++) {
-               if (gus->gf1.rom_entries[idx])
-                       snd_info_unregister(gus->gf1.rom_entries[idx]);
        }
        return 0;
 }

Index: gus_reset.c
===================================================================
RCS file: /cvsroot/alsa/alsa-kernel/isa/gus/gus_reset.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- gus_reset.c 12 Aug 2002 08:43:46 -0000      1.6
+++ gus_reset.c 7 Jan 2003 10:36:29 -0000       1.7
@@ -410,10 +410,6 @@
        snd_gf1_stop_voices(gus, 0, 31);                /* stop all voices */
        snd_gf1_i_write8(gus, SNDRV_GF1_GB_RESET, 1);   /* disable IRQ & DAC */
        snd_gf1_timers_done(gus);
-#ifdef CONFIG_SND_DEBUG
-       snd_gus_irq_profile_done(gus);
-#endif
-       snd_gf1_mem_proc_done(gus);
        snd_gf1_mem_done(gus);
 #if 0
        snd_gf1_lfo_done(gus);



-------------------------------------------------------
This SF.NET email is sponsored by:
SourceForge Enterprise Edition + IBM + LinuxWorld = Something 2 See!
http://www.vasoftware.com
_______________________________________________
Alsa-cvslog mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/alsa-cvslog

Reply via email to