Commit 0b2338a9 authored by Takashi Iwai's avatar Takashi Iwai

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: default avatarJaroslav Kysela <perex@perex.cz>
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent 29b2625f
...@@ -177,22 +177,16 @@ struct dsp_spos_instance { ...@@ -177,22 +177,16 @@ struct dsp_spos_instance {
/* proc fs */ /* proc fs */
struct snd_card *snd_card; struct snd_card *snd_card;
struct snd_info_entry * proc_dsp_dir; struct snd_info_entry * proc_dsp_dir;
struct snd_info_entry * proc_sym_info_entry;
struct snd_info_entry * proc_modules_info_entry;
struct snd_info_entry * proc_parameter_dump_info_entry;
struct snd_info_entry * proc_sample_dump_info_entry;
/* SCB's descriptors */ /* SCB's descriptors */
int nscb; int nscb;
int scb_highest_frag_index; int scb_highest_frag_index;
struct dsp_scb_descriptor scbs[DSP_MAX_SCB_DESC]; struct dsp_scb_descriptor scbs[DSP_MAX_SCB_DESC];
struct snd_info_entry * proc_scb_info_entry;
struct dsp_scb_descriptor * the_null_scb; struct dsp_scb_descriptor * the_null_scb;
/* Task's descriptors */ /* Task's descriptors */
int ntask; int ntask;
struct dsp_task_descriptor tasks[DSP_MAX_TASK_DESC]; struct dsp_task_descriptor tasks[DSP_MAX_TASK_DESC];
struct snd_info_entry * proc_task_info_entry;
/* SPDIF status */ /* SPDIF status */
int spdif_status_out; int spdif_status_out;
......
...@@ -809,52 +809,39 @@ int cs46xx_dsp_proc_init (struct snd_card *card, struct snd_cs46xx *chip) ...@@ -809,52 +809,39 @@ int cs46xx_dsp_proc_init (struct snd_card *card, struct snd_cs46xx *chip)
entry = snd_info_create_card_entry(card, "spos_symbols", entry = snd_info_create_card_entry(card, "spos_symbols",
ins->proc_dsp_dir); ins->proc_dsp_dir);
if (entry) { if (entry)
entry->private_data = chip; snd_info_set_text_ops(entry, chip,
entry->mode = S_IFREG | 0644; cs46xx_dsp_proc_symbol_table_read);
entry->c.text.read = cs46xx_dsp_proc_symbol_table_read;
}
ins->proc_sym_info_entry = entry;
if ((entry = snd_info_create_card_entry(card, "spos_modules", ins->proc_dsp_dir)) != NULL) { entry = snd_info_create_card_entry(card, "spos_modules",
entry->content = SNDRV_INFO_CONTENT_TEXT; ins->proc_dsp_dir);
entry->private_data = chip; if (entry)
entry->mode = S_IFREG | 0644; snd_info_set_text_ops(entry, chip,
entry->c.text.read = cs46xx_dsp_proc_modules_read; cs46xx_dsp_proc_modules_read);
}
ins->proc_modules_info_entry = entry;
if ((entry = snd_info_create_card_entry(card, "parameter", ins->proc_dsp_dir)) != NULL) { entry = snd_info_create_card_entry(card, "parameter",
entry->content = SNDRV_INFO_CONTENT_TEXT; ins->proc_dsp_dir);
entry->private_data = chip; if (entry)
entry->mode = S_IFREG | 0644; snd_info_set_text_ops(entry, chip,
entry->c.text.read = cs46xx_dsp_proc_parameter_dump_read; cs46xx_dsp_proc_parameter_dump_read);
}
ins->proc_parameter_dump_info_entry = entry;
if ((entry = snd_info_create_card_entry(card, "sample", ins->proc_dsp_dir)) != NULL) { entry = snd_info_create_card_entry(card, "sample",
entry->content = SNDRV_INFO_CONTENT_TEXT; ins->proc_dsp_dir);
entry->private_data = chip; if (entry)
entry->mode = S_IFREG | 0644; snd_info_set_text_ops(entry, chip,
entry->c.text.read = cs46xx_dsp_proc_sample_dump_read; cs46xx_dsp_proc_sample_dump_read);
}
ins->proc_sample_dump_info_entry = entry;
if ((entry = snd_info_create_card_entry(card, "task_tree", ins->proc_dsp_dir)) != NULL) { entry = snd_info_create_card_entry(card, "task_tree",
entry->content = SNDRV_INFO_CONTENT_TEXT; ins->proc_dsp_dir);
entry->private_data = chip; if (entry)
entry->mode = S_IFREG | 0644; snd_info_set_text_ops(entry, chip,
entry->c.text.read = cs46xx_dsp_proc_task_tree_read; cs46xx_dsp_proc_task_tree_read);
}
ins->proc_task_info_entry = entry;
if ((entry = snd_info_create_card_entry(card, "scb_info", ins->proc_dsp_dir)) != NULL) { entry = snd_info_create_card_entry(card, "scb_info",
entry->content = SNDRV_INFO_CONTENT_TEXT; ins->proc_dsp_dir);
entry->private_data = chip; if (entry)
entry->mode = S_IFREG | 0644; snd_info_set_text_ops(entry, chip,
entry->c.text.read = cs46xx_dsp_proc_scb_read; cs46xx_dsp_proc_scb_read);
}
ins->proc_scb_info_entry = entry;
mutex_lock(&chip->spos_mutex); mutex_lock(&chip->spos_mutex);
/* register/update SCB's entries on proc */ /* register/update SCB's entries on proc */
...@@ -876,24 +863,6 @@ int cs46xx_dsp_proc_done (struct snd_cs46xx *chip) ...@@ -876,24 +863,6 @@ int cs46xx_dsp_proc_done (struct snd_cs46xx *chip)
if (!ins) if (!ins)
return 0; return 0;
snd_info_free_entry(ins->proc_sym_info_entry);
ins->proc_sym_info_entry = NULL;
snd_info_free_entry(ins->proc_modules_info_entry);
ins->proc_modules_info_entry = NULL;
snd_info_free_entry(ins->proc_parameter_dump_info_entry);
ins->proc_parameter_dump_info_entry = NULL;
snd_info_free_entry(ins->proc_sample_dump_info_entry);
ins->proc_sample_dump_info_entry = NULL;
snd_info_free_entry(ins->proc_scb_info_entry);
ins->proc_scb_info_entry = NULL;
snd_info_free_entry(ins->proc_task_info_entry);
ins->proc_task_info_entry = NULL;
mutex_lock(&chip->spos_mutex); mutex_lock(&chip->spos_mutex);
for (i = 0; i < ins->nscb; ++i) { for (i = 0; i < ins->nscb; ++i) {
if (ins->scbs[i].deleted) continue; if (ins->scbs[i].deleted) continue;
......
...@@ -254,8 +254,9 @@ void cs46xx_dsp_proc_register_scb_desc (struct snd_cs46xx *chip, ...@@ -254,8 +254,9 @@ void cs46xx_dsp_proc_register_scb_desc (struct snd_cs46xx *chip,
if (ins->snd_card != NULL && ins->proc_dsp_dir != NULL && if (ins->snd_card != NULL && ins->proc_dsp_dir != NULL &&
scb->proc_info == NULL) { scb->proc_info == NULL) {
if ((entry = snd_info_create_card_entry(ins->snd_card, scb->scb_name, entry = snd_info_create_card_entry(ins->snd_card, scb->scb_name,
ins->proc_dsp_dir)) != NULL) { ins->proc_dsp_dir);
if (entry) {
scb_info = kmalloc(sizeof(struct proc_scb_info), GFP_KERNEL); scb_info = kmalloc(sizeof(struct proc_scb_info), GFP_KERNEL);
if (!scb_info) { if (!scb_info) {
snd_info_free_entry(entry); snd_info_free_entry(entry);
...@@ -265,12 +266,8 @@ void cs46xx_dsp_proc_register_scb_desc (struct snd_cs46xx *chip, ...@@ -265,12 +266,8 @@ void cs46xx_dsp_proc_register_scb_desc (struct snd_cs46xx *chip,
scb_info->chip = chip; scb_info->chip = chip;
scb_info->scb_desc = scb; scb_info->scb_desc = scb;
snd_info_set_text_ops(entry, scb_info,
entry->content = SNDRV_INFO_CONTENT_TEXT; cs46xx_dsp_proc_scb_info_read);
entry->private_data = scb_info;
entry->mode = S_IFREG | 0644;
entry->c.text.read = cs46xx_dsp_proc_scb_info_read;
} }
out: out:
scb->proc_info = entry; scb->proc_info = entry;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment