Skip to content

Commit

Permalink
ALSA: dice: add 'firewire' directory for proc nodes
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Takashi Sakamoto authored and Takashi Iwai committed May 2, 2018
1 parent 8feda7d commit 37149d6
Showing 1 changed file with 32 additions and 3 deletions.
35 changes: 32 additions & 3 deletions sound/firewire/dice/dice-proc.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

0 comments on commit 37149d6

Please sign in to comment.