diff options
author | Takashi Iwai <tiwai@suse.de> | 2019-02-05 10:46:27 -0500 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2019-02-06 12:11:59 -0500 |
commit | 0b2338a9bf36b5ac6ed43425e2f1357fb3d3841b (patch) | |
tree | de7250a74b8b308c4cd6527ce51e74f7214cacba /sound/pci | |
parent | 29b2625ff605394ecd0b078e0cb67a151bb4d80c (diff) |
ALSA: cs46xx: Clean up proc file creations
Again no functional changes, but only code clean up.
Use a standard macro for initializing the procfs entries, also drop
the info entries stored in dsp_spos_instance, as they are removed
recursively by a single snd_info_free_entry() calls.
Reviewed-by: Jaroslav Kysela <perex@perex.cz>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci')
-rw-r--r-- | sound/pci/cs46xx/cs46xx_dsp_spos.h | 6 | ||||
-rw-r--r-- | sound/pci/cs46xx/dsp_spos.c | 87 | ||||
-rw-r--r-- | sound/pci/cs46xx/dsp_spos_scb_lib.c | 13 |
3 files changed, 33 insertions, 73 deletions
diff --git a/sound/pci/cs46xx/cs46xx_dsp_spos.h b/sound/pci/cs46xx/cs46xx_dsp_spos.h index 8008c59288a6..a02e1e19c021 100644 --- a/sound/pci/cs46xx/cs46xx_dsp_spos.h +++ b/sound/pci/cs46xx/cs46xx_dsp_spos.h | |||
@@ -177,22 +177,16 @@ struct dsp_spos_instance { | |||
177 | /* proc fs */ | 177 | /* proc fs */ |
178 | struct snd_card *snd_card; | 178 | struct snd_card *snd_card; |
179 | struct snd_info_entry * proc_dsp_dir; | 179 | struct snd_info_entry * proc_dsp_dir; |
180 | struct snd_info_entry * proc_sym_info_entry; | ||
181 | struct snd_info_entry * proc_modules_info_entry; | ||
182 | struct snd_info_entry * proc_parameter_dump_info_entry; | ||
183 | struct snd_info_entry * proc_sample_dump_info_entry; | ||
184 | 180 | ||
185 | /* SCB's descriptors */ | 181 | /* SCB's descriptors */ |
186 | int nscb; | 182 | int nscb; |
187 | int scb_highest_frag_index; | 183 | int scb_highest_frag_index; |
188 | struct dsp_scb_descriptor scbs[DSP_MAX_SCB_DESC]; | 184 | struct dsp_scb_descriptor scbs[DSP_MAX_SCB_DESC]; |
189 | struct snd_info_entry * proc_scb_info_entry; | ||
190 | struct dsp_scb_descriptor * the_null_scb; | 185 | struct dsp_scb_descriptor * the_null_scb; |
191 | 186 | ||
192 | /* Task's descriptors */ | 187 | /* Task's descriptors */ |
193 | int ntask; | 188 | int ntask; |
194 | struct dsp_task_descriptor tasks[DSP_MAX_TASK_DESC]; | 189 | struct dsp_task_descriptor tasks[DSP_MAX_TASK_DESC]; |
195 | struct snd_info_entry * proc_task_info_entry; | ||
196 | 190 | ||
197 | /* SPDIF status */ | 191 | /* SPDIF status */ |
198 | int spdif_status_out; | 192 | int spdif_status_out; |
diff --git a/sound/pci/cs46xx/dsp_spos.c b/sound/pci/cs46xx/dsp_spos.c index 3555f839371e..c28e58602679 100644 --- a/sound/pci/cs46xx/dsp_spos.c +++ b/sound/pci/cs46xx/dsp_spos.c | |||
@@ -809,52 +809,39 @@ int cs46xx_dsp_proc_init (struct snd_card *card, struct snd_cs46xx *chip) | |||
809 | 809 | ||
810 | entry = snd_info_create_card_entry(card, "spos_symbols", | 810 | entry = snd_info_create_card_entry(card, "spos_symbols", |
811 | ins->proc_dsp_dir); | 811 | ins->proc_dsp_dir); |
812 | if (entry) { | 812 | if (entry) |
813 | entry->private_data = chip; | 813 | snd_info_set_text_ops(entry, chip, |
814 | entry->mode = S_IFREG | 0644; | 814 | cs46xx_dsp_proc_symbol_table_read); |
815 | entry->c.text.read = cs46xx_dsp_proc_symbol_table_read; | ||
816 | } | ||
817 | ins->proc_sym_info_entry = entry; | ||
818 | 815 | ||
819 | if ((entry = snd_info_create_card_entry(card, "spos_modules", ins->proc_dsp_dir)) != NULL) { | 816 | entry = snd_info_create_card_entry(card, "spos_modules", |
820 | entry->content = SNDRV_INFO_CONTENT_TEXT; | 817 | ins->proc_dsp_dir); |
821 | entry->private_data = chip; | 818 | if (entry) |
822 | entry->mode = S_IFREG | 0644; | 819 | snd_info_set_text_ops(entry, chip, |
823 | entry->c.text.read = cs46xx_dsp_proc_modules_read; | 820 | cs46xx_dsp_proc_modules_read); |
824 | } | ||
825 | ins->proc_modules_info_entry = entry; | ||
826 | 821 | ||
827 | if ((entry = snd_info_create_card_entry(card, "parameter", ins->proc_dsp_dir)) != NULL) { | 822 | entry = snd_info_create_card_entry(card, "parameter", |
828 | entry->content = SNDRV_INFO_CONTENT_TEXT; | 823 | ins->proc_dsp_dir); |
829 | entry->private_data = chip; | 824 | if (entry) |
830 | entry->mode = S_IFREG | 0644; | 825 | snd_info_set_text_ops(entry, chip, |
831 | entry->c.text.read = cs46xx_dsp_proc_parameter_dump_read; | 826 | cs46xx_dsp_proc_parameter_dump_read); |
832 | } | ||
833 | ins->proc_parameter_dump_info_entry = entry; | ||
834 | 827 | ||
835 | if ((entry = snd_info_create_card_entry(card, "sample", ins->proc_dsp_dir)) != NULL) { | 828 | entry = snd_info_create_card_entry(card, "sample", |
836 | entry->content = SNDRV_INFO_CONTENT_TEXT; | 829 | ins->proc_dsp_dir); |
837 | entry->private_data = chip; | 830 | if (entry) |
838 | entry->mode = S_IFREG | 0644; | 831 | snd_info_set_text_ops(entry, chip, |
839 | entry->c.text.read = cs46xx_dsp_proc_sample_dump_read; | 832 | cs46xx_dsp_proc_sample_dump_read); |
840 | } | ||
841 | ins->proc_sample_dump_info_entry = entry; | ||
842 | 833 | ||
843 | if ((entry = snd_info_create_card_entry(card, "task_tree", ins->proc_dsp_dir)) != NULL) { | 834 | entry = snd_info_create_card_entry(card, "task_tree", |
844 | entry->content = SNDRV_INFO_CONTENT_TEXT; | 835 | ins->proc_dsp_dir); |
845 | entry->private_data = chip; | 836 | if (entry) |
846 | entry->mode = S_IFREG | 0644; | 837 | snd_info_set_text_ops(entry, chip, |
847 | entry->c.text.read = cs46xx_dsp_proc_task_tree_read; | 838 | cs46xx_dsp_proc_task_tree_read); |
848 | } | ||
849 | ins->proc_task_info_entry = entry; | ||
850 | 839 | ||
851 | if ((entry = snd_info_create_card_entry(card, "scb_info", ins->proc_dsp_dir)) != NULL) { | 840 | entry = snd_info_create_card_entry(card, "scb_info", |
852 | entry->content = SNDRV_INFO_CONTENT_TEXT; | 841 | ins->proc_dsp_dir); |
853 | entry->private_data = chip; | 842 | if (entry) |
854 | entry->mode = S_IFREG | 0644; | 843 | snd_info_set_text_ops(entry, chip, |
855 | entry->c.text.read = cs46xx_dsp_proc_scb_read; | 844 | cs46xx_dsp_proc_scb_read); |
856 | } | ||
857 | ins->proc_scb_info_entry = entry; | ||
858 | 845 | ||
859 | mutex_lock(&chip->spos_mutex); | 846 | mutex_lock(&chip->spos_mutex); |
860 | /* register/update SCB's entries on proc */ | 847 | /* register/update SCB's entries on proc */ |
@@ -876,24 +863,6 @@ int cs46xx_dsp_proc_done (struct snd_cs46xx *chip) | |||
876 | if (!ins) | 863 | if (!ins) |
877 | return 0; | 864 | return 0; |
878 | 865 | ||
879 | snd_info_free_entry(ins->proc_sym_info_entry); | ||
880 | ins->proc_sym_info_entry = NULL; | ||
881 | |||
882 | snd_info_free_entry(ins->proc_modules_info_entry); | ||
883 | ins->proc_modules_info_entry = NULL; | ||
884 | |||
885 | snd_info_free_entry(ins->proc_parameter_dump_info_entry); | ||
886 | ins->proc_parameter_dump_info_entry = NULL; | ||
887 | |||
888 | snd_info_free_entry(ins->proc_sample_dump_info_entry); | ||
889 | ins->proc_sample_dump_info_entry = NULL; | ||
890 | |||
891 | snd_info_free_entry(ins->proc_scb_info_entry); | ||
892 | ins->proc_scb_info_entry = NULL; | ||
893 | |||
894 | snd_info_free_entry(ins->proc_task_info_entry); | ||
895 | ins->proc_task_info_entry = NULL; | ||
896 | |||
897 | mutex_lock(&chip->spos_mutex); | 866 | mutex_lock(&chip->spos_mutex); |
898 | for (i = 0; i < ins->nscb; ++i) { | 867 | for (i = 0; i < ins->nscb; ++i) { |
899 | if (ins->scbs[i].deleted) continue; | 868 | if (ins->scbs[i].deleted) continue; |
diff --git a/sound/pci/cs46xx/dsp_spos_scb_lib.c b/sound/pci/cs46xx/dsp_spos_scb_lib.c index e056f9dc228b..1d9d610262de 100644 --- a/sound/pci/cs46xx/dsp_spos_scb_lib.c +++ b/sound/pci/cs46xx/dsp_spos_scb_lib.c | |||
@@ -254,8 +254,9 @@ void cs46xx_dsp_proc_register_scb_desc (struct snd_cs46xx *chip, | |||
254 | if (ins->snd_card != NULL && ins->proc_dsp_dir != NULL && | 254 | if (ins->snd_card != NULL && ins->proc_dsp_dir != NULL && |
255 | scb->proc_info == NULL) { | 255 | scb->proc_info == NULL) { |
256 | 256 | ||
257 | if ((entry = snd_info_create_card_entry(ins->snd_card, scb->scb_name, | 257 | entry = snd_info_create_card_entry(ins->snd_card, scb->scb_name, |
258 | ins->proc_dsp_dir)) != NULL) { | 258 | ins->proc_dsp_dir); |
259 | if (entry) { | ||
259 | scb_info = kmalloc(sizeof(struct proc_scb_info), GFP_KERNEL); | 260 | scb_info = kmalloc(sizeof(struct proc_scb_info), GFP_KERNEL); |
260 | if (!scb_info) { | 261 | if (!scb_info) { |
261 | snd_info_free_entry(entry); | 262 | snd_info_free_entry(entry); |
@@ -265,12 +266,8 @@ void cs46xx_dsp_proc_register_scb_desc (struct snd_cs46xx *chip, | |||
265 | 266 | ||
266 | scb_info->chip = chip; | 267 | scb_info->chip = chip; |
267 | scb_info->scb_desc = scb; | 268 | scb_info->scb_desc = scb; |
268 | 269 | snd_info_set_text_ops(entry, scb_info, | |
269 | entry->content = SNDRV_INFO_CONTENT_TEXT; | 270 | cs46xx_dsp_proc_scb_info_read); |
270 | entry->private_data = scb_info; | ||
271 | entry->mode = S_IFREG | 0644; | ||
272 | |||
273 | entry->c.text.read = cs46xx_dsp_proc_scb_info_read; | ||
274 | } | 271 | } |
275 | out: | 272 | out: |
276 | scb->proc_info = entry; | 273 | scb->proc_info = entry; |