summaryrefslogtreecommitdiff
path: root/sound/firewire/dice
diff options
context:
space:
mode:
authorTakashi Sakamoto <o-takashi@sakamocchi.jp>2018-05-02 19:16:40 +0900
committerTakashi Iwai <tiwai@suse.de>2018-05-02 16:01:51 +0200
commit37149d66879ba8babb916a039cc123f44d6e2ab9 (patch)
tree73ec42cbbf4ec5d21c4bcd6128a11aa8c58036b7 /sound/firewire/dice
parent8feda7ddb6a3047609060840a4631b70623b0131 (diff)
ALSA: dice: add 'firewire' directory for proc nodes
Unlike the other drivers in ALSA firewire stack, ALSA dice driver does't create 'firewire' directory for proc nodes because it has 'dice' node only. But this is inconvenient because I have a plan to add another proc node to output available stream formats from cache. This commit let the driver to create the directory and put 'dice' node into it. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/firewire/dice')
-rw-r--r--sound/firewire/dice/dice-proc.c35
1 files changed, 32 insertions, 3 deletions
diff --git a/sound/firewire/dice/dice-proc.c b/sound/firewire/dice/dice-proc.c
index cc079323ed30..43b130b7aa07 100644
--- a/sound/firewire/dice/dice-proc.c
+++ b/sound/firewire/dice/dice-proc.c
@@ -243,10 +243,39 @@ static void dice_proc_read(struct snd_info_entry *entry,
}
}
-void snd_dice_create_proc(struct snd_dice *dice)
+static void add_node(struct snd_dice *dice, struct snd_info_entry *root,
+ const char *name,
+ void (*op)(struct snd_info_entry *entry,
+ struct snd_info_buffer *buffer))
{
struct snd_info_entry *entry;
- if (!snd_card_proc_new(dice->card, "dice", &entry))
- snd_info_set_text_ops(entry, dice, dice_proc_read);
+ 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);
+}
+
+void snd_dice_create_proc(struct snd_dice *dice)
+{
+ struct snd_info_entry *root;
+
+ /*
+ * All nodes are automatically removed at snd_card_disconnect(),
+ * by following to link list.
+ */
+ root = snd_info_create_card_entry(dice->card, "firewire",
+ dice->card->proc_root);
+ if (!root)
+ return;
+ root->mode = S_IFDIR | S_IRUGO | S_IXUGO;
+ if (snd_info_register(root) < 0) {
+ snd_info_free_entry(root);
+ return;
+ }
+
+ add_node(dice, root, "dice", dice_proc_read);
}