/* * oxfw_proc.c - a part of driver for OXFW970/971 based devices * * Copyright (c) 2014 Takashi Sakamoto * * Licensed under the terms of the GNU General Public License, version 2. */ #include "./oxfw.h" static void proc_read_formation(struct snd_info_entry *entry, struct snd_info_buffer *buffer) { struct snd_oxfw *oxfw = entry->private_data; struct snd_oxfw_stream_formation formation, curr; u8 *format; char flag; int i, err; /* Show input. */ err = snd_oxfw_stream_get_current_formation(oxfw, AVC_GENERAL_PLUG_DIR_IN, &curr); if (err < 0) return; snd_iprintf(buffer, "Input Stream to device:\n"); snd_iprintf(buffer, "\tRate\tPCM\tMIDI\n"); for (i = 0; i < SND_OXFW_STREAM_FORMAT_ENTRIES; i++) { format = oxfw->rx_stream_formats[i]; if (format == NULL) continue; err = snd_oxfw_stream_parse_format(format, &formation); if (err < 0) continue; if (memcmp(&formation, &curr, sizeof(curr)) == 0) flag = '*'; else flag = ' '; snd_iprintf(buffer, "%c\t%d\t%d\t%d\n", flag, formation.rate, formation.pcm, formation.midi); } if (!oxfw->has_output) return; /* Show output. */ err = snd_oxfw_stream_get_current_formation(oxfw, AVC_GENERAL_PLUG_DIR_OUT, &curr); if (err < 0) return; snd_iprintf(buffer, "Output Stream from device:\n"); snd_iprintf(buffer, "\tRate\tPCM\tMIDI\n"); for (i = 0; i < SND_OXFW_STREAM_FORMAT_ENTRIES; i++) { format = oxfw->tx_stream_formats[i]; if (format == NULL) continue; err = snd_oxfw_stream_parse_format(format, &formation); if (err < 0) continue; if (memcmp(&formation, &curr, sizeof(curr)) == 0) flag = '*'; else flag = ' '; snd_iprintf(buffer, "%c\t%d\t%d\t%d\n", flag, formation.rate, formation.pcm, formation.midi); } } static void add_node(struct snd_oxfw *oxfw, struct snd_info_entry *root, const char *name, void (*op)(struct snd_info_entry *e, struct snd_info_buffer *b)) { 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); } void snd_oxfw_proc_init(struct snd_oxfw *oxfw) { 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(oxfw->card, "firewire", oxfw->card->proc_root); if (root == NULL) return; root->mode = S_IFDIR | S_IRUGO | S_IXUGO; if (snd_info_register(root) < 0) { snd_info_free_entry(root); return; } add_node(oxfw, root, "formation", proc_read_formation); } ='10' name='q' value=''/>
path: root/tools/perf/pmu-events/arch/x86/broadwellde
diff options
context:
space:
mode:
authorFeng <fgao@ikuai8.com>2017-01-20 21:40:43 +0800
committerPablo Neira Ayuso <pablo@netfilter.org>2017-02-02 14:30:19 +0100
commit10435c1192d06bdb0bac7666452d8219d7e7c477 (patch)
tree93b76419142fe17b1d162d062c663297a3e8a965 /tools/perf/pmu-events/arch/x86/broadwellde
parent1a28ad74ebd8f9d3c7eae0d781f72a6d30545e17 (diff)
netfilter: nf_tables: Eliminate duplicated code in nf_tables_table_enable()
If something fails in nf_tables_table_enable(), it unregisters the chains. But the rollback code is the same as nf_tables_table_disable() almostly, except there is one counter check. Now create one wrapper function to eliminate the duplicated codes. Signed-off-by: Feng <fgao@ikuai8.com> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'tools/perf/pmu-events/arch/x86/broadwellde')