Skip to contentSkip to conversation

ALSA: Remove superfluous snd_info_register() calls

PATCH In review Takashi Iwai 3 participants 7 messages Feb 5, 2019 – Feb 6, 2019

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

cover ALSA: Remove superfluous snd_info_register() calls

Hi,

this is a fallout of the previous patchset, covering more places that call snd_info_register() unnecessarily. These should be applied on top of my previous patchset.

The complete patches are found in topic/proc-fixes branch of sound git tree.

thanks,

Takashi

===

Takashi Iwai (3):
ALSA: firewire: Remove superfluous snd_info_register() calls
ALSA: opl4: Remove superfluous snd_info_register() calls
ALSA: emux: Remove superfluous snd_info_register() calls

 sound/drivers/opl4/opl4_proc.c            |  4 ----
 sound/firewire/bebob/bebob_proc.c         | 12 ++----------
 sound/firewire/dice/dice-proc.c           | 12 ++----------
 sound/firewire/digi00x/digi00x-proc.c     | 16 ++--------------
 sound/firewire/fireface/ff-proc.c         | 12 ++----------
 sound/firewire/fireworks/fireworks_proc.c | 12 ++----------
 sound/firewire/motu/motu-proc.c           | 12 ++----------
 sound/firewire/oxfw/oxfw-proc.c           | 12 ++----------
 sound/firewire/tascam/tascam-proc.c       | 12 ++----------
 sound/synth/emux/emux_proc.c              |  4 ----
 10 files changed, 16 insertions(+), 92 deletions(-)
Signature · 1 line
2.16.4
#1 lore raw

PATCH 1/3 ALSA: firewire: 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.

---
 sound/firewire/bebob/bebob_proc.c         | 12 ++----------
 sound/firewire/dice/dice-proc.c           | 12 ++----------
 sound/firewire/digi00x/digi00x-proc.c     | 16 ++--------------
 sound/firewire/fireface/ff-proc.c         | 12 ++----------
 sound/firewire/fireworks/fireworks_proc.c | 12 ++----------
 sound/firewire/motu/motu-proc.c           | 12 ++----------
 sound/firewire/oxfw/oxfw-proc.c           | 12 ++----------
 sound/firewire/tascam/tascam-proc.c       | 12 ++----------
 8 files changed, 16 insertions(+), 84 deletions(-)
sound/firewire/bebob/bebob_proc.c +2 -10
index 8096891af913..05e2a1c6326c 100644
@@ -163,12 +163,8 @@ add_node(struct snd_bebob *bebob, struct snd_info_entry *root, const char *name,
 	struct snd_info_entry *entry;
 
 	entry = snd_info_create_card_entry(bebob->card, name, root);
-	if (entry == NULL)
-		return;
-
-	snd_info_set_text_ops(entry, bebob, op);
-	if (snd_info_register(entry) < 0)
-		snd_info_free_entry(entry);
+	if (entry)
+		snd_info_set_text_ops(entry, bebob, op);
 }
 
 void snd_bebob_proc_init(struct snd_bebob *bebob)
@@ -184,10 +180,6 @@ void snd_bebob_proc_init(struct snd_bebob *bebob)
 	if (root == NULL)
 		return;
 	root->mode = S_IFDIR | 0555;
-	if (snd_info_register(root) < 0) {
-		snd_info_free_entry(root);
-		return;
-	}
 
 	add_node(bebob, root, "clock", proc_read_clock);
 	add_node(bebob, root, "firmware", proc_read_hw_info);
sound/firewire/dice/dice-proc.c +2 -10
index bb870fc73f99..9b1d509c6320 100644
@@ -285,12 +285,8 @@ static void add_node(struct snd_dice *dice, struct snd_info_entry *root,
 	struct snd_info_entry *entry;
 
 	entry = snd_info_create_card_entry(dice->card, name, root);
-	if (!entry)
-		return;
-
-	snd_info_set_text_ops(entry, dice, op);
-	if (snd_info_register(entry) < 0)
-		snd_info_free_entry(entry);
+	if (entry)
+		snd_info_set_text_ops(entry, dice, op);
 }
 
 void snd_dice_create_proc(struct snd_dice *dice)
@@ -306,10 +302,6 @@ void snd_dice_create_proc(struct snd_dice *dice)
 	if (!root)
 		return;
 	root->mode = S_IFDIR | 0555;
-	if (snd_info_register(root) < 0) {
-		snd_info_free_entry(root);
-		return;
-	}
 
 	add_node(dice, root, "dice", dice_proc_read);
 	add_node(dice, root, "formation", dice_proc_read_formation);
sound/firewire/digi00x/digi00x-proc.c +2 -14
index 6996d5a6ff5f..d22e8675b10f 100644
@@ -80,20 +80,8 @@ void snd_dg00x_proc_init(struct snd_dg00x *dg00x)
 		return;
 
 	root->mode = S_IFDIR | 0555;
-	if (snd_info_register(root) < 0) {
-		snd_info_free_entry(root);
-		return;
-	}
 
 	entry = snd_info_create_card_entry(dg00x->card, "clock", root);
-	if (entry == NULL) {
-		snd_info_free_entry(root);
-		return;
-	}
-
-	snd_info_set_text_ops(entry, dg00x, proc_read_clock);
-	if (snd_info_register(entry) < 0) {
-		snd_info_free_entry(entry);
-		snd_info_free_entry(root);
-	}
+	if (entry)
+		snd_info_set_text_ops(entry, dg00x, proc_read_clock);
 }
sound/firewire/fireface/ff-proc.c +2 -10
index a55e68ec1832..b886b541c94b 100644
@@ -41,12 +41,8 @@ static void add_node(struct snd_ff *ff, struct snd_info_entry *root,
 	struct snd_info_entry *entry;
 
 	entry = snd_info_create_card_entry(ff->card, name, root);
-	if (entry == NULL)
-		return;
-
-	snd_info_set_text_ops(entry, ff, op);
-	if (snd_info_register(entry) < 0)
-		snd_info_free_entry(entry);
+	if (entry)
+		snd_info_set_text_ops(entry, ff, op);
 }
 
 void snd_ff_proc_init(struct snd_ff *ff)
@@ -62,10 +58,6 @@ void snd_ff_proc_init(struct snd_ff *ff)
 	if (root == NULL)
 		return;
 	root->mode = S_IFDIR | 0555;
-	if (snd_info_register(root) < 0) {
-		snd_info_free_entry(root);
-		return;
-	}
 
 	add_node(ff, root, "status", proc_dump_status);
 }
sound/firewire/fireworks/fireworks_proc.c +2 -10
index 779ecec5af62..9fa5c34a9572 100644
@@ -199,12 +199,8 @@ add_node(struct snd_efw *efw, struct snd_info_entry *root, const char *name,
 	struct snd_info_entry *entry;
 
 	entry = snd_info_create_card_entry(efw->card, name, root);
-	if (entry == NULL)
-		return;
-
-	snd_info_set_text_ops(entry, efw, op);
-	if (snd_info_register(entry) < 0)
-		snd_info_free_entry(entry);
+	if (entry)
+		snd_info_set_text_ops(entry, efw, op);
 }
 
 void snd_efw_proc_init(struct snd_efw *efw)
@@ -220,10 +216,6 @@ void snd_efw_proc_init(struct snd_efw *efw)
 	if (root == NULL)
 		return;
 	root->mode = S_IFDIR | 0555;
-	if (snd_info_register(root) < 0) {
-		snd_info_free_entry(root);
-		return;
-	}
 
 	add_node(efw, root, "clock", proc_read_clock);
 	add_node(efw, root, "firmware", proc_read_hwinfo);
sound/firewire/motu/motu-proc.c +2 -10
index ab6830a6d242..94327853620a 100644
@@ -87,12 +87,8 @@ static void add_node(struct snd_motu *motu, struct snd_info_entry *root,
 	struct snd_info_entry *entry;
 
 	entry = snd_info_create_card_entry(motu->card, name, root);
-	if (entry == NULL)
-		return;
-
-	snd_info_set_text_ops(entry, motu, op);
-	if (snd_info_register(entry) < 0)
-		snd_info_free_entry(entry);
+	if (entry)
+		snd_info_set_text_ops(entry, motu, op);
 }
 
 void snd_motu_proc_init(struct snd_motu *motu)
@@ -108,10 +104,6 @@ void snd_motu_proc_init(struct snd_motu *motu)
 	if (root == NULL)
 		return;
 	root->mode = S_IFDIR | 0555;
-	if (snd_info_register(root) < 0) {
-		snd_info_free_entry(root);
-		return;
-	}
 
 	add_node(motu, root, "clock", proc_read_clock);
 	add_node(motu, root, "format", proc_read_format);
sound/firewire/oxfw/oxfw-proc.c +2 -10
index 27dac071bc73..644107e3782e 100644
@@ -83,12 +83,8 @@ static void add_node(struct snd_oxfw *oxfw, struct snd_info_entry *root,
 	struct snd_info_entry *entry;
 
 	entry = snd_info_create_card_entry(oxfw->card, name, root);
-	if (entry == NULL)
-		return;
-
-	snd_info_set_text_ops(entry, oxfw, op);
-	if (snd_info_register(entry) < 0)
-		snd_info_free_entry(entry);
+	if (entry)
+		snd_info_set_text_ops(entry, oxfw, op);
 }
 
 void snd_oxfw_proc_init(struct snd_oxfw *oxfw)
@@ -104,10 +100,6 @@ void snd_oxfw_proc_init(struct snd_oxfw *oxfw)
 	if (root == NULL)
 		return;
 	root->mode = S_IFDIR | 0555;
-	if (snd_info_register(root) < 0) {
-		snd_info_free_entry(root);
-		return;
-	}
 
 	add_node(oxfw, root, "formation", proc_read_formation);
 }
sound/firewire/tascam/tascam-proc.c +2 -10
index fee3bf32a0da..8bc8d277394a 100644
@@ -58,12 +58,8 @@ static void add_node(struct snd_tscm *tscm, struct snd_info_entry *root,
 	struct snd_info_entry *entry;
 
 	entry = snd_info_create_card_entry(tscm->card, name, root);
-	if (entry == NULL)
-		return;
-
-	snd_info_set_text_ops(entry, tscm, op);
-	if (snd_info_register(entry) < 0)
-		snd_info_free_entry(entry);
+	if (entry)
+		snd_info_set_text_ops(entry, tscm, op);
 }
 
 void snd_tscm_proc_init(struct snd_tscm *tscm)
@@ -79,10 +75,6 @@ void snd_tscm_proc_init(struct snd_tscm *tscm)
 	if (root == NULL)
 		return;
 	root->mode = S_IFDIR | 0555;
-	if (snd_info_register(root) < 0) {
-		snd_info_free_entry(root);
-		return;
-	}
 
 	add_node(tscm, root, "firmware", proc_read_firmware);
 }
Signature · 1 line
2.16.4
maintainer Reviewed-by Tested-by on v1 1/3
#2 lore raw

Re: [PATCH 1/3] ALSA: firewire: Remove superfluous snd_info_register() calls

Hi,

Quoted 6 lines · Takashi Iwai

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.

Quoted 10 lines
---
 sound/firewire/bebob/bebob_proc.c         | 12 ++----------
 sound/firewire/dice/dice-proc.c           | 12 ++----------
 sound/firewire/digi00x/digi00x-proc.c     | 16 ++--------------
 sound/firewire/fireface/ff-proc.c         | 12 ++----------
 sound/firewire/fireworks/fireworks_proc.c | 12 ++----------
 sound/firewire/motu/motu-proc.c           | 12 ++----------
 sound/firewire/oxfw/oxfw-proc.c           | 12 ++----------
 sound/firewire/tascam/tascam-proc.c       | 12 ++----------
 8 files changed, 16 insertions(+), 84 deletions(-)

By the way, would I request you to sync alsa-utils repo in git.alsa-project.org to the one in github.com? 9 patches were applied to the latter, but never to the former.

Thanks

Takashi Sakamoto

maintainer
#3 lore raw

Re: [PATCH 1/3] ALSA: firewire: Remove superfluous snd_info_register() calls

Dne 6.2.2019 v 15:33 Takashi Sakamoto napsal(a):

Quoted 3 lines

By the way, would I request you to sync alsa-utils repo in git.alsa-project.org to the one in github.com? 9 patches were applied to the latter, but never to the former.

Fixed. Thanks. I don't know why the sync was not triggered from github this time. I will create a cron job.

Jaroslav

Signature · 2 lines
Jaroslav Kysela <[email protected]>
Linux Sound Maintainer; ALSA Project; Red Hat, Inc.
#4 lore raw

Re: [PATCH 1/3] ALSA: firewire: Remove superfluous snd_info_register() calls

In reply to Takashi Sakamoto
Quoted 3 lines · Takashi Sakamoto

By the way, would I request you to sync alsa-utils repo in git.alsa-project.org to the one in github.com? 9 patches were applied to the latter, but never to the former.

I thought it should have been done automatically... Jaroslav, could you take a look?

thanks,

Takashi

#5 lore raw

PATCH 2/3 ALSA: opl4: Remove superfluous snd_info_register() calls

In reply to Takashi Iwai

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.

---
 sound/drivers/opl4/opl4_proc.c | 4 ----
 1 file changed, 4 deletions(-)
sound/drivers/opl4/opl4_proc.c +0 -4
index 16b24091d799..f1b839a0e7b7 100644
@@ -114,10 +114,6 @@ int snd_opl4_create_proc(struct snd_opl4 *opl4)
 		entry->c.ops = &snd_opl4_mem_proc_ops;
 		entry->module = THIS_MODULE;
 		entry->private_data = opl4;
-		if (snd_info_register(entry) < 0) {
-			snd_info_free_entry(entry);
-			entry = NULL;
-		}
 	}
 	opl4->proc_entry = entry;
 	return 0;
Signature · 1 line
2.16.4
#6 lore raw

PATCH 3/3 ALSA: emux: Remove superfluous snd_info_register() calls

In reply to Takashi Iwai

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.

---
 sound/synth/emux/emux_proc.c | 4 ----
 1 file changed, 4 deletions(-)
sound/synth/emux/emux_proc.c +0 -4
index a82b4053bee8..c14781ac7941 100644
@@ -115,10 +115,6 @@ void snd_emux_proc_init(struct snd_emux *emu, struct snd_card *card, int device)
 	entry->content = SNDRV_INFO_CONTENT_TEXT;
 	entry->private_data = emu;
 	entry->c.text.read = snd_emux_proc_info_read;
-	if (snd_info_register(entry) < 0)
-		snd_info_free_entry(entry);
-	else
-		emu->proc = entry;
 }
 
 void snd_emux_proc_free(struct snd_emux *emu)
Signature · 1 line
2.16.4