2019-05-27 14:55:05 +08:00
|
|
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
2005-04-17 06:20:36 +08:00
|
|
|
/*
|
|
|
|
* ALSA sequencer /proc interface
|
|
|
|
* Copyright (c) 1998 by Frank van de Pol <fvdpol@coil.demon.nl>
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <linux/init.h>
|
2011-09-22 21:34:58 +08:00
|
|
|
#include <linux/export.h>
|
2005-04-17 06:20:36 +08:00
|
|
|
#include <sound/core.h>
|
|
|
|
|
|
|
|
#include "seq_info.h"
|
|
|
|
#include "seq_clientmgr.h"
|
|
|
|
#include "seq_timer.h"
|
|
|
|
|
2005-11-17 21:04:02 +08:00
|
|
|
static struct snd_info_entry *queues_entry;
|
|
|
|
static struct snd_info_entry *clients_entry;
|
|
|
|
static struct snd_info_entry *timer_entry;
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
|
2005-11-17 21:04:02 +08:00
|
|
|
static struct snd_info_entry * __init
|
2006-04-28 21:13:41 +08:00
|
|
|
create_info_entry(char *name, void (*read)(struct snd_info_entry *,
|
|
|
|
struct snd_info_buffer *))
|
2005-04-17 06:20:36 +08:00
|
|
|
{
|
2005-11-17 21:04:02 +08:00
|
|
|
struct snd_info_entry *entry;
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
entry = snd_info_create_module_entry(THIS_MODULE, name, snd_seq_root);
|
|
|
|
if (entry == NULL)
|
|
|
|
return NULL;
|
|
|
|
entry->content = SNDRV_INFO_CONTENT_TEXT;
|
|
|
|
entry->c.text.read = read;
|
|
|
|
if (snd_info_register(entry) < 0) {
|
|
|
|
snd_info_free_entry(entry);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
return entry;
|
|
|
|
}
|
|
|
|
|
2018-08-01 22:37:02 +08:00
|
|
|
void snd_seq_info_done(void)
|
2015-04-23 04:29:10 +08:00
|
|
|
{
|
|
|
|
snd_info_free_entry(queues_entry);
|
|
|
|
snd_info_free_entry(clients_entry);
|
|
|
|
snd_info_free_entry(timer_entry);
|
|
|
|
}
|
|
|
|
|
2005-04-17 06:20:36 +08:00
|
|
|
/* create all our /proc entries */
|
|
|
|
int __init snd_seq_info_init(void)
|
|
|
|
{
|
2006-04-28 21:13:41 +08:00
|
|
|
queues_entry = create_info_entry("queues",
|
2005-04-17 06:20:36 +08:00
|
|
|
snd_seq_info_queues_read);
|
2006-04-28 21:13:41 +08:00
|
|
|
clients_entry = create_info_entry("clients",
|
2005-04-17 06:20:36 +08:00
|
|
|
snd_seq_info_clients_read);
|
2006-04-28 21:13:41 +08:00
|
|
|
timer_entry = create_info_entry("timer", snd_seq_info_timer_read);
|
2015-04-23 04:29:10 +08:00
|
|
|
if (!queues_entry || !clients_entry || !timer_entry)
|
|
|
|
goto error;
|
2005-04-17 06:20:36 +08:00
|
|
|
return 0;
|
2015-04-23 04:29:10 +08:00
|
|
|
|
|
|
|
error:
|
2018-08-01 22:37:02 +08:00
|
|
|
snd_seq_info_done();
|
2015-04-23 04:29:10 +08:00
|
|
|
return -ENOMEM;
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|