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

Modified Files:
        cmipci.c cs4281.c ens1370.c intel8x0.c rme32.c rme96.c 
        sonicvibes.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: cmipci.c
===================================================================
RCS file: /cvsroot/alsa/alsa-kernel/pci/cmipci.c,v
retrieving revision 1.38
retrieving revision 1.39
diff -u -r1.38 -r1.39
--- cmipci.c    6 Jan 2003 13:38:31 -0000       1.38
+++ cmipci.c    7 Jan 2003 10:36:30 -0000       1.39
@@ -472,7 +472,6 @@
        snd_rawmidi_t *rmidi;
 
        spinlock_t reg_lock;
-       snd_info_entry_t *proc_entry;
 };
 
 
@@ -2746,26 +2745,8 @@
 {
        snd_info_entry_t *entry;
 
-       if ((entry = snd_info_create_card_entry(cm->card, "cmipci", 
cm->card->proc_root)) != NULL) {
-               entry->content = SNDRV_INFO_CONTENT_TEXT;
-               entry->private_data = cm;
-               entry->mode = S_IFREG | S_IRUGO | S_IWUSR;
-               entry->c.text.read_size = 256;
-               entry->c.text.read = snd_cmipci_proc_read;
-               if (snd_info_register(entry) < 0) {
-                       snd_info_free_entry(entry);
-                       entry = NULL;
-               }
-       }
-       cm->proc_entry = entry;
-}
-
-static void snd_cmipci_proc_done(cmipci_t *cm)
-{
-       if (cm->proc_entry) {
-               snd_info_unregister(cm->proc_entry);
-               cm->proc_entry = NULL;
-       }
+       if (! snd_card_proc_new(cm->card, "cmipci", &entry))
+               snd_info_set_text_ops(entry, cm, snd_cmipci_proc_read);
 }
 
 
@@ -2832,8 +2813,6 @@
 
 static int snd_cmipci_free(cmipci_t *cm)
 {
-       snd_cmipci_proc_done(cm);
-
        if (cm->irq >= 0) {
                snd_cmipci_clear_bit(cm, CM_REG_MISC_CTRL, CM_FM_EN);
                snd_cmipci_clear_bit(cm, CM_REG_LEGACY_CTRL, CM_ENSPDOUT);

Index: cs4281.c
===================================================================
RCS file: /cvsroot/alsa/alsa-kernel/pci/cs4281.c,v
retrieving revision 1.34
retrieving revision 1.35
diff -u -r1.34 -r1.35
--- cs4281.c    7 Jan 2003 10:25:27 -0000       1.34
+++ cs4281.c    7 Jan 2003 10:36:30 -0000       1.35
@@ -499,13 +499,9 @@
        unsigned int spurious_dhtc_irq;
        unsigned int spurious_dtc_irq;
 
-       void *proc_entry_BA0;
-       void *proc_entry_BA1;
-
        spinlock_t reg_lock;
        unsigned int midcr;
        unsigned int uartm;
-       snd_info_entry_t *proc_entry;
 
        struct snd_cs4281_gameport *gameport;
 
@@ -1251,55 +1247,19 @@
 {
        snd_info_entry_t *entry;
 
-       if ((entry = snd_info_create_card_entry(chip->card, "cs4281", 
chip->card->proc_root)) != NULL) {
-               entry->content = SNDRV_INFO_CONTENT_TEXT;
-               entry->private_data = chip;
-               entry->mode = S_IFREG | S_IRUGO | S_IWUSR;
-               entry->c.text.read_size = 256;
-               entry->c.text.read = snd_cs4281_proc_read;
-               if (snd_info_register(entry) < 0) {
-                       snd_info_free_entry(entry);
-                       entry = NULL;
-               }
-       }
-       chip->proc_entry = entry;
-       if ((entry = snd_info_create_card_entry(chip->card, "cs4281_BA0", 
chip->card->proc_root)) != NULL) {
+       if (! snd_card_proc_new(chip->card, "cs4281", &entry))
+               snd_info_set_text_ops(entry, chip, snd_cs4281_proc_read);
+       if (! snd_card_proc_new(chip->card, "cs4281_BA0", &entry)) {
                entry->content = SNDRV_INFO_CONTENT_DATA;
                entry->private_data = chip;
                entry->c.ops = &snd_cs4281_proc_ops_BA0;
                entry->size = CS4281_BA0_SIZE;
-               if (snd_info_register(entry) < 0) {
-                       snd_info_unregister(entry);
-                       entry = NULL;
-               }
        }
-       chip->proc_entry_BA0 = entry;
-       if ((entry = snd_info_create_card_entry(chip->card, "cs4281_BA1", 
chip->card->proc_root)) != NULL) {
+       if (! snd_card_proc_new(chip->card, "cs4281_BA1", &entry)) {
                entry->content = SNDRV_INFO_CONTENT_DATA;
                entry->private_data = chip;
                entry->c.ops = &snd_cs4281_proc_ops_BA1;
                entry->size = CS4281_BA1_SIZE;
-               if (snd_info_register(entry) < 0) {
-                       snd_info_unregister(entry);
-                       entry = NULL;
-               }
-       }
-       chip->proc_entry_BA1 = entry;
-}
-
-static void snd_cs4281_proc_done(cs4281_t * chip)
-{
-       if (chip->proc_entry_BA1) {
-               snd_info_unregister(chip->proc_entry_BA1);
-               chip->proc_entry_BA1 = NULL;
-       }
-       if (chip->proc_entry_BA0) {
-               snd_info_unregister(chip->proc_entry_BA0);
-               chip->proc_entry_BA0 = NULL;
-       }
-       if (chip->proc_entry) {
-               snd_info_unregister(chip->proc_entry);
-               chip->proc_entry = NULL;
        }
 }
 
@@ -1414,7 +1374,6 @@
                kfree(chip->gameport);
        }
 #endif
-       snd_cs4281_proc_done(chip);
        if (chip->irq >= 0)
                synchronize_irq(chip->irq);
 

Index: ens1370.c
===================================================================
RCS file: /cvsroot/alsa/alsa-kernel/pci/ens1370.c,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -r1.31 -r1.32
--- ens1370.c   19 Dec 2002 17:14:24 -0000      1.31
+++ ens1370.c   7 Jan 2003 10:36:30 -0000       1.32
@@ -398,8 +398,6 @@
        unsigned int spdif_default;
        unsigned int spdif_stream;
 
-       snd_info_entry_t *proc_entry;
-
 #ifdef CHIP1370
        unsigned char *bugbuf;
        dma_addr_t bugbuf_addr;
@@ -1725,26 +1723,8 @@
 {
        snd_info_entry_t *entry;
 
-       if ((entry = snd_info_create_card_entry(ensoniq->card, "audiopci", 
ensoniq->card->proc_root)) != NULL) {
-               entry->content = SNDRV_INFO_CONTENT_TEXT;
-               entry->private_data = ensoniq;
-               entry->mode = S_IFREG | S_IRUGO | S_IWUSR;
-               entry->c.text.read_size = 256;
-               entry->c.text.read = snd_ensoniq_proc_read;
-               if (snd_info_register(entry) < 0) {
-                       snd_info_free_entry(entry);
-                       entry = NULL;
-               }
-       }
-       ensoniq->proc_entry = entry;
-}
-
-static void snd_ensoniq_proc_done(ensoniq_t * ensoniq)
-{
-       if (ensoniq->proc_entry) {
-               snd_info_unregister(ensoniq->proc_entry);
-               ensoniq->proc_entry = NULL;
-       }
+       if (! snd_card_proc_new(ensoniq->card, "audiopci", &entry))
+               snd_info_set_text_ops(entry, ensoniq, snd_ensoniq_proc_read);
 }
 
 /*
@@ -1757,7 +1737,6 @@
        if (ensoniq->ctrl & ES_JYSTK_EN)
                snd_ensoniq_joy_disable(ensoniq);
 #endif
-       snd_ensoniq_proc_done(ensoniq);
        if (ensoniq->irq < 0)
                goto __hw_end;
 #ifdef CHIP1370

Index: intel8x0.c
===================================================================
RCS file: /cvsroot/alsa/alsa-kernel/pci/intel8x0.c,v
retrieving revision 1.54
retrieving revision 1.55
diff -u -r1.54 -r1.55
--- intel8x0.c  7 Jan 2003 10:25:27 -0000       1.54
+++ intel8x0.c  7 Jan 2003 10:36:30 -0000       1.55
@@ -322,7 +322,6 @@
        unsigned char piv_saved;
        unsigned short picb_saved;
 #endif
-       snd_info_entry_t *proc_entry;
 } ichdev_t;
 
 typedef struct _snd_intel8x0 intel8x0_t;
@@ -368,7 +367,6 @@
 
        spinlock_t reg_lock;
        spinlock_t ac97_lock;
-       snd_info_entry_t *proc_entry;
        
        u32 bdbars_count;
        u32 *bdbars;
@@ -1854,8 +1852,6 @@
        return 0;
 }
 
-static void snd_intel8x0_proc_done(intel8x0_t * chip);
-
 static int snd_intel8x0_free(intel8x0_t *chip)
 {
        int i;
@@ -1871,7 +1867,6 @@
        /* --- */
        synchronize_irq(chip->irq);
       __hw_end:
-       snd_intel8x0_proc_done(chip);
        if (chip->bdbars)
                snd_free_pci_pages(chip->pci, chip->bdbars_count * sizeof(u32) * 
ICH_MAX_FRAGS * 2, chip->bdbars, chip->bdbars_addr);
        if (chip->remap_addr)
@@ -2096,26 +2091,8 @@
 {
        snd_info_entry_t *entry;
 
-       if ((entry = snd_info_create_card_entry(chip->card, "intel8x0", 
chip->card->proc_root)) != NULL) {
-               entry->content = SNDRV_INFO_CONTENT_TEXT;
-               entry->private_data = chip;
-               entry->mode = S_IFREG | S_IRUGO | S_IWUSR;
-               entry->c.text.read_size = 2048;
-               entry->c.text.read = snd_intel8x0_proc_read;
-               if (snd_info_register(entry) < 0) {
-                       snd_info_free_entry(entry);
-                       entry = NULL;
-               }
-       }
-       chip->proc_entry = entry;
-}
-
-static void snd_intel8x0_proc_done(intel8x0_t * chip)
-{
-       if (chip->proc_entry) {
-               snd_info_unregister(chip->proc_entry);
-               chip->proc_entry = NULL;
-       }
+       if (! snd_card_proc_new(chip->card, "intel8x0", &entry))
+               snd_info_set_text_ops(entry, chip, snd_intel8x0_proc_read);
 }
 
 static int snd_intel8x0_dev_free(snd_device_t *device)

Index: rme32.c
===================================================================
RCS file: /cvsroot/alsa/alsa-kernel/pci/rme32.c,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -r1.16 -r1.17
--- rme32.c     8 Dec 2002 09:07:44 -0000       1.16
+++ rme32.c     7 Jan 2003 10:36:30 -0000       1.17
@@ -220,7 +220,6 @@
        snd_pcm_t *spdif_pcm;
        snd_pcm_t *adat_pcm;
        struct pci_dev *pci;
-       snd_info_entry_t *proc_entry;
        snd_kcontrol_t *spdif_ctl;
 } rme32_t;
 
@@ -1240,7 +1239,6 @@
        if (rme32->irq >= 0) {
                snd_rme32_playback_stop(rme32);
                snd_rme32_capture_stop(rme32);
-               snd_rme32_proc_done(rme32);
                free_irq(rme32->irq, (void *) rme32);
                rme32->irq = -1;
        }
@@ -1484,26 +1482,8 @@
 {
        snd_info_entry_t *entry;
 
-       if ((entry = snd_info_create_card_entry(rme32->card, "rme32", 
rme32->card->proc_root)) != NULL) {
-               entry->content = SNDRV_INFO_CONTENT_TEXT;
-               entry->private_data = rme32;
-               entry->mode = S_IFREG | S_IRUGO | S_IWUSR;
-               entry->c.text.read_size = 256;
-               entry->c.text.read = snd_rme32_proc_read;
-               if (snd_info_register(entry) < 0) {
-                       snd_info_free_entry(entry);
-                       entry = NULL;
-               }
-       }
-       rme32->proc_entry = entry;
-}
-
-static void snd_rme32_proc_done(rme32_t * rme32)
-{
-       if (rme32->proc_entry) {
-               snd_info_unregister(rme32->proc_entry);
-               rme32->proc_entry = NULL;
-       }
+       if (! snd_card_proc_new(rme32->card, "rme32", &entry))
+               snd_info_set_text_ops(entry, rme32, snd_rme32_proc_read);
 }
 
 /*

Index: rme96.c
===================================================================
RCS file: /cvsroot/alsa/alsa-kernel/pci/rme96.c,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -r1.20 -r1.21
--- rme96.c     5 Jan 2003 16:52:34 -0000       1.20
+++ rme96.c     7 Jan 2003 10:36:30 -0000       1.21
@@ -257,7 +257,6 @@
        snd_pcm_t          *spdif_pcm;
        snd_pcm_t          *adat_pcm; 
        struct pci_dev     *pci;
-       snd_info_entry_t   *proc_entry;
        snd_kcontrol_t     *spdif_ctl;
 } rme96_t;
 
@@ -308,9 +307,6 @@
 static void __devinit 
 snd_rme96_proc_init(rme96_t *rme96);
 
-static void
-snd_rme96_proc_done(rme96_t *rme96);
-
 static int
 snd_rme96_create_switches(snd_card_t *card,
                          rme96_t *rme96);
@@ -1628,7 +1624,6 @@
                snd_rme96_capture_stop(rme96);
                rme96->areg &= ~RME96_AR_DAC_EN;
                writel(rme96->areg, rme96->iobase + RME96_IO_ADDITIONAL_REG);
-               snd_rme96_proc_done(rme96);
                free_irq(rme96->irq, (void *)rme96);
                rme96->irq = -1;
        }
@@ -1913,27 +1908,8 @@
 {
        snd_info_entry_t *entry;
 
-       if ((entry = snd_info_create_card_entry(rme96->card, "rme96", 
rme96->card->proc_root)) != NULL) {
-               entry->content = SNDRV_INFO_CONTENT_TEXT;
-               entry->private_data = rme96;
-               entry->mode = S_IFREG | S_IRUGO | S_IWUSR;
-               entry->c.text.read_size = 256;
-               entry->c.text.read = snd_rme96_proc_read;
-               if (snd_info_register(entry) < 0) {
-                       snd_info_free_entry(entry);
-                       entry = NULL;
-               }
-       }
-       rme96->proc_entry = entry;
-}
-
-static void
-snd_rme96_proc_done(rme96_t * rme96)
-{
-       if (rme96->proc_entry) {
-               snd_info_unregister(rme96->proc_entry);
-               rme96->proc_entry = NULL;
-       }
+       if (! snd_card_proc_new(rme96->card, "rme96", &entry))
+               snd_info_set_text_ops(entry, rme96, snd_rme96_proc_read);
 }
 
 /*

Index: sonicvibes.c
===================================================================
RCS file: /cvsroot/alsa/alsa-kernel/pci/sonicvibes.c,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -r1.19 -r1.20
--- sonicvibes.c        19 Dec 2002 16:26:30 -0000      1.19
+++ sonicvibes.c        7 Jan 2003 10:36:30 -0000       1.20
@@ -247,7 +247,6 @@
        snd_hwdep_t *fmsynth;   /* S3FM */
 
        spinlock_t reg_lock;
-       snd_info_entry_t *proc_entry;
 
        unsigned int p_dma_size;
        unsigned int c_dma_size;
@@ -1175,26 +1174,8 @@
 {
        snd_info_entry_t *entry;
 
-       if ((entry = snd_info_create_card_entry(sonic->card, "sonicvibes", 
sonic->card->proc_root)) != NULL) {
-               entry->content = SNDRV_INFO_CONTENT_TEXT;
-               entry->private_data = sonic;
-               entry->mode = S_IFREG | S_IRUGO | S_IWUSR;
-               entry->c.text.read_size = 256;
-               entry->c.text.read = snd_sonicvibes_proc_read;
-               if (snd_info_register(entry) < 0) {
-                       snd_info_free_entry(entry);
-                       entry = NULL;
-               }
-       }
-       sonic->proc_entry = entry;
-}
-
-static void snd_sonicvibes_proc_done(sonicvibes_t * sonic)
-{
-       if (sonic->proc_entry) {
-               snd_info_unregister(sonic->proc_entry);
-               sonic->proc_entry = NULL;
-       }
+       if (! snd_card_proc_new(sonic->card, "sonicvibes", &entry))
+               snd_info_set_text_ops(entry, sonic, snd_sonicvibes_proc_read);
 }
 
 /*
@@ -1210,7 +1191,6 @@
        if (sonic->gameport.io)
                gameport_unregister_port(&sonic->gameport);
 #endif
-       snd_sonicvibes_proc_done(sonic);
        pci_write_config_dword(sonic->pci, 0x40, sonic->dmaa_port);
        pci_write_config_dword(sonic->pci, 0x48, sonic->dmac_port);
        if (sonic->res_sb_port) {



-------------------------------------------------------
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