From: Takashi Iwai Date: Mon, 4 Feb 2019 15:05:21 +0000 (+0100) Subject: ALSA: pci: Remove superfluous snd_info_register() calls X-Git-Tag: v5.4-rc1~1151^2~84 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=eaffef0d5fca38939ac986de4625f4f070c49346;p=platform%2Fkernel%2Flinux-rpi.git ALSA: pci: Remove superfluous snd_info_register() calls The calls of snd_info_register() are superfluous and should be avoided at the procfs creation time. They are called at the end of the whole initialization via snd_card_register(). This patch drops such superfluous calls, as well as dropping the superfluous setup of SNDRV_INFO_CONTENT_TEXT. Reviewed-by: Jaroslav Kysela Signed-off-by: Takashi Iwai --- diff --git a/sound/pci/ac97/ac97_proc.c b/sound/pci/ac97/ac97_proc.c index e120a11..20516b6 100644 --- a/sound/pci/ac97/ac97_proc.c +++ b/sound/pci/ac97/ac97_proc.c @@ -436,25 +436,20 @@ void snd_ac97_proc_init(struct snd_ac97 * ac97) return; prefix = ac97_is_audio(ac97) ? "ac97" : "mc97"; sprintf(name, "%s#%d-%d", prefix, ac97->addr, ac97->num); - if ((entry = snd_info_create_card_entry(ac97->bus->card, name, ac97->bus->proc)) != NULL) { + entry = snd_info_create_card_entry(ac97->bus->card, name, + ac97->bus->proc); + if (entry) snd_info_set_text_ops(entry, ac97, snd_ac97_proc_read); - if (snd_info_register(entry) < 0) { - snd_info_free_entry(entry); - entry = NULL; - } - } ac97->proc = entry; sprintf(name, "%s#%d-%d+regs", prefix, ac97->addr, ac97->num); - if ((entry = snd_info_create_card_entry(ac97->bus->card, name, ac97->bus->proc)) != NULL) { + entry = snd_info_create_card_entry(ac97->bus->card, name, + ac97->bus->proc); + if (entry) { snd_info_set_text_ops(entry, ac97, snd_ac97_proc_regs_read); #ifdef CONFIG_SND_DEBUG entry->mode |= 0200; entry->c.text.write = snd_ac97_proc_regs_write; #endif - if (snd_info_register(entry) < 0) { - snd_info_free_entry(entry); - entry = NULL; - } } ac97->proc_regs = entry; } @@ -473,13 +468,10 @@ void snd_ac97_bus_proc_init(struct snd_ac97_bus * bus) char name[32]; sprintf(name, "codec97#%d", bus->num); - if ((entry = snd_info_create_card_entry(bus->card, name, bus->card->proc_root)) != NULL) { + entry = snd_info_create_card_entry(bus->card, name, + bus->card->proc_root); + if (entry) entry->mode = S_IFDIR | 0555; - if (snd_info_register(entry) < 0) { - snd_info_free_entry(entry); - entry = NULL; - } - } bus->proc = entry; } diff --git a/sound/pci/cs46xx/dsp_spos.c b/sound/pci/cs46xx/dsp_spos.c index 5fc497c..3555f83 100644 --- a/sound/pci/cs46xx/dsp_spos.c +++ b/sound/pci/cs46xx/dsp_spos.c @@ -799,30 +799,20 @@ int cs46xx_dsp_proc_init (struct snd_card *card, struct snd_cs46xx *chip) ins->snd_card = card; - if ((entry = snd_info_create_card_entry(card, "dsp", card->proc_root)) != NULL) { - entry->content = SNDRV_INFO_CONTENT_TEXT; + entry = snd_info_create_card_entry(card, "dsp", card->proc_root); + if (entry) entry->mode = S_IFDIR | 0555; - - if (snd_info_register(entry) < 0) { - snd_info_free_entry(entry); - entry = NULL; - } - } - ins->proc_dsp_dir = entry; if (!ins->proc_dsp_dir) return -ENOMEM; - if ((entry = snd_info_create_card_entry(card, "spos_symbols", ins->proc_dsp_dir)) != NULL) { - entry->content = SNDRV_INFO_CONTENT_TEXT; + entry = snd_info_create_card_entry(card, "spos_symbols", + ins->proc_dsp_dir); + if (entry) { entry->private_data = chip; entry->mode = S_IFREG | 0644; entry->c.text.read = cs46xx_dsp_proc_symbol_table_read; - if (snd_info_register(entry) < 0) { - snd_info_free_entry(entry); - entry = NULL; - } } ins->proc_sym_info_entry = entry; @@ -831,10 +821,6 @@ int cs46xx_dsp_proc_init (struct snd_card *card, struct snd_cs46xx *chip) entry->private_data = chip; entry->mode = S_IFREG | 0644; entry->c.text.read = cs46xx_dsp_proc_modules_read; - if (snd_info_register(entry) < 0) { - snd_info_free_entry(entry); - entry = NULL; - } } ins->proc_modules_info_entry = entry; @@ -843,10 +829,6 @@ int cs46xx_dsp_proc_init (struct snd_card *card, struct snd_cs46xx *chip) entry->private_data = chip; entry->mode = S_IFREG | 0644; entry->c.text.read = cs46xx_dsp_proc_parameter_dump_read; - if (snd_info_register(entry) < 0) { - snd_info_free_entry(entry); - entry = NULL; - } } ins->proc_parameter_dump_info_entry = entry; @@ -855,10 +837,6 @@ int cs46xx_dsp_proc_init (struct snd_card *card, struct snd_cs46xx *chip) entry->private_data = chip; entry->mode = S_IFREG | 0644; entry->c.text.read = cs46xx_dsp_proc_sample_dump_read; - if (snd_info_register(entry) < 0) { - snd_info_free_entry(entry); - entry = NULL; - } } ins->proc_sample_dump_info_entry = entry; @@ -867,10 +845,6 @@ int cs46xx_dsp_proc_init (struct snd_card *card, struct snd_cs46xx *chip) entry->private_data = chip; entry->mode = S_IFREG | 0644; entry->c.text.read = cs46xx_dsp_proc_task_tree_read; - if (snd_info_register(entry) < 0) { - snd_info_free_entry(entry); - entry = NULL; - } } ins->proc_task_info_entry = entry; @@ -879,10 +853,6 @@ int cs46xx_dsp_proc_init (struct snd_card *card, struct snd_cs46xx *chip) entry->private_data = chip; entry->mode = S_IFREG | 0644; entry->c.text.read = cs46xx_dsp_proc_scb_read; - if (snd_info_register(entry) < 0) { - snd_info_free_entry(entry); - entry = NULL; - } } ins->proc_scb_info_entry = entry; diff --git a/sound/pci/cs46xx/dsp_spos_scb_lib.c b/sound/pci/cs46xx/dsp_spos_scb_lib.c index 8d0a3d3..e056f9d 100644 --- a/sound/pci/cs46xx/dsp_spos_scb_lib.c +++ b/sound/pci/cs46xx/dsp_spos_scb_lib.c @@ -271,12 +271,6 @@ void cs46xx_dsp_proc_register_scb_desc (struct snd_cs46xx *chip, entry->mode = S_IFREG | 0644; entry->c.text.read = cs46xx_dsp_proc_scb_info_read; - - if (snd_info_register(entry) < 0) { - snd_info_free_entry(entry); - kfree (scb_info); - entry = NULL; - } } out: scb->proc_info = entry;