Back to home page

OSCL-LXR

 
 

    


0001 // SPDX-License-Identifier: GPL-2.0-or-later
0002 /*
0003  *   ALSA sequencer /proc interface
0004  *   Copyright (c) 1998 by Frank van de Pol <fvdpol@coil.demon.nl>
0005  */
0006 
0007 #include <linux/init.h>
0008 #include <linux/export.h>
0009 #include <sound/core.h>
0010 
0011 #include "seq_info.h"
0012 #include "seq_clientmgr.h"
0013 #include "seq_timer.h"
0014 
0015 static struct snd_info_entry *queues_entry;
0016 static struct snd_info_entry *clients_entry;
0017 static struct snd_info_entry *timer_entry;
0018 
0019 
0020 static struct snd_info_entry * __init
0021 create_info_entry(char *name, void (*read)(struct snd_info_entry *,
0022                        struct snd_info_buffer *))
0023 {
0024     struct snd_info_entry *entry;
0025 
0026     entry = snd_info_create_module_entry(THIS_MODULE, name, snd_seq_root);
0027     if (entry == NULL)
0028         return NULL;
0029     entry->content = SNDRV_INFO_CONTENT_TEXT;
0030     entry->c.text.read = read;
0031     if (snd_info_register(entry) < 0) {
0032         snd_info_free_entry(entry);
0033         return NULL;
0034     }
0035     return entry;
0036 }
0037 
0038 void snd_seq_info_done(void)
0039 {
0040     snd_info_free_entry(queues_entry);
0041     snd_info_free_entry(clients_entry);
0042     snd_info_free_entry(timer_entry);
0043 }
0044 
0045 /* create all our /proc entries */
0046 int __init snd_seq_info_init(void)
0047 {
0048     queues_entry = create_info_entry("queues",
0049                      snd_seq_info_queues_read);
0050     clients_entry = create_info_entry("clients",
0051                       snd_seq_info_clients_read);
0052     timer_entry = create_info_entry("timer", snd_seq_info_timer_read);
0053     if (!queues_entry || !clients_entry || !timer_entry)
0054         goto error;
0055     return 0;
0056 
0057  error:
0058     snd_seq_info_done();
0059     return -ENOMEM;
0060 }