ALSA: pci: Clean up with new procfs helpers
authorTakashi Iwai <tiwai@suse.de>
Mon, 4 Feb 2019 15:01:39 +0000 (16:01 +0100)
committerTakashi Iwai <tiwai@suse.de>
Wed, 6 Feb 2019 17:11:56 +0000 (18:11 +0100)
Simplify the proc fs creation code with new helper functions,
snd_card_ro_proc_new() and snd_card_rw_proc_new().
Just a code refactoring and no functional changes.

Reviewed-by: Jaroslav Kysela <perex@perex.cz>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
38 files changed:
sound/pci/ad1889.c
sound/pci/ak4531_codec.c
sound/pci/ali5451/ali5451.c
sound/pci/asihpi/asihpi.c
sound/pci/atiixp.c
sound/pci/atiixp_modem.c
sound/pci/ca0106/ca0106_proc.c
sound/pci/cmipci.c
sound/pci/cs4281.c
sound/pci/emu10k1/emu10k1x.c
sound/pci/emu10k1/emuproc.c
sound/pci/ens1370.c
sound/pci/hda/hda_proc.c
sound/pci/ice1712/ice1712.c
sound/pci/ice1712/ice1724.c
sound/pci/ice1712/pontis.c
sound/pci/ice1712/prodigy192.c
sound/pci/ice1712/prodigy_hifi.c
sound/pci/ice1712/quartet.c
sound/pci/intel8x0.c
sound/pci/intel8x0m.c
sound/pci/korg1212/korg1212.c
sound/pci/lola/lola_proc.c
sound/pci/lx6464es/lx6464es.c
sound/pci/mixart/mixart.c
sound/pci/oxygen/oxygen_lib.c
sound/pci/pcxhr/pcxhr.c
sound/pci/riptide/riptide.c
sound/pci/rme32.c
sound/pci/rme96.c
sound/pci/rme9652/hdsp.c
sound/pci/rme9652/hdspm.c
sound/pci/rme9652/rme9652.c
sound/pci/sonicvibes.c
sound/pci/trident/trident_main.c
sound/pci/via82xx.c
sound/pci/via82xx_modem.c
sound/pci/ymfpci/ymfpci_main.c

index d9c54c08e2dbde1e46421dd42f5647f57e329590..f333bbf4187034f66b63ef04341256ff56892537 100644 (file)
@@ -741,10 +741,8 @@ snd_ad1889_proc_read(struct snd_info_entry *entry, struct snd_info_buffer *buffe
 static void
 snd_ad1889_proc_init(struct snd_ad1889 *chip)
 {
-       struct snd_info_entry *entry;
-
-       if (!snd_card_proc_new(chip->card, chip->card->driver, &entry))
-               snd_info_set_text_ops(entry, chip, snd_ad1889_proc_read);
+       snd_card_ro_proc_new(chip->card, chip->card->driver,
+                            chip, snd_ad1889_proc_read);
 }
 
 static const struct ac97_quirk ac97_quirks[] = {
index 2fb1fbba3e5ec7066d7ec7bd17b6152fcef3fc88..11e902cac71b4eeee6d2890be7f6d965c127153f 100644 (file)
@@ -481,8 +481,5 @@ static void snd_ak4531_proc_read(struct snd_info_entry *entry,
 static void
 snd_ak4531_proc_init(struct snd_card *card, struct snd_ak4531 *ak4531)
 {
-       struct snd_info_entry *entry;
-
-       if (! snd_card_proc_new(card, "ak4531", &entry))
-               snd_info_set_text_ops(entry, ak4531, snd_ak4531_proc_read);
+       snd_card_ro_proc_new(card, "ak4531", ak4531, snd_ak4531_proc_read);
 }
index e781ccca17932815aeb6e6415fc3d073c5055466..f7fbe05836b378f486baa572c447fa099838e9bc 100644 (file)
@@ -2049,9 +2049,7 @@ static void snd_ali_proc_read(struct snd_info_entry *entry,
 
 static void snd_ali_proc_init(struct snd_ali *codec)
 {
-       struct snd_info_entry *entry;
-       if (!snd_card_proc_new(codec->card, "ali5451", &entry))
-               snd_info_set_text_ops(entry, codec, snd_ali_proc_read);
+       snd_card_ro_proc_new(codec->card, "ali5451", codec, snd_ali_proc_read);
 }
 
 static int snd_ali_resources(struct snd_ali *codec)
index aad74e80979728db913a25628d7663d1966981c3..32b2f9802479dc0e653a169bdb67ef611ab7c506 100644 (file)
@@ -2782,10 +2782,8 @@ snd_asihpi_proc_read(struct snd_info_entry *entry,
 
 static void snd_asihpi_proc_init(struct snd_card_asihpi *asihpi)
 {
-       struct snd_info_entry *entry;
-
-       if (!snd_card_proc_new(asihpi->card, "info", &entry))
-               snd_info_set_text_ops(entry, asihpi, snd_asihpi_proc_read);
+       snd_card_ro_proc_new(asihpi->card, "info", asihpi,
+                            snd_asihpi_proc_read);
 }
 
 /*------------------------------------------------------------
index 7715d26916acda663c7a9e3e5572caa4d63b48be..169763c88f5e2b47d40a0a9895e948a7be871336 100644 (file)
@@ -1543,10 +1543,7 @@ static void snd_atiixp_proc_read(struct snd_info_entry *entry,
 
 static void snd_atiixp_proc_init(struct atiixp *chip)
 {
-       struct snd_info_entry *entry;
-
-       if (! snd_card_proc_new(chip->card, "atiixp", &entry))
-               snd_info_set_text_ops(entry, chip, snd_atiixp_proc_read);
+       snd_card_ro_proc_new(chip->card, "atiixp", chip, snd_atiixp_proc_read);
 }
 
 
index a357a8e2e73d7b0be92ec85409aa0e889b4e1a89..cece66bb3644e04af57918fd52b0c4b0878e1ef3 100644 (file)
@@ -1170,10 +1170,8 @@ static void snd_atiixp_proc_read(struct snd_info_entry *entry,
 
 static void snd_atiixp_proc_init(struct atiixp_modem *chip)
 {
-       struct snd_info_entry *entry;
-
-       if (! snd_card_proc_new(chip->card, "atiixp-modem", &entry))
-               snd_info_set_text_ops(entry, chip, snd_atiixp_proc_read);
+       snd_card_ro_proc_new(chip->card, "atiixp-modem", chip,
+                            snd_atiixp_proc_read);
 }
 
 
index a2c85cc37972306e60adb71abe0e53590c7cad1b..f5b8934db735acfdf7f8a98684e46bd60c4eae66 100644 (file)
@@ -424,30 +424,20 @@ static void snd_ca0106_proc_i2c_write(struct snd_info_entry *entry,
 
 int snd_ca0106_proc_init(struct snd_ca0106 *emu)
 {
-       struct snd_info_entry *entry;
-       
-       if(! snd_card_proc_new(emu->card, "iec958", &entry))
-               snd_info_set_text_ops(entry, emu, snd_ca0106_proc_iec958);
-       if(! snd_card_proc_new(emu->card, "ca0106_reg32", &entry)) {
-               snd_info_set_text_ops(entry, emu, snd_ca0106_proc_reg_read32);
-               entry->c.text.write = snd_ca0106_proc_reg_write32;
-               entry->mode |= 0200;
-       }
-       if(! snd_card_proc_new(emu->card, "ca0106_reg16", &entry))
-               snd_info_set_text_ops(entry, emu, snd_ca0106_proc_reg_read16);
-       if(! snd_card_proc_new(emu->card, "ca0106_reg8", &entry))
-               snd_info_set_text_ops(entry, emu, snd_ca0106_proc_reg_read8);
-       if(! snd_card_proc_new(emu->card, "ca0106_regs1", &entry)) {
-               snd_info_set_text_ops(entry, emu, snd_ca0106_proc_reg_read1);
-               entry->c.text.write = snd_ca0106_proc_reg_write;
-               entry->mode |= 0200;
-       }
-       if(! snd_card_proc_new(emu->card, "ca0106_i2c", &entry)) {
-               entry->c.text.write = snd_ca0106_proc_i2c_write;
-               entry->private_data = emu;
-               entry->mode |= 0200;
-       }
-       if(! snd_card_proc_new(emu->card, "ca0106_regs2", &entry)) 
-               snd_info_set_text_ops(entry, emu, snd_ca0106_proc_reg_read2);
+       snd_card_ro_proc_new(emu->card, "iec958", emu, snd_ca0106_proc_iec958);
+       snd_card_rw_proc_new(emu->card, "ca0106_reg32", emu,
+                            snd_ca0106_proc_reg_read32,
+                            snd_ca0106_proc_reg_write32);
+       snd_card_ro_proc_new(emu->card, "ca0106_reg16", emu,
+                            snd_ca0106_proc_reg_read16);
+       snd_card_ro_proc_new(emu->card, "ca0106_reg8", emu,
+                            snd_ca0106_proc_reg_read8);
+       snd_card_rw_proc_new(emu->card, "ca0106_regs1", emu,
+                            snd_ca0106_proc_reg_read1,
+                            snd_ca0106_proc_reg_write);
+       snd_card_rw_proc_new(emu->card, "ca0106_i2c", emu, NULL,
+                            snd_ca0106_proc_i2c_write);
+       snd_card_ro_proc_new(emu->card, "ca0106_regs2", emu,
+                            snd_ca0106_proc_reg_read2);
        return 0;
 }
index 5bbf31c1695c2863ee39842aa51a53db55892f22..701be04aed538033512e9c5cb66190c368dd6d69 100644 (file)
@@ -2792,10 +2792,7 @@ static void snd_cmipci_proc_read(struct snd_info_entry *entry,
 
 static void snd_cmipci_proc_init(struct cmipci *cm)
 {
-       struct snd_info_entry *entry;
-
-       if (! snd_card_proc_new(cm->card, "cmipci", &entry))
-               snd_info_set_text_ops(entry, cm, snd_cmipci_proc_read);
+       snd_card_ro_proc_new(cm->card, "cmipci", cm, snd_cmipci_proc_read);
 }
 
 static const struct pci_device_id snd_cmipci_ids[] = {
index a9fb819cad1d46accac39ea931f4eb005b54a2a4..15bbf9564c82de285c4cb85008ab0575a163b139 100644 (file)
@@ -1174,8 +1174,7 @@ static void snd_cs4281_proc_init(struct cs4281 *chip)
 {
        struct snd_info_entry *entry;
 
-       if (! snd_card_proc_new(chip->card, "cs4281", &entry))
-               snd_info_set_text_ops(entry, chip, snd_cs4281_proc_read);
+       snd_card_ro_proc_new(chip->card, "cs4281", 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;
index 611589cbdad65d2ebf44ecaaaf6ea5c6c990a8a3..576c7bd03a1a9e149295b450764627a7b03d22cd 100644 (file)
@@ -1065,15 +1065,9 @@ static void snd_emu10k1x_proc_reg_write(struct snd_info_entry *entry,
 
 static int snd_emu10k1x_proc_init(struct emu10k1x *emu)
 {
-       struct snd_info_entry *entry;
-       
-       if(! snd_card_proc_new(emu->card, "emu10k1x_regs", &entry)) {
-               snd_info_set_text_ops(entry, emu, snd_emu10k1x_proc_reg_read);
-               entry->c.text.write = snd_emu10k1x_proc_reg_write;
-               entry->mode |= 0200;
-               entry->private_data = emu;
-       }
-       
+       snd_card_rw_proc_new(emu->card, "emu10k1x_regs", emu,
+                            snd_emu10k1x_proc_reg_read,
+                            snd_emu10k1x_proc_reg_write);
        return 0;
 }
 
index b5700803179211575cb57eff5dee71b7cf2f4fd2..a3d9f06e8e6ae0d4fdd765e325b27a40b6042cf8 100644 (file)
@@ -568,55 +568,40 @@ int snd_emu10k1_proc_init(struct snd_emu10k1 *emu)
        struct snd_info_entry *entry;
 #ifdef CONFIG_SND_DEBUG
        if (emu->card_capabilities->emu_model) {
-               if (! snd_card_proc_new(emu->card, "emu1010_regs", &entry)) 
-                       snd_info_set_text_ops(entry, emu, snd_emu_proc_emu1010_reg_read);
-       }
-       if (! snd_card_proc_new(emu->card, "io_regs", &entry)) {
-               snd_info_set_text_ops(entry, emu, snd_emu_proc_io_reg_read);
-               entry->c.text.write = snd_emu_proc_io_reg_write;
-               entry->mode |= 0200;
-       }
-       if (! snd_card_proc_new(emu->card, "ptr_regs00a", &entry)) {
-               snd_info_set_text_ops(entry, emu, snd_emu_proc_ptr_reg_read00a);
-               entry->c.text.write = snd_emu_proc_ptr_reg_write00;
-               entry->mode |= 0200;
-       }
-       if (! snd_card_proc_new(emu->card, "ptr_regs00b", &entry)) {
-               snd_info_set_text_ops(entry, emu, snd_emu_proc_ptr_reg_read00b);
-               entry->c.text.write = snd_emu_proc_ptr_reg_write00;
-               entry->mode |= 0200;
-       }
-       if (! snd_card_proc_new(emu->card, "ptr_regs20a", &entry)) {
-               snd_info_set_text_ops(entry, emu, snd_emu_proc_ptr_reg_read20a);
-               entry->c.text.write = snd_emu_proc_ptr_reg_write20;
-               entry->mode |= 0200;
-       }
-       if (! snd_card_proc_new(emu->card, "ptr_regs20b", &entry)) {
-               snd_info_set_text_ops(entry, emu, snd_emu_proc_ptr_reg_read20b);
-               entry->c.text.write = snd_emu_proc_ptr_reg_write20;
-               entry->mode |= 0200;
-       }
-       if (! snd_card_proc_new(emu->card, "ptr_regs20c", &entry)) {
-               snd_info_set_text_ops(entry, emu, snd_emu_proc_ptr_reg_read20c);
-               entry->c.text.write = snd_emu_proc_ptr_reg_write20;
-               entry->mode |= 0200;
+               snd_card_ro_proc_new(emu->card, "emu1010_regs",
+                                    emu, snd_emu_proc_emu1010_reg_read);
        }
+       snd_card_rw_proc_new(emu->card, "io_regs", emu,
+                            snd_emu_proc_io_reg_read,
+                            snd_emu_proc_io_reg_write);
+       snd_card_rw_proc_new(emu->card, "ptr_regs00a", emu,
+                            snd_emu_proc_ptr_reg_read00a,
+                            snd_emu_proc_ptr_reg_write00);
+       snd_card_rw_proc_new(emu->card, "ptr_regs00b", emu,
+                            snd_emu_proc_ptr_reg_read00b,
+                            snd_emu_proc_ptr_reg_write00);
+       snd_card_rw_proc_new(emu->card, "ptr_regs20a", emu,
+                            snd_emu_proc_ptr_reg_read20a,
+                            snd_emu_proc_ptr_reg_write20);
+       snd_card_rw_proc_new(emu->card, "ptr_regs20b", emu,
+                            snd_emu_proc_ptr_reg_read20b,
+                            snd_emu_proc_ptr_reg_write20);
+       snd_card_rw_proc_new(emu->card, "ptr_regs20c", emu,
+                            snd_emu_proc_ptr_reg_read20c,
+                            snd_emu_proc_ptr_reg_write20);
 #endif
        
-       if (! snd_card_proc_new(emu->card, "emu10k1", &entry))
-               snd_info_set_text_ops(entry, emu, snd_emu10k1_proc_read);
+       snd_card_ro_proc_new(emu->card, "emu10k1", emu, snd_emu10k1_proc_read);
 
-       if (emu->card_capabilities->emu10k2_chip) {
-               if (! snd_card_proc_new(emu->card, "spdif-in", &entry))
-                       snd_info_set_text_ops(entry, emu, snd_emu10k1_proc_spdif_read);
-       }
-       if (emu->card_capabilities->ca0151_chip) {
-               if (! snd_card_proc_new(emu->card, "capture-rates", &entry))
-                       snd_info_set_text_ops(entry, emu, snd_emu10k1_proc_rates_read);
-       }
+       if (emu->card_capabilities->emu10k2_chip)
+               snd_card_ro_proc_new(emu->card, "spdif-in", emu,
+                                    snd_emu10k1_proc_spdif_read);
+       if (emu->card_capabilities->ca0151_chip)
+               snd_card_ro_proc_new(emu->card, "capture-rates", emu,
+                                    snd_emu10k1_proc_rates_read);
 
-       if (! snd_card_proc_new(emu->card, "voices", &entry))
-               snd_info_set_text_ops(entry, emu, snd_emu10k1_proc_voices_read);
+       snd_card_ro_proc_new(emu->card, "voices", emu,
+                            snd_emu10k1_proc_voices_read);
 
        if (! snd_card_proc_new(emu->card, "fx8010_gpr", &entry)) {
                entry->content = SNDRV_INFO_CONTENT_DATA;
@@ -646,11 +631,7 @@ int snd_emu10k1_proc_init(struct snd_emu10k1 *emu)
                entry->size = emu->audigy ? A_TOTAL_SIZE_CODE : TOTAL_SIZE_CODE;
                entry->c.ops = &snd_emu10k1_proc_ops_fx8010;
        }
-       if (! snd_card_proc_new(emu->card, "fx8010_acode", &entry)) {
-               entry->content = SNDRV_INFO_CONTENT_TEXT;
-               entry->private_data = emu;
-               entry->mode = S_IFREG | 0444 /*| S_IWUSR*/;
-               entry->c.text.read = snd_emu10k1_proc_acode_read;
-       }
+       snd_card_ro_proc_new(emu->card, "fx8010_acode", emu,
+                            snd_emu10k1_proc_acode_read);
        return 0;
 }
index 1f2960ecc57ef37ad1c78bc1802a9615914fecd4..1cfff35e370ea52440399cc408280b3526698dc3 100644 (file)
@@ -1902,10 +1902,8 @@ static void snd_ensoniq_proc_read(struct snd_info_entry *entry,
 
 static void snd_ensoniq_proc_init(struct ensoniq *ensoniq)
 {
-       struct snd_info_entry *entry;
-
-       if (! snd_card_proc_new(ensoniq->card, "audiopci", &entry))
-               snd_info_set_text_ops(entry, ensoniq, snd_ensoniq_proc_read);
+       snd_card_ro_proc_new(ensoniq->card, "audiopci", ensoniq,
+                            snd_ensoniq_proc_read);
 }
 
 /*
index a657404196502ec4a5424981369f33842fcd9579..853842987fa1c8f93f76f8a1faf396a899de1e38 100644 (file)
@@ -919,15 +919,8 @@ static void print_codec_info(struct snd_info_entry *entry,
 int snd_hda_codec_proc_new(struct hda_codec *codec)
 {
        char name[32];
-       struct snd_info_entry *entry;
-       int err;
 
        snprintf(name, sizeof(name), "codec#%d", codec->core.addr);
-       err = snd_card_proc_new(codec->card, name, &entry);
-       if (err < 0)
-               return err;
-
-       snd_info_set_text_ops(entry, codec, print_codec_info);
-       return 0;
+       return snd_card_ro_proc_new(codec->card, name, codec, print_codec_info);
 }
 
index dda9b26192cbc95ed52656c7554fee4eb83c13dc..fa7d90ee6e2d0d4fe070dd74f249f948522b002b 100644 (file)
@@ -1603,10 +1603,7 @@ static void snd_ice1712_proc_read(struct snd_info_entry *entry,
 
 static void snd_ice1712_proc_init(struct snd_ice1712 *ice)
 {
-       struct snd_info_entry *entry;
-
-       if (!snd_card_proc_new(ice->card, "ice1712", &entry))
-               snd_info_set_text_ops(entry, ice, snd_ice1712_proc_read);
+       snd_card_ro_proc_new(ice->card, "ice1712", ice, snd_ice1712_proc_read);
 }
 
 /*
index 42994cf3615688ef931d4a7e326f1c5be6286537..a7d640ee4a170a611a8ce2c24fe1b67d8b83d0f9 100644 (file)
@@ -1571,10 +1571,7 @@ static void snd_vt1724_proc_read(struct snd_info_entry *entry,
 
 static void snd_vt1724_proc_init(struct snd_ice1712 *ice)
 {
-       struct snd_info_entry *entry;
-
-       if (!snd_card_proc_new(ice->card, "ice1724", &entry))
-               snd_info_set_text_ops(entry, ice, snd_vt1724_proc_read);
+       snd_card_ro_proc_new(ice->card, "ice1724", ice, snd_vt1724_proc_read);
 }
 
 /*
index 93b8cfc6636fc804cc4a395256c22d8dfedcf0f2..f499f1e8d0c9270c0d69562d833df2d3214ada9d 100644 (file)
@@ -659,12 +659,8 @@ static void wm_proc_regs_read(struct snd_info_entry *entry, struct snd_info_buff
 
 static void wm_proc_init(struct snd_ice1712 *ice)
 {
-       struct snd_info_entry *entry;
-       if (! snd_card_proc_new(ice->card, "wm_codec", &entry)) {
-               snd_info_set_text_ops(entry, ice, wm_proc_regs_read);
-               entry->mode |= 0200;
-               entry->c.text.write = wm_proc_regs_write;
-       }
+       snd_card_rw_proc_new(ice->card, "wm_codec", ice, wm_proc_regs_read,
+                            wm_proc_regs_write);
 }
 
 static void cs_proc_regs_read(struct snd_info_entry *entry, struct snd_info_buffer *buffer)
@@ -684,9 +680,7 @@ static void cs_proc_regs_read(struct snd_info_entry *entry, struct snd_info_buff
 
 static void cs_proc_init(struct snd_ice1712 *ice)
 {
-       struct snd_info_entry *entry;
-       if (! snd_card_proc_new(ice->card, "cs_codec", &entry))
-               snd_info_set_text_ops(entry, ice, cs_proc_regs_read);
+       snd_card_ro_proc_new(ice->card, "cs_codec", ice, cs_proc_regs_read);
 }
 
 
index 3919aed39ca03ab3005e0bfec8ffd2e65f20a147..d243309029d34159e0825af083943bbb03be8f8c 100644 (file)
@@ -651,9 +651,8 @@ static void stac9460_proc_regs_read(struct snd_info_entry *entry,
 
 static void stac9460_proc_init(struct snd_ice1712 *ice)
 {
-       struct snd_info_entry *entry;
-       if (!snd_card_proc_new(ice->card, "stac9460_codec", &entry))
-               snd_info_set_text_ops(entry, ice, stac9460_proc_regs_read);
+       snd_card_ro_proc_new(ice->card, "stac9460_codec", ice,
+                            stac9460_proc_regs_read);
 }
 
 
index c97b5528e4b80b421d3cb322a0dbdc883c0bc908..72f252c936e578748f2dcef45157b21a0c1b1c8a 100644 (file)
@@ -904,12 +904,8 @@ static void wm_proc_regs_read(struct snd_info_entry *entry,
 
 static void wm_proc_init(struct snd_ice1712 *ice)
 {
-       struct snd_info_entry *entry;
-       if (!snd_card_proc_new(ice->card, "wm_codec", &entry)) {
-               snd_info_set_text_ops(entry, ice, wm_proc_regs_read);
-               entry->mode |= 0200;
-               entry->c.text.write = wm_proc_regs_write;
-       }
+       snd_card_rw_proc_new(ice->card, "wm_codec", ice, wm_proc_regs_read,
+                            wm_proc_regs_write);
 }
 
 static int prodigy_hifi_add_controls(struct snd_ice1712 *ice)
index 5bc836241c977feb517e7c8d1e049a62271a5470..8ad964ee0b65fe88afb808c31f06a955baa8d77a 100644 (file)
@@ -502,9 +502,7 @@ static void proc_regs_read(struct snd_info_entry *entry,
 
 static void proc_init(struct snd_ice1712 *ice)
 {
-       struct snd_info_entry *entry;
-       if (!snd_card_proc_new(ice->card, "quartet", &entry))
-               snd_info_set_text_ops(entry, ice, proc_regs_read);
+       snd_card_ro_proc_new(ice->card, "quartet", ice, proc_regs_read);
 }
 
 static int qtet_mute_get(struct snd_kcontrol *kcontrol,
index 885e1d488ed6e8f4060e5c693f32764f8f40a12b..2784bf48cf5a2e0d69c2020785323cf1f07e993e 100644 (file)
@@ -2863,10 +2863,8 @@ static void snd_intel8x0_proc_read(struct snd_info_entry * entry,
 
 static void snd_intel8x0_proc_init(struct intel8x0 *chip)
 {
-       struct snd_info_entry *entry;
-
-       if (! snd_card_proc_new(chip->card, "intel8x0", &entry))
-               snd_info_set_text_ops(entry, chip, snd_intel8x0_proc_read);
+       snd_card_ro_proc_new(chip->card, "intel8x0", chip,
+                            snd_intel8x0_proc_read);
 }
 
 static int snd_intel8x0_dev_free(struct snd_device *device)
index 44eb9e28a1eb1bfd0fb1fb16129c825b05a78492..43c654e154529b7e9752a05ea7252eae22370394 100644 (file)
@@ -1084,10 +1084,8 @@ static void snd_intel8x0m_proc_read(struct snd_info_entry * entry,
 
 static void snd_intel8x0m_proc_init(struct intel8x0m *chip)
 {
-       struct snd_info_entry *entry;
-
-       if (! snd_card_proc_new(chip->card, "intel8x0m", &entry))
-               snd_info_set_text_ops(entry, chip, snd_intel8x0m_proc_read);
+       snd_card_ro_proc_new(chip->card, "intel8x0m", chip,
+                            snd_intel8x0m_proc_read);
 }
 
 static int snd_intel8x0m_dev_free(struct snd_device *device)
index 4e189a93f475ee268673264fd306483662309b5f..fe4aba8a08ea7f9f57e680fbc94de56cc5bf582f 100644 (file)
@@ -2090,10 +2090,8 @@ static void snd_korg1212_proc_read(struct snd_info_entry *entry,
 
 static void snd_korg1212_proc_init(struct snd_korg1212 *korg1212)
 {
-       struct snd_info_entry *entry;
-
-       if (! snd_card_proc_new(korg1212->card, "korg1212", &entry))
-               snd_info_set_text_ops(entry, korg1212, snd_korg1212_proc_read);
+       snd_card_ro_proc_new(korg1212->card, "korg1212", korg1212,
+                            snd_korg1212_proc_read);
 }
 
 static int
index 904e3c4f4dfec25020276dd45577bb3fbebce4dc..1603f9c81897bcb03a462cf93ca31aac6d77edf9 100644 (file)
@@ -208,15 +208,9 @@ static void lola_proc_regs_read(struct snd_info_entry *entry,
 
 void lola_proc_debug_new(struct lola *chip)
 {
-       struct snd_info_entry *entry;
-
-       if (!snd_card_proc_new(chip->card, "codec", &entry))
-               snd_info_set_text_ops(entry, chip, lola_proc_codec_read);
-       if (!snd_card_proc_new(chip->card, "codec_rw", &entry)) {
-               snd_info_set_text_ops(entry, chip, lola_proc_codec_rw_read);
-               entry->mode |= 0200;
-               entry->c.text.write = lola_proc_codec_rw_write;
-       }
-       if (!snd_card_proc_new(chip->card, "regs", &entry))
-               snd_info_set_text_ops(entry, chip, lola_proc_regs_read);
+       snd_card_ro_proc_new(chip->card, "codec", chip, lola_proc_codec_read);
+       snd_card_rw_proc_new(chip->card, "codec_rw", chip,
+                            lola_proc_codec_rw_read,
+                            lola_proc_codec_rw_write);
+       snd_card_ro_proc_new(chip->card, "regs", chip, lola_proc_regs_read);
 }
index 54f6252faca684b23ef91617318c8ae11e3de04e..198ccf9b5eb389b093707d369e818542fe85bac8 100644 (file)
@@ -948,13 +948,7 @@ static void lx_proc_levels_read(struct snd_info_entry *entry,
 
 static int lx_proc_create(struct snd_card *card, struct lx6464es *chip)
 {
-       struct snd_info_entry *entry;
-       int err = snd_card_proc_new(card, "levels", &entry);
-       if (err < 0)
-               return err;
-
-       snd_info_set_text_ops(entry, chip, lx_proc_levels_read);
-       return 0;
+       return snd_card_ro_proc_new(card, "levels", chip, lx_proc_levels_read);
 }
 
 
index 9cd297a42f24dfc258634583d395a8a7950a7a2b..92f616df3863c257ca0e7c9dc45fe8e642ae7fa1 100644 (file)
@@ -1220,10 +1220,8 @@ static void snd_mixart_proc_init(struct snd_mixart *chip)
        struct snd_info_entry *entry;
 
        /* text interface to read perf and temp meters */
-       if (! snd_card_proc_new(chip->card, "board_info", &entry)) {
-               entry->private_data = chip;
-               entry->c.text.read = snd_mixart_proc_read;
-       }
+       snd_card_ro_proc_new(chip->card, "board_info", chip,
+                            snd_mixart_proc_read);
 
        if (! snd_card_proc_new(chip->card, "mixart_BA0", &entry)) {
                entry->content = SNDRV_INFO_CONTENT_DATA;
index d4cfff7e49e1f43019481afa5acd02bd3fcbf4cd..3ae9dd4b39e861d635e87a53802153d5d67dbaa1 100644 (file)
@@ -244,10 +244,7 @@ static void oxygen_proc_read(struct snd_info_entry *entry,
 
 static void oxygen_proc_init(struct oxygen *chip)
 {
-       struct snd_info_entry *entry;
-
-       if (!snd_card_proc_new(chip->card, "oxygen", &entry))
-               snd_info_set_text_ops(entry, chip, oxygen_proc_read);
+       snd_card_ro_proc_new(chip->card, "oxygen", chip, oxygen_proc_read);
 }
 
 static const struct pci_device_id *
index e57da403623166a6c4c7a27c566a1fa2660a6599..4ab7efc6e9f733f36305db55bb4d755d1241373d 100644 (file)
@@ -1454,21 +1454,14 @@ static void pcxhr_proc_ltc(struct snd_info_entry *entry,
 
 static void pcxhr_proc_init(struct snd_pcxhr *chip)
 {
-       struct snd_info_entry *entry;
-
-       if (! snd_card_proc_new(chip->card, "info", &entry))
-               snd_info_set_text_ops(entry, chip, pcxhr_proc_info);
-       if (! snd_card_proc_new(chip->card, "sync", &entry))
-               snd_info_set_text_ops(entry, chip, pcxhr_proc_sync);
+       snd_card_ro_proc_new(chip->card, "info", chip, pcxhr_proc_info);
+       snd_card_ro_proc_new(chip->card, "sync", chip, pcxhr_proc_sync);
        /* gpio available on stereo sound cards only */
-       if (chip->mgr->is_hr_stereo &&
-           !snd_card_proc_new(chip->card, "gpio", &entry)) {
-               snd_info_set_text_ops(entry, chip, pcxhr_proc_gpio_read);
-               entry->c.text.write = pcxhr_proc_gpo_write;
-               entry->mode |= 0200;
-       }
-       if (!snd_card_proc_new(chip->card, "ltc", &entry))
-               snd_info_set_text_ops(entry, chip, pcxhr_proc_ltc);
+       if (chip->mgr->is_hr_stereo)
+               snd_card_rw_proc_new(chip->card, "gpio", chip,
+                                    pcxhr_proc_gpio_read,
+                                    pcxhr_proc_gpo_write);
+       snd_card_ro_proc_new(chip->card, "ltc", chip, pcxhr_proc_ltc);
 }
 /* end of proc interface */
 
index 1d431c8052d67a0311c4765f0b5283cf361ead64..8d1a56a9bcfd52d37b21c84b5b95feaadadf5ac1 100644 (file)
@@ -1973,10 +1973,8 @@ snd_riptide_proc_read(struct snd_info_entry *entry,
 
 static void snd_riptide_proc_init(struct snd_riptide *chip)
 {
-       struct snd_info_entry *entry;
-
-       if (!snd_card_proc_new(chip->card, "riptide", &entry))
-               snd_info_set_text_ops(entry, chip, snd_riptide_proc_read);
+       snd_card_ro_proc_new(chip->card, "riptide", chip,
+                            snd_riptide_proc_read);
 }
 
 static int snd_riptide_mixer(struct snd_riptide *chip)
index 3ac8c71d567c8758070cb3d8f8734335ad75180b..c6bcc07157166a874642a6e494b7b22940b2d87b 100644 (file)
@@ -1568,10 +1568,7 @@ snd_rme32_proc_read(struct snd_info_entry * entry, struct snd_info_buffer *buffe
 
 static void snd_rme32_proc_init(struct rme32 *rme32)
 {
-       struct snd_info_entry *entry;
-
-       if (! snd_card_proc_new(rme32->card, "rme32", &entry))
-               snd_info_set_text_ops(entry, rme32, snd_rme32_proc_read);
+       snd_card_ro_proc_new(rme32->card, "rme32", rme32, snd_rme32_proc_read);
 }
 
 /*
index c56702e6cb607a518631bf2cf61b4e8dde8bcaf7..42c6b5e090729cbe50c0593a328b5216d2fa4011 100644 (file)
@@ -1868,10 +1868,7 @@ snd_rme96_proc_read(struct snd_info_entry *entry, struct snd_info_buffer *buffer
 
 static void snd_rme96_proc_init(struct rme96 *rme96)
 {
-       struct snd_info_entry *entry;
-
-       if (! snd_card_proc_new(rme96->card, "rme96", &entry))
-               snd_info_set_text_ops(entry, rme96, snd_rme96_proc_read);
+       snd_card_ro_proc_new(rme96->card, "rme96", rme96, snd_rme96_proc_read);
 }
 
 /*
index ba99ff0e93e0307aebc79d7dd2e59fb2d7a3b5fb..29bef48a3af3cf8574af306c78d2fd89e01e4227 100644 (file)
@@ -3708,10 +3708,7 @@ snd_hdsp_proc_read(struct snd_info_entry *entry, struct snd_info_buffer *buffer)
 
 static void snd_hdsp_proc_init(struct hdsp *hdsp)
 {
-       struct snd_info_entry *entry;
-
-       if (! snd_card_proc_new(hdsp->card, "hdsp", &entry))
-               snd_info_set_text_ops(entry, hdsp, snd_hdsp_proc_read);
+       snd_card_ro_proc_new(hdsp->card, "hdsp", hdsp, snd_hdsp_proc_read);
 }
 
 static void snd_hdsp_free_buffers(struct hdsp *hdsp)
index 679ad0415e3b30461b53ce08e22dfd48b0f4a27d..d485dd8a7b724f878e541136cbda4e6fb95e5611 100644 (file)
@@ -5287,44 +5287,35 @@ static void snd_hdspm_proc_ports_out(struct snd_info_entry *entry,
 
 static void snd_hdspm_proc_init(struct hdspm *hdspm)
 {
-       struct snd_info_entry *entry;
+       void (*read)(struct snd_info_entry *, struct snd_info_buffer *) = NULL;
 
-       if (!snd_card_proc_new(hdspm->card, "hdspm", &entry)) {
-               switch (hdspm->io_type) {
-               case AES32:
-                       snd_info_set_text_ops(entry, hdspm,
-                                       snd_hdspm_proc_read_aes32);
-                       break;
-               case MADI:
-                       snd_info_set_text_ops(entry, hdspm,
-                                       snd_hdspm_proc_read_madi);
-                       break;
-               case MADIface:
-                       /* snd_info_set_text_ops(entry, hdspm,
-                        snd_hdspm_proc_read_madiface); */
-                       break;
-               case RayDAT:
-                       snd_info_set_text_ops(entry, hdspm,
-                                       snd_hdspm_proc_read_raydat);
-                       break;
-               case AIO:
-                       break;
-               }
-       }
-
-       if (!snd_card_proc_new(hdspm->card, "ports.in", &entry)) {
-               snd_info_set_text_ops(entry, hdspm, snd_hdspm_proc_ports_in);
+       switch (hdspm->io_type) {
+       case AES32:
+               read = snd_hdspm_proc_read_aes32;
+               break;
+       case MADI:
+               read = snd_hdspm_proc_read_madi;
+               break;
+       case MADIface:
+               /* read = snd_hdspm_proc_read_madiface; */
+               break;
+       case RayDAT:
+               read = snd_hdspm_proc_read_raydat;
+               break;
+       case AIO:
+               break;
        }
 
-       if (!snd_card_proc_new(hdspm->card, "ports.out", &entry)) {
-               snd_info_set_text_ops(entry, hdspm, snd_hdspm_proc_ports_out);
-       }
+       snd_card_ro_proc_new(hdspm->card, "hdspm", hdspm, read);
+       snd_card_ro_proc_new(hdspm->card, "ports.in", hdspm,
+                            snd_hdspm_proc_ports_in);
+       snd_card_ro_proc_new(hdspm->card, "ports.out", hdspm,
+                            snd_hdspm_proc_ports_out);
 
 #ifdef CONFIG_SND_DEBUG
        /* debug file to read all hdspm registers */
-       if (!snd_card_proc_new(hdspm->card, "debug", &entry))
-               snd_info_set_text_ops(entry, hdspm,
-                               snd_hdspm_proc_read_debug);
+       snd_card_ro_proc_new(hdspm->card, "debug", hdspm,
+                            snd_hdspm_proc_read_debug);
 #endif
 }
 
index edd765e2237707ea468455723d542eb74e97bf0f..5228b982da5a80e3657426315c0190996f7df66d 100644 (file)
@@ -1737,10 +1737,8 @@ snd_rme9652_proc_read(struct snd_info_entry *entry, struct snd_info_buffer *buff
 
 static void snd_rme9652_proc_init(struct snd_rme9652 *rme9652)
 {
-       struct snd_info_entry *entry;
-
-       if (! snd_card_proc_new(rme9652->card, "rme9652", &entry))
-               snd_info_set_text_ops(entry, rme9652, snd_rme9652_proc_read);
+       snd_card_ro_proc_new(rme9652->card, "rme9652", rme9652,
+                            snd_rme9652_proc_read);
 }
 
 static void snd_rme9652_free_buffers(struct snd_rme9652 *rme9652)
index 7218f38b59dbb999fc0f3034f086a2285edd26b6..71d5ad3cffd610840a02a737cd4b56dd2510f1a8 100644 (file)
@@ -1171,10 +1171,8 @@ static void snd_sonicvibes_proc_read(struct snd_info_entry *entry,
 
 static void snd_sonicvibes_proc_init(struct sonicvibes *sonic)
 {
-       struct snd_info_entry *entry;
-
-       if (! snd_card_proc_new(sonic->card, "sonicvibes", &entry))
-               snd_info_set_text_ops(entry, sonic, snd_sonicvibes_proc_read);
+       snd_card_ro_proc_new(sonic->card, "sonicvibes", sonic,
+                            snd_sonicvibes_proc_read);
 }
 
 /*
index f271ea436cff3662be60e08581a37064690eeeae..0ff32d3f5d3b01212f6e05a86ace0e507cac66ee 100644 (file)
@@ -3320,13 +3320,11 @@ static void snd_trident_proc_read(struct snd_info_entry *entry,
 
 static void snd_trident_proc_init(struct snd_trident *trident)
 {
-       struct snd_info_entry *entry;
        const char *s = "trident";
        
        if (trident->device == TRIDENT_DEVICE_ID_SI7018)
                s = "sis7018";
-       if (! snd_card_proc_new(trident->card, s, &entry))
-               snd_info_set_text_ops(entry, trident, snd_trident_proc_read);
+       snd_card_ro_proc_new(trident->card, s, trident, snd_trident_proc_read);
 }
 
 static int snd_trident_dev_free(struct snd_device *device)
index 736ac79901b3f86589b63c6bfa12305084270d15..dee1c487d6bad2547c8cc38442c7cef2971766d5 100644 (file)
@@ -2144,10 +2144,8 @@ static void snd_via82xx_proc_read(struct snd_info_entry *entry,
 
 static void snd_via82xx_proc_init(struct via82xx *chip)
 {
-       struct snd_info_entry *entry;
-
-       if (! snd_card_proc_new(chip->card, "via82xx", &entry))
-               snd_info_set_text_ops(entry, chip, snd_via82xx_proc_read);
+       snd_card_ro_proc_new(chip->card, "via82xx", chip,
+                            snd_via82xx_proc_read);
 }
 
 /*
index 3f59e02790582e00109ca87c03fb7a2590c24b87..848bf9dbf8cd88ad80dc9aeb76a9c643ed93d3dd 100644 (file)
@@ -937,10 +937,8 @@ static void snd_via82xx_proc_read(struct snd_info_entry *entry, struct snd_info_
 
 static void snd_via82xx_proc_init(struct via82xx_modem *chip)
 {
-       struct snd_info_entry *entry;
-
-       if (! snd_card_proc_new(chip->card, "via82xx", &entry))
-               snd_info_set_text_ops(entry, chip, snd_via82xx_proc_read);
+       snd_card_ro_proc_new(chip->card, "via82xx", chip,
+                            snd_via82xx_proc_read);
 }
 
 /*
index c688b7f481da9a4d205a25069126ce52ab06a44b..4d48877f211f218aed59df25b914f76e93f92f09 100644 (file)
@@ -1985,11 +1985,7 @@ static void snd_ymfpci_proc_read(struct snd_info_entry *entry,
 
 static int snd_ymfpci_proc_init(struct snd_card *card, struct snd_ymfpci *chip)
 {
-       struct snd_info_entry *entry;
-       
-       if (! snd_card_proc_new(card, "ymfpci", &entry))
-               snd_info_set_text_ops(entry, chip, snd_ymfpci_proc_read);
-       return 0;
+       return snd_card_ro_proc_new(card, "ymfpci", chip, snd_ymfpci_proc_read);
 }
 
 /*