Merge branch 'linus' of git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6
[linux/fpc-iii.git] / sound / firewire / fireface / ff-proc.c
blob69441d121f71b4662d6106e31304d081f14de2c5
1 /*
2 * ff-proc.c - a part of driver for RME Fireface series
4 * Copyright (c) 2015-2017 Takashi Sakamoto
6 * Licensed under the terms of the GNU General Public License, version 2.
7 */
9 #include "./ff.h"
11 static void proc_dump_clock_config(struct snd_info_entry *entry,
12 struct snd_info_buffer *buffer)
14 struct snd_ff *ff = entry->private_data;
16 ff->spec->protocol->dump_clock_config(ff, buffer);
19 static void proc_dump_sync_status(struct snd_info_entry *entry,
20 struct snd_info_buffer *buffer)
22 struct snd_ff *ff = entry->private_data;
24 ff->spec->protocol->dump_sync_status(ff, buffer);
27 static void add_node(struct snd_ff *ff, struct snd_info_entry *root,
28 const char *name,
29 void (*op)(struct snd_info_entry *e,
30 struct snd_info_buffer *b))
32 struct snd_info_entry *entry;
34 entry = snd_info_create_card_entry(ff->card, name, root);
35 if (entry == NULL)
36 return;
38 snd_info_set_text_ops(entry, ff, op);
39 if (snd_info_register(entry) < 0)
40 snd_info_free_entry(entry);
43 void snd_ff_proc_init(struct snd_ff *ff)
45 struct snd_info_entry *root;
48 * All nodes are automatically removed at snd_card_disconnect(),
49 * by following to link list.
51 root = snd_info_create_card_entry(ff->card, "firewire",
52 ff->card->proc_root);
53 if (root == NULL)
54 return;
55 root->mode = S_IFDIR | S_IRUGO | S_IXUGO;
56 if (snd_info_register(root) < 0) {
57 snd_info_free_entry(root);
58 return;
61 add_node(ff, root, "clock-config", proc_dump_clock_config);
62 add_node(ff, root, "sync-status", proc_dump_sync_status);