struct semaphore access;
};
-int snd_info_check_reserved_words(const char *str);
-
#if defined(CONFIG_SND_OSSEMUL) && defined(CONFIG_PROC_FS)
int snd_info_minor_register(void);
int snd_info_minor_unregister(void);
entry->c.text.read = read;
}
+int snd_info_check_reserved_words(const char *str);
#else
static inline int snd_info_register(struct snd_info_entry * entry) { return 0; }
static inline int snd_info_unregister(struct snd_info_entry * entry) { return 0; }
-#define snd_card_proc_new(card,name,entryp) 0 /* always success */
-#define snd_info_set_text_ops(entry,private_data,read_size,read) /*NOP*/
+static inline int snd_card_proc_new(struct snd_card *card, const char *name,
+ struct snd_info_entry **entryp) { return -EINVAL; }
+static inline void snd_info_set_text_ops(struct snd_info_entry *entry __attribute__((unused)),
+ void *private_data,
+ long read_size,
+ void (*read)(struct snd_info_entry *, struct snd_info_buffer *)) {}
+
+static inline int snd_info_check_reserved_words(const char *str) { return 1; }
#endif
return snd_hwdep_free(hwdep);
}
+#ifdef CONFIG_PROC_FS
/*
* Info interface
*/
up(®ister_mutex);
}
-/*
- * ENTRY functions
- */
+static struct snd_info_entry *snd_hwdep_proc_entry;
-static struct snd_info_entry *snd_hwdep_proc_entry = NULL;
-
-static int __init alsa_hwdep_init(void)
+static void __init snd_hwdep_proc_init(void)
{
struct snd_info_entry *entry;
}
}
snd_hwdep_proc_entry = entry;
+}
+
+static void __exit snd_hwdep_proc_done(void)
+{
+ snd_info_unregister(snd_hwdep_proc_entry);
+}
+#else /* !CONFIG_PROC_FS */
+#define snd_hwdep_proc_init()
+#define snd_hwdep_proc_done()
+#endif /* CONFIG_PROC_FS */
+
+
+/*
+ * ENTRY functions
+ */
+
+static int __init alsa_hwdep_init(void)
+{
+ snd_hwdep_proc_init();
snd_ctl_register_ioctl(snd_hwdep_control_ioctl);
snd_ctl_register_ioctl_compat(snd_hwdep_control_ioctl);
return 0;
{
snd_ctl_unregister_ioctl(snd_hwdep_control_ioctl);
snd_ctl_unregister_ioctl_compat(snd_hwdep_control_ioctl);
- if (snd_hwdep_proc_entry) {
- snd_info_unregister(snd_hwdep_proc_entry);
- snd_hwdep_proc_entry = NULL;
- }
+ snd_hwdep_proc_done();
}
module_init(alsa_hwdep_init)
*
*/
+#ifdef CONFIG_PROC_FS
+
int snd_info_check_reserved_words(const char *str)
{
static char *reserved[] =
return 1;
}
-#ifdef CONFIG_PROC_FS
-
static DECLARE_MUTEX(info_mutex);
struct snd_info_private_data {
snd_info_version_done();
if (snd_proc_root) {
#if defined(CONFIG_SND_SEQUENCER) || defined(CONFIG_SND_SEQUENCER_MODULE)
- if (snd_seq_root)
- snd_info_unregister(snd_seq_root);
+ snd_info_unregister(snd_seq_root);
#endif
#ifdef CONFIG_SND_OSSEMUL
- if (snd_oss_root)
- snd_info_unregister(snd_oss_root);
+ snd_info_unregister(snd_oss_root);
#endif
snd_remove_proc_entry(&proc_root, snd_proc_root);
}
{
struct proc_dir_entry *root;
- snd_assert(entry != NULL, return -ENXIO);
+ if (! entry)
+ return 0;
snd_assert(entry->p != NULL, return -ENXIO);
root = entry->parent == NULL ? snd_proc_root : entry->parent->p;
snd_assert(root, return -ENXIO);
int (*snd_mixer_oss_notify_callback)(struct snd_card *card, int free_flag);
#endif
+#ifdef CONFIG_PROC_FS
static void snd_card_id_read(struct snd_info_entry *entry,
struct snd_info_buffer *buffer)
{
snd_iprintf(buffer, "%s\n", entry->card->id);
}
+static inline int init_info_for_card(struct snd_card *card)
+{
+ int err;
+ struct snd_info_entry *entry;
+
+ if ((err = snd_info_card_register(card)) < 0) {
+ snd_printd("unable to create card info\n");
+ return err;
+ }
+ if ((entry = snd_info_create_card_entry(card, "id", card->proc_root)) == NULL) {
+ snd_printd("unable to create card entry\n");
+ return err;
+ }
+ entry->c.text.read_size = PAGE_SIZE;
+ entry->c.text.read = snd_card_id_read;
+ if (snd_info_register(entry) < 0) {
+ snd_info_free_entry(entry);
+ entry = NULL;
+ }
+ card->proc_id = entry;
+ return 0;
+}
+#else /* !CONFIG_PROC_FS */
+#define init_info_for_card(card)
+#endif
+
static void snd_card_free_thread(void * __card);
/**
}
if (card->private_free)
card->private_free(card);
- if (card->proc_id)
- snd_info_unregister(card->proc_id);
+ snd_info_unregister(card->proc_id);
if (snd_info_card_free(card) < 0) {
snd_printk(KERN_WARNING "unable to free card info\n");
/* Not fatal error */
int snd_card_register(struct snd_card *card)
{
int err;
- struct snd_info_entry *entry;
snd_assert(card != NULL, return -EINVAL);
if ((err = snd_device_register_all(card)) < 0)
choose_default_id(card);
snd_cards[card->number] = card;
write_unlock(&snd_card_rwlock);
- if ((err = snd_info_card_register(card)) < 0) {
- snd_printd("unable to create card info\n");
- goto __skip_info;
- }
- if ((entry = snd_info_create_card_entry(card, "id", card->proc_root)) == NULL) {
- snd_printd("unable to create card entry\n");
- goto __skip_info;
- }
- entry->c.text.read_size = PAGE_SIZE;
- entry->c.text.read = snd_card_id_read;
- if (snd_info_register(entry) < 0) {
- snd_info_free_entry(entry);
- entry = NULL;
- }
- card->proc_id = entry;
- __skip_info:
+ init_info_for_card(card);
#if defined(CONFIG_SND_MIXER_OSS) || defined(CONFIG_SND_MIXER_OSS_MODULE)
if (snd_mixer_oss_notify_callback)
snd_mixer_oss_notify_callback(card, SND_MIXER_OSS_NOTIFY_REGISTER);
return 0;
}
+#ifdef CONFIG_PROC_FS
static struct snd_info_entry *snd_card_info_entry = NULL;
static void snd_card_info_read(struct snd_info_entry *entry,
snd_iprintf(buffer, "--- no soundcards ---\n");
}
-#if defined(CONFIG_SND_OSSEMUL) && defined(CONFIG_PROC_FS)
+#ifdef CONFIG_SND_OSSEMUL
void snd_card_info_read_oss(struct snd_info_buffer *buffer)
{
int __exit snd_card_info_done(void)
{
- if (snd_card_info_entry)
- snd_info_unregister(snd_card_info_entry);
+ snd_info_unregister(snd_card_info_entry);
#ifdef MODULE
- if (snd_card_module_info_entry)
- snd_info_unregister(snd_card_module_info_entry);
+ snd_info_unregister(snd_card_module_info_entry);
#endif
return 0;
}
+#endif /* CONFIG_PROC_FS */
+
/**
* snd_component_add - add a component string
* @card: soundcard structure
#define FORMAT(v) [SNDRV_PCM_FORMAT_##v] = #v
#define SUBFORMAT(v) [SNDRV_PCM_SUBFORMAT_##v] = #v
-static char *snd_pcm_stream_names[] = {
- STREAM(PLAYBACK),
- STREAM(CAPTURE),
-};
-
-static char *snd_pcm_state_names[] = {
- STATE(OPEN),
- STATE(SETUP),
- STATE(PREPARED),
- STATE(RUNNING),
- STATE(XRUN),
- STATE(DRAINING),
- STATE(PAUSED),
- STATE(SUSPENDED),
-};
-
-static char *snd_pcm_access_names[] = {
- ACCESS(MMAP_INTERLEAVED),
- ACCESS(MMAP_NONINTERLEAVED),
- ACCESS(MMAP_COMPLEX),
- ACCESS(RW_INTERLEAVED),
- ACCESS(RW_NONINTERLEAVED),
-};
-
static char *snd_pcm_format_names[] = {
FORMAT(S8),
FORMAT(U8),
FORMAT(U18_3BE),
};
+const char *snd_pcm_format_name(snd_pcm_format_t format)
+{
+ return snd_pcm_format_names[format];
+}
+
+#ifdef CONFIG_PROC_FS
+static char *snd_pcm_stream_names[] = {
+ STREAM(PLAYBACK),
+ STREAM(CAPTURE),
+};
+
+static char *snd_pcm_state_names[] = {
+ STATE(OPEN),
+ STATE(SETUP),
+ STATE(PREPARED),
+ STATE(RUNNING),
+ STATE(XRUN),
+ STATE(DRAINING),
+ STATE(PAUSED),
+ STATE(SUSPENDED),
+};
+
+static char *snd_pcm_access_names[] = {
+ ACCESS(MMAP_INTERLEAVED),
+ ACCESS(MMAP_NONINTERLEAVED),
+ ACCESS(MMAP_COMPLEX),
+ ACCESS(RW_INTERLEAVED),
+ ACCESS(RW_NONINTERLEAVED),
+};
+
static char *snd_pcm_subformat_names[] = {
SUBFORMAT(STD),
};
return snd_pcm_access_names[access];
}
-const char *snd_pcm_format_name(snd_pcm_format_t format)
-{
- return snd_pcm_format_names[format];
-}
-
static const char *snd_pcm_subformat_name(snd_pcm_subformat_t subformat)
{
return snd_pcm_subformat_names[subformat];
}
#endif
-#ifdef CONFIG_PROC_FS
static void snd_pcm_proc_info_read(struct snd_pcm_substream *substream,
struct snd_info_buffer *buffer)
{
snd_iprintf(buffer, "hw_ptr : %ld\n", runtime->status->hw_ptr);
snd_iprintf(buffer, "appl_ptr : %ld\n", runtime->control->appl_ptr);
}
-#endif
#ifdef CONFIG_SND_DEBUG
static void snd_pcm_xrun_debug_read(struct snd_info_entry *entry,
}
return 0;
}
+#else /* !CONFIG_PROC_FS */
+static inline int snd_pcm_stream_proc_init(struct snd_pcm_str *pstr) { return 0; }
+static inline int snd_pcm_stream_proc_done(struct snd_pcm_str *pstr) { return 0; }
+static inline int snd_pcm_substream_proc_init(struct snd_pcm_substream *substream) { return 0; }
+static inline int snd_pcm_substream_proc_done(struct snd_pcm_substream *substream) { return 0; }
+#endif /* CONFIG_PROC_FS */
/**
* snd_pcm_new_stream - create a new PCM stream
return 0;
}
+#ifdef CONFIG_PROC_FS
/*
* Info interface
*/
up(®ister_mutex);
}
-/*
- * ENTRY functions
- */
-
static struct snd_info_entry *snd_pcm_proc_entry = NULL;
-static int __init alsa_pcm_init(void)
+static void snd_pcm_proc_init(void)
{
struct snd_info_entry *entry;
- snd_ctl_register_ioctl(snd_pcm_control_ioctl);
- snd_ctl_register_ioctl_compat(snd_pcm_control_ioctl);
if ((entry = snd_info_create_module_entry(THIS_MODULE, "pcm", NULL)) != NULL) {
snd_info_set_text_ops(entry, NULL, SNDRV_CARDS * SNDRV_PCM_DEVICES * 128,
snd_pcm_proc_read);
}
}
snd_pcm_proc_entry = entry;
+}
+
+static void snd_pcm_proc_done(void)
+{
+ if (snd_pcm_proc_entry)
+ snd_info_unregister(snd_pcm_proc_entry);
+}
+
+#else /* !CONFIG_PROC_FS */
+#define snd_pcm_proc_init()
+#define snd_pcm_proc_done()
+#endif /* CONFIG_PROC_FS */
+
+
+/*
+ * ENTRY functions
+ */
+
+static int __init alsa_pcm_init(void)
+{
+ snd_ctl_register_ioctl(snd_pcm_control_ioctl);
+ snd_ctl_register_ioctl_compat(snd_pcm_control_ioctl);
+ snd_pcm_proc_init();
return 0;
}
{
snd_ctl_unregister_ioctl(snd_pcm_control_ioctl);
snd_ctl_unregister_ioctl_compat(snd_pcm_control_ioctl);
- if (snd_pcm_proc_entry) {
- snd_info_unregister(snd_pcm_proc_entry);
- snd_pcm_proc_entry = NULL;
- }
+ snd_pcm_proc_done();
}
module_init(alsa_pcm_init)
int snd_pcm_lib_preallocate_free(struct snd_pcm_substream *substream)
{
snd_pcm_lib_preallocate_dma_free(substream);
- if (substream->proc_prealloc_entry) {
- snd_info_unregister(substream->proc_prealloc_entry);
- substream->proc_prealloc_entry = NULL;
- }
+ snd_info_unregister(substream->proc_prealloc_entry);
+ substream->proc_prealloc_entry = NULL;
return 0;
}
return 0;
}
+#ifdef CONFIG_PROC_FS
/*
* read callback for prealloc proc file
*
}
}
-/*
- * pre-allocate the buffer and create a proc file for the substream
- */
-static int snd_pcm_lib_preallocate_pages1(struct snd_pcm_substream *substream,
- size_t size, size_t max)
+static inline void preallocate_info_init(struct snd_pcm_substream *substream)
{
struct snd_info_entry *entry;
- if (size > 0 && preallocate_dma && substream->number < maximum_substreams)
- preallocate_pcm_pages(substream, size);
-
- if (substream->dma_buffer.bytes > 0)
- substream->buffer_bytes_max = substream->dma_buffer.bytes;
- substream->dma_max = max;
if ((entry = snd_info_create_card_entry(substream->pcm->card, "prealloc", substream->proc_root)) != NULL) {
entry->c.text.read_size = 64;
entry->c.text.read = snd_pcm_lib_preallocate_proc_read;
}
}
substream->proc_prealloc_entry = entry;
+}
+
+#else /* !CONFIG_PROC_FS */
+#define preallocate_info_init(s)
+#endif
+
+/*
+ * pre-allocate the buffer and create a proc file for the substream
+ */
+static int snd_pcm_lib_preallocate_pages1(struct snd_pcm_substream *substream,
+ size_t size, size_t max)
+{
+
+ if (size > 0 && preallocate_dma && substream->number < maximum_substreams)
+ preallocate_pcm_pages(substream, size);
+
+ if (substream->dma_buffer.bytes > 0)
+ substream->buffer_bytes_max = substream->dma_buffer.bytes;
+ substream->dma_max = max;
+ preallocate_info_init(substream);
return 0;
}
return 0;
}
+#ifdef CONFIG_PROC_FS
/*
* INFO PART
*/
snd_info_unregister(snd_minor_info_entry);
return 0;
}
+#endif /* CONFIG_PROC_FS */
/*
* INIT PART
up(&sound_oss_mutex);
}
-#endif /* CONFIG_PROC_FS */
int __init snd_minor_info_oss_init(void)
{
-#ifdef CONFIG_PROC_FS
struct snd_info_entry *entry;
entry = snd_info_create_module_entry(THIS_MODULE, "devices", snd_oss_root);
}
}
snd_minor_info_oss_entry = entry;
-#endif
return 0;
}
int __exit snd_minor_info_oss_done(void)
{
-#ifdef CONFIG_PROC_FS
if (snd_minor_info_oss_entry)
snd_info_unregister(snd_minor_info_oss_entry);
-#endif
return 0;
}
+#endif /* CONFIG_PROC_FS */
#endif /* CONFIG_SND_OSSEMUL */
return snd_timer_global_register(timer);
}
+#ifdef CONFIG_PROC_FS
/*
* Info interface
*/
up(®ister_mutex);
}
+static struct snd_info_entry *snd_timer_proc_entry = NULL;
+
+static void __init snd_timer_proc_init(void)
+{
+ struct snd_info_entry *entry;
+
+ entry = snd_info_create_module_entry(THIS_MODULE, "timers", NULL);
+ if (entry != NULL) {
+ entry->c.text.read_size = SNDRV_TIMER_DEVICES * 128;
+ entry->c.text.read = snd_timer_proc_read;
+ if (snd_info_register(entry) < 0) {
+ snd_info_free_entry(entry);
+ entry = NULL;
+ }
+ }
+ snd_timer_proc_entry = entry;
+}
+
+static void __exit snd_timer_proc_done(void)
+{
+ snd_info_unregister(snd_timer_proc_entry);
+}
+#else /* !CONFIG_PROC_FS */
+#define snd_timer_proc_init()
+#define snd_timer_proc_done()
+#endif
+
/*
* USER SPACE interface
*/
* ENTRY functions
*/
-static struct snd_info_entry *snd_timer_proc_entry = NULL;
-
static int __init alsa_timer_init(void)
{
int err;
- struct snd_info_entry *entry;
#ifdef SNDRV_OSS_INFO_DEV_TIMERS
snd_oss_info_register(SNDRV_OSS_INFO_DEV_TIMERS, SNDRV_CARDS - 1,
"system timer");
#endif
- entry = snd_info_create_module_entry(THIS_MODULE, "timers", NULL);
- if (entry != NULL) {
- entry->c.text.read_size = SNDRV_TIMER_DEVICES * 128;
- entry->c.text.read = snd_timer_proc_read;
- if (snd_info_register(entry) < 0) {
- snd_info_free_entry(entry);
- entry = NULL;
- }
- }
- snd_timer_proc_entry = entry;
+
if ((err = snd_timer_register_system()) < 0)
snd_printk(KERN_ERR "unable to register system timer (%i)\n",
err);
&snd_timer_f_ops, NULL, "timer")) < 0)
snd_printk(KERN_ERR "unable to register timer device (%i)\n",
err);
+ snd_timer_proc_init();
return 0;
}
struct snd_timer *timer = list_entry(p, struct snd_timer, device_list);
snd_timer_unregister(timer);
}
- if (snd_timer_proc_entry) {
- snd_info_unregister(snd_timer_proc_entry);
- snd_timer_proc_entry = NULL;
- }
+ snd_timer_proc_done();
#ifdef SNDRV_OSS_INFO_DEV_TIMERS
snd_oss_info_unregister(SNDRV_OSS_INFO_DEV_TIMERS, SNDRV_CARDS - 1);
#endif